ghci temporary shared objects don't include -L paths in rpath
I am observing T10458
fail on some Linux platforms (specifically Alpine) with:
$ cd testsuite/tests/ghci/linking/dyn
$ make compile_libT10458
$ $TEST_HC --interactive -L$(pwd)/T10458dir -lAS -v3 < T10458.script
...
*** Linker:
cc '-Wl,--hash-size=31' -Wl,--reduce-memory-overheads -Wl,--no-as-needed -o /tmp/ghc28544_0/libghc_1.so T10458.o -shared -Wl,-Bsymbolic -Wl,-h,libghc_1.so -lAS -L/home/ghc/ghc/testsuite/tests/ghci/linking/dyn/T10458dir -L/home/ghc/ghc/_build/stage1/lib/../lib/x86_64-linux-ghc-8.11.0.20200222 -Xlinker -rpath -Xlinker /home/ghc/ghc/_build/stage1/lib/../lib/x86_64-linux-ghc-8.11.0.20200222 -lHSbase-4.14.0.0-ghc8.11.0.20200222 -lHSinteger-gmp-1.0.2.0-ghc8.11.0.20200222 -lHSghc-prim-0.6.1-ghc8.11.0.20200222 -lgmp
!!! systool:linker: finished in 3.07 milliseconds, allocated 0.798 megabytes
ghc: panic! (the 'impossible' happened)
(GHC version 8.11.0.20200222:
Loading temp shared object failed: Error loading shared library libAS.so: No such file or directory (needed by /tmp/ghc28544_0/libghc_1.so)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
I believe the issue here is that the ghci temporary opject (e.g. libghc_1.so
) does not include the T10458dir
(where libAS.so
resides) in its RPATH. Consequently the dynamic linker cannot find it.