0

I'm trying to install ncurses to a non system-wide prefix (for cross compilation).

Everything worked fine and I was able to install ncurses to the specified prefix, with the header files residing in <prefix>/include/ncurses.

A program I'm trying to compile (specifically GHC) doesn't find the headers, because it tries to #include <ncurses.h>, which doesn't work. (include <ncurses/ncurses.h> does work though, but GHC doesn't try this.)

So I thought installing the headers to <prefix>/include directly would do the trick, but I wasn't able to this. Passing --includedir=<prefix>/include to the configure script of ncurses didn't give the desired result, because the installed ncurses.h then tries to #include <include/ncurses_dll.h>, which doesn't work.

<prefix>/include is of course in the search path of the used CPP.

Kritzefitz
  • 2,644
  • 1
  • 20
  • 35

1 Answers1

1

As a rule, --includedir for autoconf-based configure scripts is used to tell the makefiles where to install header files, not where to include them from during compilation.

Instead, the options that you might want to set would be in the CPPFLAGS variable. For instance, since GHC expects the ncurses header files only in the standard location, you might work around the problem by specifying both of the directories as -I options in CPPFLAGS.

Here are a few discussions to help:

By the way, that prefix/lib looks odd...

Regarding the comment about --disable-overwrite, Linux and some other platforms default to enabling this feature. OSX for one does not. At the end of configuring, the configure script runs a makefile rule to show the resulting configuration. If overwrite is disabled, you would see a message like this:

** Include-directory is not in a standard location
Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • I actually passed the --includedir option to ncurses' configure script, not to GHC's, so like you said, to tell it where to install them. Setting CPPFLAGS for the GHC build would of course be an option, but I would still like to know how to install the headers i to CPP's root search path (thus `/lib`). – Kritzefitz Mar 22 '15 at 21:43
  • You were right. `/lib` was of course wrong. I actually meant `/include`, but I was only mixing these up while writing the answer, not while installing. So the problem persists. – Kritzefitz Mar 22 '15 at 21:52
  • If I understand your comment, you have ncurses' headers installed after configuring using `--disable-overwrite` (see the `INSTALLATION` file in the sources). If you have installed ncurses with `--prefix` set to something other `/usr` or `/usr/local`, the disable-overwrite would be unnecessary (usually...). Given that you are cross-compiling, I would have configured ncurses to install into the path which the cross-compiler uses. – Thomas Dickey Mar 22 '15 at 22:23
  • I'm installing into the path that the cross compiler uses. In this case a directory under my home directory. I didn't pass --disable-overwrite, but maybe it was activated implicitly by some other flag. I will try building with --enable-overwrite. Unfortunately I don't have access to the machine I was building on until next weekend. So it will take some tim until I can test this. – Kritzefitz Mar 22 '15 at 22:39