incorrect linkage if system PyCXX is found #1884

merged 1 commit into from Apr 25, 2013


None yet

2 participants


as reported on matotlib-devel by @fperez
If current matplotlib HEAD is built on a system with PyCXX installed its extensions ends up with different incorrect linkage than when it does not find a system installation:
On ubuntu 12.10
with python-cxx-dev installed:

                 pycxx: yes [version None]

g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/src/_png.o build/temp.linux-x86_64-2.7/src/mplutils.o build/temp.linux-x86_64-2.7/usr/share/python2.7/CXX/cxxsupport.o build/temp.linux-x86_64-2.7/usr/share/python2.7/CXX/cxx_extensions.o build/temp.linux-x86_64-2.7/usr/share/python2.7/CXX/IndirectPythonInterface.o build/temp.linux-x86_64-2.7/usr/share/python2.7/CXX/cxxextensions.o -L/usr/local/lib -lstdc++ -lm -lstdc++ -lm -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -lstdc++ -lm -o build/lib.linux-x86_64-2.7/matplotlib/

without python-cxx-dev installed

                 pycxx: yes [Couldn't import.  Using local copy.]
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/src/_png.o build/temp.linux-x86_64-2.7/src/mplutils.o build/temp.linux-x86_64-2.7/CXX/IndirectPythonInterface.o build/temp.linux-x86_64-2.7/CXX/cxx_extensions.o build/temp.linux-x86_64-2.7/CXX/cxxsupport.o build/temp.linux-x86_64-2.7/CXX/cxxextensions.o -L/usr/local/lib -lpng12 -lstdc++ -lm -o build/lib.linux-x86_64-2.7/matplotlib/

note the much longer list of libraries and in the second case, especially -lpng12 is missing if python-cxx-dev is installed which prevents startup of matplotlib with

undefined symbol: png_create_read_struct

matplotlib also seems to be looking for a PyCXX.pc file which is not provided by upstream (and thus not by the package)

Package PyCXX was not found in the pkg-config search path.
Perhaps you should add the directory containing `PyCXX.pc'
to the PKG_CONFIG_PATH environment variable
No package 'PyCXX' found
@mdboom mdboom Fixes #1884 -- Don't require a PyCXX.pc file (since it doesn't exist …
…upstream and in many packages). Don't overwrite existing libraries on an extension if pkg-config fails for one component. Don't spew pkg-config error messages to the console.
mdboom commented Apr 8, 2013

@juliantaylor , @fperez : Can you confirm this patch fixes the original issue. I was able to reproduce on Fedora by moving the PyCXX.pc file, but haven't had yet tested on Debian or Ubuntu.


it fixes the issue for me on ubuntu 13.04

@mdboom mdboom merged commit 386b4e5 into matplotlib:master Apr 25, 2013

1 check failed

Details default The Travis build could not complete due to an error
@mdboom mdboom deleted the mdboom:pycxx-system-library branch Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment