In building py-matplotlib, I ended up with problems loading the wrong libpng:
>>> plt.savefig('x.png')
libpng warning: Application built with libpng-1.6.16 but running with 1.5.13
RuntimeError: Could not create write struct
I traced this to a bad RPATH in the file _png.cpython-35m-x86_64-linux-gnu.so (inside the py-matplotlib installed package; output edited for brevity):
$ readelf -a _png.cpython-35m-x86_64-linux-gnu.so
0x000000000000000f (RPATH) Library rpath:[
$SPACK_TOOLS/linux-x86_64/gcc-4.8.5/gcc-4.9.3-jfebnuuusdch34j7pvdnvlxffe2rmoe4/lib
$SPACK_TOOLS/linux-x86_64/gcc-4.8.5/gcc-4.9.3-jfebnuuusdch34j7pvdnvlxffe2rmoe4/lib64
$SPACK/gcc-4.9.3/py-matplotlib-1.5.1-4uxkczjbamxtqchwnivrsfentpu5vqgt/lib
$SPACK/gcc-4.9.3/py-matplotlib-1.5.1-4uxkczjbamxtqchwnivrsfentpu5vqgt/lib64
$SPACK/gcc-4.9.3/tcl-8.6.5-drl57libz63n6dm6ah5xj563u7jmsuqb/lib
$SPACK/gcc-4.9.3/tk-8.6.5-zq6kjgarngiy2okzmfieyif3nefdvrhh/lib
$SPACK/gcc-4.9.3/qhull-2015.2-oxkemfqsnqq2qgqahnyfg6ngfsrwibaa/lib
$SPACK/gcc-4.9.3/py-pytz-2016.6.1-ma6gqmduosyoaqaejv23lbw6murq45rj/lib
/usr/lib64
/usr/lib
$SPACK/gcc-4.9.3/libgpg-error-1.21-jg7ued4677sncbdnhk527hkqh7sa6gqn/lib
$SPACK/gcc-4.9.3/libgcrypt-1.6.2-hmbfbcsttub4payqzfw77ps7a4dbgscs/lib
$SPACK/gcc-4.9.3/libxslt-1.1.28-ittjfvhpoq3xarkyws4ekaunj6oajxia/lib
$SPACK/gcc-4.9.3/py-pyside-1.2.4-lasxxbv63atjjhsh7iyn3worlx45mwcv/lib
$SPACK/gcc-4.9.3/py-pyparsing-2.0.3-gkf7bekrvgulblfvdqkuumaceec6eu4n/lib
$SPACK/gcc-4.9.3/flex-2.6.0-hb2a3nzfjfbl2r4egxvuplt3f43g3kuf/lib
$SPACK/gcc-4.9.3/bison-3.0.4-7ozo6awyset7znlatixjy5jhokjo2b2u/lib
$SPACK/gcc-4.9.3/binutils-2.26-ju3hxygn4gjylizczswtnvp425xzapmi/lib
$SPACK/gcc-4.9.3/py-pillow-3.2.0-u45wmuhbc27sjrsh6cyf2wurr4xdfmhs/lib
$SPACK/gcc-4.9.3/openblas-0.2.18-xg74vv7tgezkd6usjx6f7wvfmprlzdlm/lib
$SPACK/gcc-4.9.3/py-numpy-1.11.0-vrd3twabjyl5yhypb6uxoc7vv6hl674c/lib
$SPACK/gcc-4.9.3/py-nose-1.3.7-bi7wghzcswpx4on7ok3lt4sg57vfdphh/lib
$SPACK/gcc-4.9.3/py-pbr-1.8.1-jjnoc654fwueamdqxxaqgkjttgnodoo4/lib
$SPACK/gcc-4.9.3/py-mock-1.3.0-emnztdynqko75vhhajeraqf36sebdprd/lib
$SPACK/gcc-4.9.3/py-pygments-2.1.3-wpyvlr2t4leysvezmhro6rj66bvn4kbg/lib
$SPACK/gcc-4.9.3/py-ipython-3.1.0-m2zbzkgtbshisssxpxl44rszrlz2ofe6/lib
$SPACK/gcc-4.9.3/py-dateutil-2.5.2-vrb7hpqpq5mzmufvot4d7v4z4bei72qf/lib
$SPACK/gcc-4.9.3/py-six-1.10.0-f7ys66qiqdjtvqjcsl54wqqjc5xt5uic/lib
$SPACK/gcc-4.9.3/sqlite-3.8.5-skqlsgbmxoeci5djr7q4fusj6hc3intv/lib
$SPACK/gcc-4.9.3/readline-6.3-3ekuy5cf3yu7iwvdy2fvxlud7r4xmqfu/lib
$SPACK/gcc-4.9.3/ncurses-6.0-zmq56k64i2ngmqcjlhvezoxsfhxnobxq/lib
$SPACK/gcc-4.9.3/bzip2-1.0.6-u5u7w2gs66mur2trobsjfndoibzec467/lib
$SPACK/gcc-4.9.3/python-3.5.2-yhji3g3j6qikhcwi5xxzenc2ny5ef3rq/lib
$SPACK/gcc-4.9.3/py-setuptools-25.2.0-dt5e6lgtruy5ruifaiqbn73dvh2ohdek/lib
$SPACK/gcc-4.9.3/py-cycler-0.10.0-em4aqu7ygqpq2byjlno54tkcnye5ieee/lib
$SPACK/gcc-4.9.3/libsigsegv-2.10-ij23gs7kl2pegosxp5nsuvopglpvxmrn/lib
$SPACK/gcc-4.9.3/libtool-2.4.6-lg5vttjkrwzk3e6d37dvkvz4oiewhaeg/lib
$SPACK/gcc-4.9.3/jpeg-9b-4u6utwukqy65lh52wbtcgxfehanuu4r7/lib
$SPACK/gcc-4.9.3/libtiff-4.0.3-e4jcqlucswjnudl3bj7b4xiiw3wppl2k/lib
$SPACK/gcc-4.9.3/xz-5.2.2-5o5am2wzqyksxh2qhsddxozx46gsy3uq/lib
$SPACK/gcc-4.9.3/libxml2-2.9.2-qwzxnngolodst2576boztkmt3lzmkxlj/lib
$SPACK/gcc-4.9.3/zlib-1.2.8-owhhpa3w344kmdgpovkmxbhce5jzhbjl/lib
$SPACK/gcc-4.9.3/libpng-1.6.16-ml67rwomuxbdv2irl7zbjgdh2ljhio5h/lib
$SPACK/gcc-4.9.3/freetype-2.5.3-7poivvhaylua6xeewfjx5e636awedmko/lib
$SPACK/gcc-4.9.3/fontconfig-2.11.1-nbjgviu3iflrxgzbdvuw5jifdl6umlzu/lib
$SPACK/gcc-4.9.3/ImageMagick-7.0.2-7-qo3emkeg5tzjzv3o44cci6vakd2i3fz3/lib]
Notice that /usr/lib and /usr/lib64 are included (!). This is causing Matplotlib to pick up the wrong libpng at runtime. I believe this is likely happening because of the following in my packages.yaml:
# Recommended for security reasons
# Do not install OpenSSL as non-root user.
openssl:
paths:
openssl@system: /usr
version: [system]
buildable: False
# Recommended, unless your system doesn't provide Qt4
qt:
paths:
qt@4.8.5: /usr
version: [4.8.5]
buildable: False
How should this best be fixed? I can think of two ways:
- The "right" way would be to add another option to
packages.yaml entry telling Spack to NOT include in the rpath. For example (I'm not sure how the syntax for this would work, or how Spack would be coded to use it)>
openssl:
paths:
openssl@system: /usr <no-rpath>
version: [system]
buildable: False
- The quick way would be to keep a list of "standard" system locations, and avoid putting any of them in RPATH.
Any thoughts, comments?
In building
py-matplotlib, I ended up with problems loading the wronglibpng:I traced this to a bad RPATH in the file
_png.cpython-35m-x86_64-linux-gnu.so(inside thepy-matplotlibinstalled package; output edited for brevity):Notice that
/usr/liband/usr/lib64are included (!). This is causing Matplotlib to pick up the wronglibpngat runtime. I believe this is likely happening because of the following in mypackages.yaml:How should this best be fixed? I can think of two ways:
packages.yamlentry telling Spack to NOT include in the rpath. For example (I'm not sure how the syntax for this would work, or how Spack would be coded to use it)>Any thoughts, comments?