views:

332

answers:

1

I'm attempting to build Python 2.6.2 from source on my Linux system. It has ncurses installed on /usr/local/, and curses.h is on /usr/local/include/ncurses. So curses.h isn't found on the include path, and those packages fail in the Python build.

What's the right solution to this? Is Python supposed to include <ncurses/curses.h>? Should /usr/local/include/ncurses be in the include path? Should there be a link from the files in the ncurses directory to /usr/local/include?

Or is there some simpler solution?

A: 

With many Open Source packages, you can set:

export CPPFLAGS="-I/usr/local/include"

or even:

export CPPFLAGS="-I/usr/local/include/ncurses"

before running the configure script. I haven't compiled Python recently enough to be sure that works, but it probably does -- I have ncurses installed under /usr/gnu (because /usr/local/ is automounted and contains antiques) and I don't remember having to use anything special to get it to work.


Double-checked...

The configure script only includes <curses.h>. I had to use:

export CPPFLAGS="-I/usr/gnu/include -I/usr/gnu/include/ncurses"
export LDFLAGS="-L/usr/gnu/lib"
./configure

To get the Python (2.5) configure to accept curses. You'd replace 'gnu' with 'local' for your configuration.

Jonathan Leffler
This did the trick for me. I tried setting CFLAGS and that didn't work, it needed to be CPPFLAGS. And for me the LDFLAGS wasn't necessary, as libncurses is found on my LD_LIBRARY_PATH okay. Thank you!
Mojo