-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Use of RPATH for implicit link directories problematic for build systems that use LD_LIBRARY_PATH=<build dir> ./executable #40848
Description
Steps to reproduce this issue:
- Use a compiler that has its runtime libraries in a directory that also contains
lib<example>.so - Install the package
spack install <example> - The build system invokes its just-built executable:
LD_LIBRARY_PATH=<build dir> ./example ...
The latter fails because the example executable contains an RPATH pointing to the implicit link directory of the compiler, which happens to contain libexample.so -- this library is picked up instead of the just-built libexample.so in LD_LIBRARY_PATH.
Notice that Spack itself adds the rpath, the system compiler would only inject the -L flag.
The pattern LD_LIBRARY_PATH=. ./example is probably most common in autotools packages. CMake packages are not affected as they use build rpaths to work around this problem.
Below is an example where this happens with perl.
Original issue
Steps to reproduce the issue
[csbcfmpd@login209-18 spack-src]$ spack spec -I perl
Input spec
--------------------------------
- perl
Concretized
--------------------------------
- [email protected]%[email protected]+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected]+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected]~guile build_system=generic arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected]~debug~pic+shared build_system=generic arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected] build_system=autotools arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected] build_system=autotools libs=shared,static arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected] build_system=autotools arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected] build_system=autotools patches=bbf97f1 arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected]~symlinks+termlib abi=none build_system=autotools arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected] build_system=autotools arch=linux-rocky8-icelake
[+] ^[email protected]%[email protected]+compat+opt build_system=autotools arch=linux-rocky8-icelakeError message
loadable library and perl binaries are mismatched
[csbcfmpd@login209-18 spack-src]$ spack install -j 40 perl [+] /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack_packages/linux-rocky8-icelake/gcc-10.1.0/berkeley-db-18.1.40-i3j6vwjja62njh2mi6dgg5mqel3m6ani [+] /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack_packages/linux-rocky8-icelake/gcc-10.1.0/bzip2-1.0.8-oo6spantejf27dmb7bzwccfttwtfx7bb [+] /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack_packages/linux-rocky8-icelake/gcc-10.1.0/ncurses-6.4-2kenxblld7jmiylsjweggbentnz3yrbm [+] /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack_packages/linux-rocky8-icelake/gcc-10.1.0/zlib-ng-2.1.4-575jc3ailnn2g7unxmoivbsov7vls7sw [+] /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack_packages/linux-rocky8-icelake/gcc-10.1.0/readline-8.2-cpx6vq4aolpyqj7tguzpiha4hpuexnr5 [+] /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack_packages/linux-rocky8-icelake/gcc-10.1.0/gdbm-1.23-ei62qyttjgwe6qlz3sgbipffqt6b7ome ==> Installing perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6 [7/7] ==> No binary for perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6 found: installing from source ==> Using cached archive: /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack/var/spack/cache/_source-cache/archive/21/213ef58089d2f2c972ea353517dc60ec3656f050dcc027666e118b508423e517.tar.gz ==> Using cached archive: /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack/var/spack/cache/_source-cache/archive/9d/9da50e155df72bce55cb69f51f1dbb4b62d23740fb99f6178bb27f22ebdf8a46.tar.gz ==> Moving resource stage source: /tmp/csbcfmpd/spack-stage/resource-cpanm-2tubazheh7m4pdei3eugarkkduubhga6/spack-src/ destination: /tmp/csbcfmpd/spack-stage/spack-stage-perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6/spack-src/cpanm/cpanm ==> Applied patch /mnt/lustre/scratch/nlsas/home/csic/bcf/mpd/Simulation/spack_SeisSol/spack/var/spack/repos/builtin/packages/perl/zlib-ng.patch ==> Ran patch() for perl ==> perl: Executing phase: 'configure' ==> perl: Executing phase: 'build' ==> Error: ProcessError: Command exited with status 2: 'make' '-j40'1 error found in build log:
2831
2832
2833 chmod 755 ../../lib/auto/Unicode/Normalize/Normalize.so
2834 make[1]: Leaving directory '/tmp/csbcfmpd/spack-stage/spack-stage-perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6/spack-src/dist/Unicode-Normalize'
2835 LD_LIBRARY_PATH=/tmp/csbcfmpd/spack-stage/spack-stage-perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6/spack-src ./perl -Ilib -I. -f pod/buildtoc -q
2836 Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0xf380080, needed 0xcd00080)
2837 make: *** [makefile:426: pod/perltoc.pod] Error 1
See build log for details:
/tmp/csbcfmpd/spack-stage/spack-stage-perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6/spack-build-out.txt
Information on your system
- Spack: 0.21.0.dev0 (80944d2)
- Python: 3.7.8
- Platform: linux-rocky8-icelake
- Concretizer: clingo
Additional information
spack-build-env.txt
spack-build-out.txt
The problem is that the perl version compiled in spack-src is not the 5.38.0 but the 5.30.3
[csbcfmpd@login209-18 ~]$ cd /tmp/csbcfmpd/spack-stage/spack-stage-perl-5.38.0-2tubazheh7m4pdei3eugarkkduubhga6/spack-src
[csbcfmpd@login209-18 spack-src]$ ./perl --version
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_MEASUREMENT = "de_DE.UTF-8",
LC_PAPER = "de_DE.UTF-8",
LC_MONETARY = "de_DE.UTF-8",
LC_NAME = "de_DE.UTF-8",
LC_ADDRESS = "de_DE.UTF-8",
LC_NUMERIC = "de_DE.UTF-8",
LC_TELEPHONE = "de_DE.UTF-8",
LC_IDENTIFICATION = "de_DE.UTF-8",
LC_TIME = "de_DE.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
This is perl 5, version 30, subversion 3 (v5.30.3) built for x86_64-linux-thread-multi
(with 30 registered patches, see perl -V for more detail)
Copyright 1987-2020, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
maintainer: @LydDeb
The issue is related with:
#26738
A direct workaround is to install [email protected]
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have run
spack maintainers <name-of-the-package>and @mentioned any maintainers - I have uploaded the build log and environment files
- I have searched the issues of this repo and believe this is not a duplicate
Metadata
Metadata
Assignees
Labels
Type
Projects
Status