-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use LD_LIBRARY_PATH #61
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
On CentOS, the init scripts
etc/login
andetc/profile
set LD_LIBRARY_PATH, so that various binaries (and libraries) can find their dependencies. This is a problem, because Starlink includes several libraries that can already be present as system libraries, eg libtcl8.5.so. The use of LD_LIBRARY_PATH means that the Starlink versions are found before the system versions, which can break non-Starlink applications.For example, after setting up Starlink 2017,
/usr/bin/modulecmd
no longer works on my RHEL7 system due to finding the Starlink libtcl rather than the system version.This isn't a new issue, eg
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=STARLINK;d68387aa.1303
and you have a note about it on
http://starlink.eao.hawaii.edu/starlink/2017ADownload
Your issue #1 is about fixing this for OS X. I think it would be great to also fix it for Linux.
I see that you set RPATH for Starlink binaries so that builds using the standard
/star-2017A
installation location (aside: maybe something like/opt/starlink
would be better these days?) don't need to rely on LD_LIBRARY_PATH. Eg:readelf -d bin/xmake | grep RPATH
->/star-2017A/lib
RPATH can also contain relative paths, which means that this can be fixed for all installations, whether or not they use the
/star-2017A
prefix. The syntax for bin/xmake would beRPATH=$ORIGIN/../lib
.This approach is already used by the third-party java/ directory. Eg
readelf -d java/bin/java | grep RPATH
->$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli
The
patchelf
utility (https://nixos.org/patchelf.html) can be used to correct RPATH after the fact.So if it's too difficult to generate correct RPATHs during the build, a script can be used to fix them up after the fact, like
macos_postbuild_library_fixup.sh
does for OS X. Then there would be no need to set LD_LIBRARY_PATH.Thanks for looking after Starlink!
The text was updated successfully, but these errors were encountered: