Maxim Egorushkin added the comment:
I encountered this issue when compiling gdb against my own build of Python 2.7
in a non-standard location. gdb could not locate libpython2.7.so.
The solution is to configure Python with LINKFORSHARED variable which contains
additional linker flags required to link against libpython2.7.so. Here are the
relevant bits (in Makefile syntax):
prefix := /opt/toolchain
python_version := 2.7.10
PREFIX := ${prefix}/python-${python_version}
CPPFLAGS := -fmessage-length=0
LINKFORSHARED := -L${PREFIX}/lib64 -Wl,-rpath=${PREFIX}/lib64
./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib64 --enable-shared
--enable-unicode=ucs4 CPPFLAGS="${cppflags}" LDFLAGS="${LDFLAGS}"
LINKFORSHARED="${LINKFORSHARED}"
After Python is built and installed verify the flags:
$ /opt/toolchain/python-2.7.10/bin/python-config --ldflags
-lpython2.7 -lpthread -ldl -lutil -lm
-L/opt/toolchain/python-2.7.10/lib64
-Wl,-rpath=/opt/toolchain/python-2.7.10/lib64
----------
nosy: +max0x7ba
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7352>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com