classification
Title: _cursesmodule does not build, doesn't find Python.h on Solaris
Type: compile error Stage: needs patch
Components: Build Versions: Python 3.2
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: automatthias, eric.araujo, jcea
Priority: normal Keywords:

Created on 2011-11-13 23:16 by automatthias, last changed 2012-10-04 01:42 by jcea. This issue is now closed.

Messages (9)
msg147578 - (view) Author: Maciej Bliziński (automatthias) Date: 2011-11-13 23:16
Compilation of Python 3.2.2 fails on Solaris 9 as follows:

/opt/SUNWspro/bin/cc  -xcode=pic32 -xO3 -m32 -xarch=v8 -I/opt/csw/include  -c ./Modules/_cursesmodule.c -o Modules/_cursesmodule.o
"./Modules/_cursesmodule.c", line 105: cannot find include file: "Python.h"
"./Modules/_cursesmodule.c", line 117: cannot find include file: "py_curses.h"
"./Modules/_cursesmodule.c", line 130: warning: no explicit type given
"./Modules/_cursesmodule.c", line 130: syntax error before or at: attr_t
"./Modules/_cursesmodule.c", line 130: warning: old-style declaration or incorrect type for: attr_t
"./Modules/_cursesmodule.c", line 139: warning: no explicit type given
"./Modules/_cursesmodule.c", line 139: syntax error before or at: *
(...)

The problem seems to be a missing -I flag for the compiler, pointing at the Include directory in Python sources.
msg147590 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-11-14 12:57
Maciej, could you possibly provide a "diff" file to apply?. I care about Solaris support, but I don't have a Solaris 9 around for testing. Only Solaris 10 and OpenIndiana.

Try to provide a minimal patch, please.
msg147591 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-11-14 12:58
BTW, have you tried to compile with GCC?
msg147660 - (view) Author: Maciej Bliziński (automatthias) Date: 2011-11-15 09:03
I haven't tried building with GCC, Python has always been built with Sun Studio at OpenCSW.  I've got very similar build files for Python 2.6, 2.7, 3.0, and 3.1 -- none of them have this problem, so this is a regression in 3.2.

What diff would you like to see? The problem manifests itself with pristine Python sources, no patches are needed to reproduce it.

When the modules are built, how normally get the -I flags are set so that the modules can find the Python.h file?
msg147677 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-11-15 14:47
Can you add the missing library path in CFLAGS and LDFLAGS environment variables?.

Something like: (from a fresh source code)

./configure OPTIONS CFLAGS=-Ipath LDFLAGS=-Ipath

If that works, we can explore why the path is not detected automatically.

Do your path contains any unusual character, like spaces?

Tell me the exact "configure" line you are using.

Have you tried to build python 3.3? (unreleased yet, current development version)

The include directorios is defined in "Makefile", variable PY_CPPFLAGS. In my system, that is "-I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS". What is the value in your system? (after the configure step).
msg147678 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-11-15 14:48
BTW, is only curses building failing?. Is the rest of the code built correctly?. That would be a good hint.
msg147679 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-15 14:52
This module also fails to build on my Debian.  I had the libcursesw headers installed and one day it was not enough; installing libcurses headers fixes it.  I don’t know if it’s the same problem or something related to Debian multiarch.
msg147762 - (view) Author: Maciej Bliziński (automatthias) Date: 2011-11-16 10:08
It's not only the curses module, other two modules are failing as well, the same way - not finding Python.h.

maciej@unstable9s :~/src/opencsw/pkg/lang-python/python/branches/python-3.2 > grep ^PY_CPPFLAGS work/solaris9-sparc/build-isa-sparcv8/Python-3.2.2/Makefile
PY_CPPFLAGS=    -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)

Perhaps PY_CPPFLAGS does not get included in the compiler invocation? Poking around the Makefile, I find:

Modules/_cursesmodule.o: $(srcdir)/Modules/_cursesmodule.c; $(CC)  $(CCSHARED) $(CFLAGS) $(CPPFLAGS)  -c $(srcdir)/Modules/_cursesmodule.c -o Modules/_cursesmodule.o

This line doesn't contain a reference to PY_CPPFLAGS.

Perhaps the answer is around line 220 in Modules/makesetup?
msg171916 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012-10-04 01:42
I close this bug as "out of date". If you think this is still an issue, please, reopen.
History
Date User Action Args
2012-10-04 01:42:57jceasetstatus: open -> closed
resolution: out of date
messages: + msg171916
2011-11-16 10:08:42automatthiassetmessages: + msg147762
2011-11-15 14:52:57eric.araujosetnosy: + eric.araujo
messages: + msg147679
2011-11-15 14:48:50jceasetmessages: + msg147678
2011-11-15 14:47:33jceasetmessages: + msg147677
2011-11-15 09:03:28automatthiassetmessages: + msg147660
2011-11-14 12:58:04jceasetmessages: + msg147591
2011-11-14 12:57:05jceasetnosy: + jcea

messages: + msg147590
stage: needs patch
2011-11-13 23:17:56automatthiassettitle: _cursesmodule missing Python.h on Solaris -> _cursesmodule does not build, doesn't find Python.h on Solaris
2011-11-13 23:16:56automatthiascreate