Installed ncurses, now how do I get my app to use it?

Timur Tabi timur at tabi.org
Sat Apr 26 16:52:42 PDT 2008


Ryan Schmidt wrote:

>> I have ncurses installed via darwinports:
> 
> It's called MacPorts.

Sorry, I don't know what I was thinking.

> Try adding -I/opt/local/include to your CPPFLAGS and -L/opt/local/lib to 
> your LDFLAGS.

That didn't work.  If I try to set CFLAGS directly, the Makefile 
complains that I'm changing CFLAGS.

Here's the code that checks:

# Check if we can link to ncurses
check() {
         echo -e " #include CURSES_LOC \n main() {}" |
             $cc -xc - -o $tmp 2> /dev/null
         if [ $? != 0 ]; then
             echo " *** Unable to find the ncurses libraries or the" 
    1>&2

Adding the -I and -L to the $cc line didn't work either.  $cc is equal 
to this:

gcc -DCURSES_LOC=<ncurses.h> -DLOCALE -DKBUILD_NO_NLS -lncurses

It looks like it found ncurses.h but not the library.  This is what I 
have in /opt/local/lib/libncurses*:

    ls /opt/local/lib/libncurses*
/opt/local/lib/libncurses++.a		/opt/local/lib/libncurses.dylib
/opt/local/lib/libncurses++w.a		/opt/local/lib/libncursesw.5.dylib
/opt/local/lib/libncurses.5.dylib	/opt/local/lib/libncursesw.a
/opt/local/lib/libncurses.a		/opt/local/lib/libncursesw.dylib


My question is more broad than this specific case.  Since macports 
installs all these libraries and header files in nonstandard locations, 
they can't be found by any Makefile.  No matter what I'm building, I 
would need to modify the Makefile in order to get it to work.

This seems contrary to the purpose behind MacPorts, which is supposed to 
make it easy to install this kind of software.  But if the installed 
applications, header files, and libraries are sequestered into an 
obscure path, then nothing will find them!  There's got to be some easy 
way to add these paths so that they'll always be picked up, isn't there?


More information about the macports-users mailing list