matplotlib/matplotlib — pull request #1884 by mdboom (2013-04-08 16:18:30+00:00)
Title: incorrect linkage if system PyCXX is found

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/_png.so
```

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/_png.so
```

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
```