compiling Python 2.7.1 with readline module fails on Debian (Virtualbox)

Stefan Sonnenberg-Carstens stefan.sonnenberg at pythonmeister.com
Thu Dec 23 11:46:44 EST 2010


Am 23.12.2010 15:37, schrieb Benedict Verheyen:
> On 23/12/2010 14:09, Benedict Verheyen wrote:
> <snip>
>> I started from scratch.
>> I tried to build readline 6 and 5, and installing the packages system wide
>> as opposed to $HOME/local, but everytime Python fails to find it.
>>
>> On stable, apt-get build-dep python 2.6 doesn't work, but
>> apt-get build-dep python 2.5 does so i did that.
>>
>> At configure time, the libreadline library is now found but i have no clue
>> why it didn't find the readline version i built.
>> At the end of the Python build, it still ends with this message:
>>
>> Failed to build these modules:
>> readline
>>
>> The other modules that where automatically installed via the build-dep
>> command are built successfully.
>> I have pasted the config.log here:
>>      http://paste.pocoo.org/show/308859/
>>
>> Thanks,
>> Benedict
>>
> I did a new test, again completely from scratch.
> I built ncurses and readline, installed them system wide (normal make install
> without a --prefix).
> Then i editing Modules/Setup.dist to include readline and adding the correct paths
> to the include and libs files. configure now finds the readline library.
> However, ncurses and readline still fail to be built.
>
> I had a look at the output of make.
> This is the error for ncurses:
>
> building '_curses' extension
> gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/home/benedict/local/include -I.
> -IInclude -I./Include -I/usr/local/include -I/home/benedict/src/Python-2.7.1/Include -I/home/benedict/src/Python-2.7.1 -c
> /home/benedict/src/Python-2.7.1/Modules/_cursesmodule.c -o build/temp.linux-x86_64-2.7/home/benedict/src/Python-2.7.1/Modules/_cursesmodule.o
>
> gcc -pthread -shared build/temp.linux-x86_64-2.7/home/benedict/src/Python-2.7.1/Modules/_cursesmodule.o -L/home/benedict/local/lib
> -L/usr/local/lib -L. -lncurses -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses.so
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libncurses.a(lib_addch.o): relocation R_X86_64_32 against `a local symbol'
> can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libncurses.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
>
> building '_curses_panel' extension
> gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/home/benedict/local/include -I.
> -IInclude -I./Include -I/usr/local/include -I/home/benedict/src/Python-2.7.1/Include -I/home/benedict/src/Python-2.7.1 -c
> /home/benedict/src/Python-2.7.1/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.7/home/benedict/src/Python-2.7.1/Modules/_curses_panel.o
>
> gcc -pthread -shared build/temp.linux-x86_64-2.7/home/benedict/src/Python-2.7.1/Modules/_curses_panel.o -L/home/benedict/local/lib
> -L/usr/local/lib -L. -lpanel -lncurses -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses_panel.so
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libpanel.a(p_above.o): relocation R_X86_64_32 against `a local symbol' can
> not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libpanel.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
>
> The error for readline:
>
> gcc -pthread  -Xlinker -export-dynamic -o python \
> 			Modules/python.o \
> 			-L. -lpython2.7 -lpthread -ldl  -lutil -lreadline -L/usr/local/lib   -lm
> /usr/local/lib/libreadline.so: undefined reference to `PC'
> /usr/local/lib/libreadline.so: undefined reference to `tgetflag'
> /usr/local/lib/libreadline.so: undefined reference to `tgetent'
> /usr/local/lib/libreadline.so: undefined reference to `UP'
> /usr/local/lib/libreadline.so: undefined reference to `tputs'
> /usr/local/lib/libreadline.so: undefined reference to `tgoto'
> /usr/local/lib/libreadline.so: undefined reference to `tgetnum'
> /usr/local/lib/libreadline.so: undefined reference to `BC'
> /usr/local/lib/libreadline.so: undefined reference to `tgetstr'
> collect2: ld returned 1 exit status
> make: *** [python] Fout 1
>
> Thanks,
> Benedict
>
It seems some libs are compiled without PIC (position indepentent code), 
but python
should be.
That will not work.
I'm currently setting up a VM, to try to follow the steps.

Why do you want to build a readline etc when it is in the system ?



More information about the Python-list mailing list