[ python-Bugs-1516068 ] Under OS X, compiling against local readline fails

SourceForge.net noreply at sourceforge.net
Tue Jul 25 22:52:59 CEST 2006


Bugs item #1516068, was opened at 2006-07-03 02:42
Message generated for change (Comment added) made by ronaldoussoren
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1516068&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Nelson Arzola (narzola72)
Assigned to: Nobody/Anonymous (nobody)
Summary: Under OS X, compiling against local readline fails

Initial Comment:
I've installed a version of the GNU Readline (5.1) in a
local directory (/Volumes/DATA/dev/toolset/{include,lib}.

I'm compiling Python with:

CFLAGS=-I/Volumes/DATA/dev/toolset/include \
LDFLAGS=-L/Volumes/DATA/dev/toolset/lib \
./configure \
     --prefix=/Volues/DATA/dev/toolset/inst/python \
     --with-libs="-lexpat -lncurses -lreadline"
make

I get the following error:

./Modules/readline.c:885: error: 'HISTORY_STATE'
undeclared (first use in this function)
./Modules/readline.c:885: error: 'state' undeclared
(first use in this function)
./Modules/readline.c:887: warning: assignment discards
qualifiers from pointer target type

When I look at the gcc command that was used to compile
Modules/readline.c, I see that my CFLAGS is not passed
to gcc and so the (broken) system readline is being used.

I can temporarily solve this problem with:

echo "readline readline.c ${CFLAGS} ${LDFLAGS}
-lreadline -l termcap" >> Modules/Setup.local

before I call make.

What I can't understand is why the build process
correctly uses the local version of expat (2.0.0) that
is installed in the directories with readline, but not
readline?

----------------------------------------------------------------------

>Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2006-07-25 22:52

Message:
Logged In: YES 
user_id=580910

I think this is fixed in python2.5, could you verify that?

I've applied a patch to setup.py a while back that makes it use -I and -L flags 
that in LDFLAGS/CFLAGS during the build of python (on osx only).

I'm building 2.5 with a local installation of readline (and several other libraries) 
and that works fine. 2.4 also works for me, but my 2.4 tree contains a number 
of patches that might affect this issue.

----------------------------------------------------------------------

Comment By: Nelson Arzola (narzola72)
Date: 2006-07-06 12:06

Message:
Logged In: YES 
user_id=1478788

I also included the complete session build log because I can
see that the CFLAGS and LDFLAGS are being passed through at
least some of the time.  Hope this all helps.

----------------------------------------------------------------------

Comment By: Nelson Arzola (narzola72)
Date: 2006-07-06 12:04

Message:
Logged In: YES 
user_id=1478788

I redid my build, and I can confirm that the build process
picked up the correct version of expat and will not pick up
the correct version of readline without the fix labeled above.

I've included my config.log because I think it might help
you -- atleast you can see the various settings that I had
in place.

Here is the output of otool -L:

CWD> /Volumes/DATA/dev/toolset/bin 
narzola at macmini 133> ./python
Python 2.4.3 (#1, Jul  6 2006, 02:42:44) 
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>> 
CWD> /Volumes/DATA/dev/toolset/bin 
narzola at macmini 134> otool -L python
python:
       
/Volumes/DATA/dev/toolset/inst/expat/lib/libexpat.1.dylib
(compatibility version 7.0.0, current version 7.0.0)
        /usr/lib/libncurses.5.4.dylib (compatibility version
5.4.0, current version 5.4.0)
       
/Volumes/DATA/dev/toolset/inst/readline/lib/libreadline.5.1.dylib
(compatibility version 5.0.0, current version 5.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version
1.0.0, current version 88.1.6)
        /usr/lib/libstdc++.6.dylib (compatibility version
7.0.0, current version 7.4.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version
1.0.0, current version 1.0.0)
CWD> /Volumes/DATA/dev/toolset/bin 
narzola at macmini 135> 

----------------------------------------------------------------------

Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2006-07-06 10:22

Message:
Logged In: YES 
user_id=580910

Are you sure it picks up the copy of expat you expect it to use?

I fixed this issue (CFLAGS being ignored) for python 2.5 (on the mac only).

BTW. You should use "OPT" instead of "CFLAGS" to pass additional compiler 
flags, IIRC the latter is replaced completely by the configure script.

----------------------------------------------------------------------

Comment By: Nelson Arzola (narzola72)
Date: 2006-07-03 02:44

Message:
Logged In: YES 
user_id=1478788

Sorry, I forgot to mention that I'm using the latest verion
of Python 2.4.3 from python.org.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1516068&group_id=5470


More information about the Python-bugs-list mailing list