This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Under OS X, compiling against local readline fails
Type: Stage:
Components: Build Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, narzola72, ronaldoussoren
Priority: normal Keywords:

Created on 2006-07-03 00:42 by narzola72, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
config.log narzola72, 2006-07-06 10:04 config.log from building python 2.4.3
python.log.gz narzola72, 2006-07-06 10:06 complete session build log
Messages (7)
msg29016 - (view) Author: Nelson Arzola (narzola72) Date: 2006-07-03 00:42
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?
msg29017 - (view) Author: Nelson Arzola (narzola72) Date: 2006-07-03 00:44
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.
msg29018 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-07-06 08:22
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.
msg29019 - (view) Author: Nelson Arzola (narzola72) Date: 2006-07-06 10:04
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@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@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@macmini 135> 
msg29020 - (view) Author: Nelson Arzola (narzola72) Date: 2006-07-06 10:06
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.
msg29021 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-07-25 20:52
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.
msg59319 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-05 19:49
probably outdated and already fixed. Please open a new bug if you still
can't link against the system's libreadline
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43599
2008-01-05 19:49:19christian.heimessetstatus: open -> closed
nosy: + christian.heimes
resolution: out of date
messages: + msg59319
2006-07-03 00:42:23narzola72create