On Mon, May 6, 2013 at 6:27 PM, Michael Droettboom <md...@stsci.edu> wrote: > Well, we could try a different approach. matplotlib will use pkg-config to > find its dependencies, if available. > > If you can get your local libpng to include a libpng.pc (i.e. a pkg-config > information file) and then add your local pkg-config path (probably > /auto/nest/nest/u/ondrej/repos/python-hpcmp2/opt/profile/eoul/lib/pkgconfig) > to the PKG_CONFIG_PATH environment variable, it should pick up the right > name for the library as well.
It works!! Thanks a lot. Here I found the same answer as well: http://stackoverflow.com/questions/16227285/unable-to-import-matplotlib-png-pylab > If you get that working, you may be able to > avoid setting CFLAGS and LDFLAGS explicitly and the Makefile modifications. Indeed. I definitely don't need Python Makefile modifications and here is my polished install script now: export PKG_CONFIG_PATH="$PNG/lib/pkgconfig:$FREETYPE/lib/pkgconfig" export LDFLAGS="-L$PNG/lib -Wl,-rpath=$PNG/lib" $PYTHON/bin/python setup.py install As you can see, I still need to setup the rpath, but that is to be expected. For the record, here is how _png.o and _png.so end up compiled and linked: gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -I/home/ondrej/repos/python-hpcmp2/opt/png/qhle/include -I/home/ondrej/repos/python-hpcmp2/opt/freetype/lfqj/include -I/home/ondrej/repos/python-hpcmp2/opt/freetype/lfqj/include/freetype2 -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include -I/home/ondrej/repos/python-hpcmp2/opt/png/qhle/include/libpng16 -I/usr/local/include -I/usr/include -I. -I/home/ondrej/repos/python-hpcmp2/opt/numpy/hpbc/lib/python2.7/site-packages/numpy/core/include -I. -I/home/ondrej/repos/python-hpcmp2/opt/python/llzf/include/python2.7 -c src/_png.cpp -o build/temp.linux-x86_64-2.7/src/_png.o g++ -pthread -shared -L/usr/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/home/ondrej/repos/python-hpcmp2/opt/freetype/lfqj/lib -L/home/ondrej/repos/python-hpcmp2/opt/png/qhle/lib -Wl,-rpath=/home/ondrej/repos/python-hpcmp2/opt/png/qhle/lib -I/home/ondrej/repos/python-hpcmp2/opt/png/qhle/include -I/home/ondrej/repos/python-hpcmp2/opt/freetype/lfqj/include -I/home/ondrej/repos/python-hpcmp2/opt/freetype/lfqj/include/freetype2 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/cxx_extensions.o build/temp.linux-x86_64-2.7/CXX/IndirectPythonInterface.o build/temp.linux-x86_64-2.7/CXX/cxxsupport.o build/temp.linux-x86_64-2.7/CXX/cxxextensions.o -L/home/ondrej/repos/python-hpcmp2/opt/png/qhle/lib -L/usr/local/lib -L/usr/lib -lpng16 -lz -lstdc++ -lm -o build/lib.linux-x86_64-2.7/matplotlib/_png.so I think that this looks good. If I need to ever remove the -L/usr/lib/x86_64-linux-gnu parts, then I just fix the Python package. Ondrej ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users