spack: extra_rpaths in compilers.yaml not working
In #4256, I added a package for OpenBabel. After installation, I ran ldd -r on the libraries and found that they were linking to the wrong libstdc++ library:
$ ldd -r libopenbabel.so
libopenbabel.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by libopenbabel.so)
...
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b47e587d000)
By adding the GCC compiler to my LD_LIBRARY_PATH, I was able to resolve this problem. I tried making the following change in compilers.yaml to do this automatically:
- compiler:
environment: {}
extra_rpaths:
- /soft/spack/opt/spack/linux-x86_64/gcc-5.3.0/gcc-6.1.0-q2zosj3igepi3pjnqt74bwazmptr5gpj/lib64
flags: {}
modules: []
operating_system: centos6
paths:
cc: /soft/spack/opt/spack/linux-x86_64/gcc-5.3.0/gcc-6.1.0-q2zosj3igepi3pjnqt74bwazmptr5gpj/bin/gcc
cxx: /soft/spack/opt/spack/linux-x86_64/gcc-5.3.0/gcc-6.1.0-q2zosj3igepi3pjnqt74bwazmptr5gpj/bin/g++
f77: /soft/spack/opt/spack/linux-x86_64/gcc-5.3.0/gcc-6.1.0-q2zosj3igepi3pjnqt74bwazmptr5gpj/bin/gfortran
fc: /soft/spack/opt/spack/linux-x86_64/gcc-5.3.0/gcc-6.1.0-q2zosj3igepi3pjnqt74bwazmptr5gpj/bin/gfortran
spec: gcc@6.1.0
target: x86_64
but it appears that extra_rpaths isn’t working. I reinstalled Open Babel but it still links to the system libstdc++ instead of the one in $GCC_ROOT/lib64. Adding it manually to LD_LIBRARY_PATH works:
$ ldd -r /blues/gpfs/home/ajstewart/spack/opt/spack/linux-centos6-x86_64/gcc-6.1.0/openbabel-2.4.1-xqe2leslpleij3g7u4dpje7joxcdydjh/lib/libopenbabel.so
...
libstdc++.so.6 => /soft/spack/opt/spack/linux-x86_64/gcc-5.3.0/gcc-6.1.0-q2zosj3igepi3pjnqt74bwazmptr5gpj/lib64/libstdc++.so.6 (0x00002b4b18855000)
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 19 (18 by maintainers)
Commits related to this issue
- [intel compiler] Fix link time error with `LLVMgold.so` The Intel compiler will, at link time, call `ld -plugin LLVMgold.so`, which expects libraries like `libimfo.so` to be found either in the `LD_L... — committed to stephenmsachs/spack by deleted user 5 years ago
- intel compiler: fix link time error with `LLVMgold.so` (#28731) The Intel compiler will, at link time, call `ld -plugin LLVMgold.so`, which expects libraries like `libimfo.so` to be found either in ... — committed to spack/spack by stephenmsachs 5 years ago
- intel compiler: fix link time error with `LLVMgold.so` (#28731) The Intel compiler will, at link time, call `ld -plugin LLVMgold.so`, which expects libraries like `libimfo.so` to be found either in ... — committed to EthanS94/spack by stephenmsachs 5 years ago
Oh it’s definitely using the compiler wrappers. I added debug messages to the compiler wrappers and it’s showing up.
@scheibelp Added your suggestion but it didn’t help:
I’ll try
-DCMAKE_INSTALL_RPATHnow.Update: It looks like
extra_rpathsis actually working, at least for Autotools-based packages. I came up with an interesting way to test it:Take any 2 packages where one depends on the other (I used
bzip2andzipbecause they build quickly). If I buildzipand runldd -ron the executable, I can see that it links to Spack-builtbzip2properly. Now, uninstallzip, comment out thedepends_on('bzip2'), and reinstallzip. As long as you havebzip2-develinstalled on the system,zipwill link to the system installation. Now, add the directory containing thebzip2libraries toextra_rpathsincompilers.yaml. When you rebuild, you’ll find that it now links to the Spack-buildbzip2even though it’s not an explicit dependency.I’m going to test things out with a simple CMake-based package to confirm my suspicion that this is limited to CMake-based packages. We may just need to add
extra_rpathsto-DCMAKE_INSTALL_RPATHto solve the original problem I was having.