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.

Author max0x7ba
Recipients Arfrever, brobecke, doko, eric.araujo, koobs, loewis, mauger, max0x7ba, tarek, vstinner
Date 2015-10-07.08:02:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1444204972.09.0.297149213666.issue7352@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2015-10-07 08:02:52max0x7basetrecipients: + max0x7ba, loewis, doko, vstinner, tarek, eric.araujo, Arfrever, mauger, brobecke, koobs
2015-10-07 08:02:52max0x7basetmessageid: <1444204972.09.0.297149213666.issue7352@psf.upfronthosting.co.za>
2015-10-07 08:02:52max0x7balinkissue7352 messages
2015-10-07 08:02:51max0x7bacreate