GNOME Bugzilla – Bug 747114
Bad setting of library dir when using custom Python installation
Last modified: 2021-07-05 13:21:15 UTC
I tried to compile libxml2 2.9.2 on my system (SL5) using a custom installation of Python. The configuration script finds the correct location: checking for python... /wizard/04/mori/software/install/PYTHON_2.7.8/bin/python Found Python version 2.7 but then it does not set the needed -L linker flag, resulting in a link error: libtool: link: gcc -shared -fPIC -DPIC .libs/libxml.o .libs/libxml2-py.o .libs/types.o -Wl,-rpath -Wl,/wizard/04/mori/software/source/libxml2-2.9.2/.libs -Wl,-rpath -Wl,/usr/local/lib ../.libs/libxml2.so -lz -lpthread -ldl -lutil -lm -lpython2.7 -O2 -Wl,-export-dynamic -Wl,-soname -Wl,libxml2mod.so -o .libs/libxml2mod.so /usr/bin/ld: cannot find -lpython2.7 This is because the link flags for python are set in configure at line 14537 using python$PYTHON_VERSION-config --ldflags, which on my system does not return any information about the python lib directory: $ python$PYTHON_VERSION-config --ldflags -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic I solved the problem adding this line to configure, just after line 14537: PYTHON_LIBS=$PYTHON_LIBS\ -L`dirname \`find \\\`python$PYTHON_VERSION-config --prefix\\\` -name libpython$PYTHON_VERSION*.so\` `
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.