Failure upon building on macOS Catalina: 'Unable to find the ncurses package'


I'm still trying to get a working build system (macOS 10.15.7 Catalina with MacPorts).

I'm getting a weird 'ncurses not found' error.

Alex@192 make menuconfig -j1 V=s
make[1]: Entering directory '/Volumes/OpenWrt/openwrt/scripts/config'
set -e; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/sh; } > ./.mconf-cfg.tmp; if [ ! -r mconf-cfg ] || ! cmp -s mconf-cfg ./.mconf-cfg.tmp; then true '  UPD     mconf-cfg'; mv -f ./.mconf-cfg.tmp mconf-cfg; fi
* Unable to find the ncurses package.
* Install ncurses (ncurses-devel or libncurses-dev
* depending on your distribution).
* You may also need to install pkg-config to find the
* ncurses installed in a non-default location.
make[1]: *** [Makefile:97: mconf-cfg] Error 1
make[1]: Leaving directory '/Volumes/OpenWrt/openwrt/scripts/config'
make: *** [/Volumes/OpenWrt/openwrt/include/ scripts/config/mconf] Error 2

Everything looks straightforward: install ncurses and pkgconfig packages. Which I did: both from MacPorts and from source code.

Alex@192 openwrt % pkg-config --cflags --libs ncurses
-D_DARWIN_C_SOURCE -I/opt/local/include -L/opt/local/lib -Wl,-search_paths_first -lncurses

Alex@192 openwrt % ls /opt/local/include/ncurses
curses.h     cursesf.h	cursesp.h  cursslk.h  etip.h  menu.h	  ncurses.h	 panel.h  term_entry.h	tic.h
cursesapp.h  cursesm.h	cursesw.h  eti.h      form.h  nc_tparm.h  ncurses_dll.h  term.h   termcap.h	unctrl.h

Alex@192 openwrt % ls /opt/local/include
archive.h	 evdns.h	   gmpxx.h	 libintl.h	    nc_tparm.h		sasl	      unistr.h
archive_entry.h  event.h	   gnumake.h	 libltdl	    ncurses		sqlite3.h     unistring
autosprintf.h	 event2		   gnutls	 libpsl.h	    ncurses.h		sqlite3ext.h  unitypes.h
bzlib.h		 evhttp.h	   gssapi	 libtasn1.h	    ncurses_dll.h	term.h	      uniwbrk.h
com_err.h	 evrpc.h	   gssapi.h	 libxml2	    nettle		term_entry.h  uniwidth.h
curl		 evutil.h	   gssrpc	 libxslt	    openssl		termcap.h     uv
curses.h	 expat.h	   histedit.h	 localcharset.h     p11-kit-1		tic.h	      uv.h
cursesapp.h	 expat_config.h    httrack	 ltdl.h		    panel.h		unctrl.h      verto-module.h
cursesf.h	 expat_external.h  iconv.h	 lz4.h		    pcre.h		unicase.h     verto.h
cursesm.h	 ffi.h		   idn2.h	 lz4frame.h	    pcre2.h		unicode       zconf.h
cursesp.h	 ffitarget.h	   kadm5	 lz4frame_static.h  pcre2posix.h	uniconv.h     zdict.h
cursesw.h	 form.h		   kdb.h	 lz4hc.h	    pcre_scanner.h	unictype.h    zlib.h
cursslk.h	 gawkapi.h	   krad.h	 lzma		    pcre_stringpiece.h	unigbrk.h     zstd.h
editline	 gettext-po.h	   krb5		 lzma.h		    pcrecpp.h		unilbrk.h     zstd_errors.h
et		 gio-unix-2.0	   krb5.h	 lzo		    pcrecpparg.h	uniname.h
eti.h		 glib-2.0	   libcharset.h  menu.h		    pcreposix.h		uninorm.h
etip.h		 gmp.h		   libexslt	 mysql8		    profile.h		unistdio.h

But this doesn't help to solve the problem. If I run

make dirclean
make menuconfig

Menuconfig works.

But if I first run 'make kernel_menuconfig' I can't run 'make menuconfig' afterwards and get an ncurses error.

make dirclean
make kernel_menuconfig
make menuconfig
make -s -C scripts/config mconf: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [/Volumes/OpenWrt/openwrt/include/ scripts/config/mconf] Error 1

Where can I find the culprit?

Looks like I found the solution. For some reason OpenWRT build system has trouble finding ncurses in /opt/local/include or /opt/local/include/ncurses dirs.

I've added the following lines to ./scripts/config/ to force 'make menuconfig' to work.

# Check MacPorts path
if [ -f /opt/local/include/ncurses.h ]; then
	echo cflags=\"-D_GNU_SOURCE -I/opt/local/include\"
	echo libs=\"-lncurses\"
	exit 0

# Check path for ncurses installed from source
if [ -f /opt/local/include/ncurses/ncurses.h ]; then
	echo cflags=\"-D_GNU_SOURCE -I/opt/local/include/ncurses\"
	echo libs=\"-lncurses\"
	exit 0

P. S. Maybe someone could make a patch so that it could be committed in OpenWRT repo.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.