-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Setting LD_LIBRARY_PATH to be "helpful" considered harmful #3955
Comments
I agree that the real problem here is with the missing
What's incorrect about that comment? As long as the dependency is stated, Spack will use RPATHs, making
Yes, it's referring to things like
Unfortunately, Python doesn't really have any way of RPATHing dependencies. I don't know the full details, but @wscullin or @citibeth can explain more if you're interested.
So there's two ways to think about this. You're thinking about it from the point of view of someone using the packages you installed. Yes, some packages don't work unless you have But, if you want it to be opt-in, you can do that. All you have to do is create a modules:
lmod:
all:
filter:
environment_blacklist: 'LD_LIBRARY_PATH'
bowtie2:
environment:
LD_LIBRARY_PATH: '$prefix/lib' I haven't tested this, but it should work. See Modules and especially Module Configuration Tutorial for details. |
[edited, jumping back to the top of my string of replies to @adamjstewart to make sure I'm not coming across a ranting maniac] @adamjstewart made a bunch of points in the comment above and I've responded to them one by one. I really don't see the value in this (even in automagically helping a set of programmers) and it does bother me. I know it's not going to be the downfall of the known universe or Spack or .... Hopefully the points (arguments?) that follow won't overshadow how valuable all of this is. [end of edit]
I think that will fix bowtie2's problem with the older gcc's. I think that there is [perhaps also] a different issue with gcc@6.x.y. |
So you're suggesting that every time someone adds a new library to spack that "someone" needs to audit every package in the tree that might use it and update them? If it were necessary to set An alternative would be to provide some documentation about using Spack libraries in non-Spack projects. |
Two things:
|
Spack breaks system utilities. At first I thought that this was a I understand that Python apps are a separate case (I wonder if the other dynamic languages are too, we just haven't noticed yet?), but....
Why subject a community to this unless we have to? |
Two things (avoiding the joke above):
|
Yes, I can do that (mentioned playing with it in #3926). The problem is that it puts the burden of figuring out which modules really need If I blacklist Package authors/updaters, on the other hand, know ahead of time. |
Let me add a few words to your description: Users on a cluster may be unaware of how you built the software that is available through module files, and I don't think telling them to add several lines of directories with strange hashes to manually set the RPATH will help.
I think this will be what the environment project will try to achieve: set a development environment managed by Spack. And that means also that Spack will take care of setting RPATHs for you. |
I see the point here. If I remember well there was a similar discussion sometimes ago (in a PR that was meant to introduce My personal point of view is that the current state in Spack is a trade off between usability and theoretical correctness, and we should rely on whatever
There should be no need if you use a Spack built application. If you use a Spack built library things must be put in perspective: you don't need to set search paths for transitive dependencies (they are RPATHed). So maybe "so there is no need to manipulate LD_LIBRARY_PATH at runtime for the software that was built by Spack" sounds better? |
PYTHONPATH is evil for the same reason LD_LIBRARY_PATH is evil. I did think up a proposal on how to get RPATH-like functionality in Python --- basically edit every .py file when it's being installed, to set sys.path correctly for imports. Or someting like that. It should work in theory, but someone would have to do it and find all the corner cases. In the meantime, PYTHONPATH isn't quite as evil as LD_LIBRARY_PATH because Python linking is less evil. If you run with py-numpy@1.1.2 instead of py-numpy@1.1.1, probably nothing bad will happen. But if you dynamically link to the wrong version of a shared lib, the program will probably crash.
Yes that's the end result, see #719 for background. This is probably fixable, but someone would have to look more closely at Python's setuptools and distutils, and figure out how to do it right. In the meantime, Python extensions need LD_LIBRARY_PATH to run properly.
Everyone should build their applications in Spack. Yes, I'm mostly serious. Some more work on Spack Environments, and we might be closer to that Nirvana. |
FWIW, I actually relate to what @hartzell's referring to here, and I wouldn't be completely opposed to removing I think the answer here is to put in more checks to ensure that we're actually RPATH-ing all the dependencies in Spack builds, as that will at least ensure that Spack-built binaries work. |
@tgamblin --
When you say "module systems", do you mean creatures like Lmod? I can see where the environments which e.g. Lmod or Tcl-modules are trying to set up aren't built with RPATH-ing and depend on Would a more nit-picky wording of your statement be: "most HPC computing enviroments rely on it" or some such (putting the blame on how the apps were built, not on the tool being used to provision the user's environment for them)?
If a) always setting Most of my users are not building their own software (be careful what you wish for, I've been told, you might get it...), which might be why I seem to be landing in the minority. |
I cannot replicate your yum issue:
I do not think glibc should be added to spack unless there's extensive testing and it's proven to not break things. If users need a newer version of glibc then I think the better solution would be to build a separate spack environment against the newer operating system which has that newer version of glibc. For example I have separate spack environments for centos 6 and centos 7 servers. To allow users to switch between the separate operating system environments I tell them to put this in their bashrc:
Moreover, if you need a very new version of glibc, one could try out something like containers as we've been using Singularity http://singularity.lbl.gov then use spack within that. We haven't tested yet but I think it would work. |
I suspect that's because yum uses the system Python, which is Python2.
The Python you tested with is @3.5.2, and presumably whatever thing that's tripping yum up is sufficiently different. I can replicate it fairly easily:
Can you try it with a g. |
I'm starting to regret using the example of The issue of being surprised by dynamically linking things that you didn't expect is real in other cases, if less catastrophic. |
Thanks for the discussion! I think that I understand the pros and cons. |
Discussion is fun! Anyway, you closed but still cannot replicate on RHEL 6.3 node.
|
Hmmm. I wonder if the difference is my Do you end up with I do, and if I surgically delete just that directory from the |
I do Old Centos 6.3 node:
So it seems that the Spack-provided Python indeed will break yum. I don't understand though why mine's while your's isn't. Though I do now have the same problem on Centos 7.3 box.
|
It could be that one was RPATHed and one wasn't. But I'm just speculating. |
If I run
I've trimmed the above, but trust me that it never looks for it in any of the system directories. If I
Without LD_LIBRARY_PATH to distract it, it looks in the system dirs and finds what it needs. Why would setting LD_LIBRARY_PATH (used to search for shared libraries) influence Python's search for a python package? |
On Centos 7.3 the rpm yum-3.4.3-150.el7.centos.noarch contains files within:
So it seems to be an issue with the fact that yum's python things are not installed within Spack's Python environment. I don't consider this to be a problem as our users are not using yum though it would be nice if we could fix somehow since I source Spack via ~/.bashrc. Though I always do "sudo yum" so not, actually... |
Nice digging. I'm content to close this (again). There's enough documentation here if any ever trips over it and it's not a day-to-day problem (yet). |
Here's another cute one (CentOS 7), where Spack's libtiff is screwing up the system's
I think that I'll take a test drive of @adamjstewart's blacklisting suggestion and see what breaks. |
I stumbled over this, because LD_LIBRARY_PATH breaks nearly anything using ncurses on my Debian-10 machine: $ /usr/bin/clear_console
/usr/bin/clear_console: /opt/spack/install-tree/debian10/gcc-9.3.0/ncurses-6.2-zqozh/lib/libtinfo.so.6: no version information available (required by /usr/bin/clear_console) So I would like to blacklist LD_LIBRARY_PATH for And on the other side, modules.yaml / prefix_inspections doesn't seem to be honored. |
I'm seeing exactly the same issue, on Debian stable (10) and testing/bullseye (11), I'm getting:
which seems to come from
So |
If #17457 (comment) would get implemented, you could override the Until then I see two workarounds:
I might look into implementing #17457 (comment) sometime. |
Another question that lately came up concerning this topic: Let's assume one disables How does the
|
Since #18689 was closed as a duplicate, let me add the tl;dr here: In the last two weeks two people reported issues on Slack where In particular: Another instance is where my terminal/shell became completely unusable after I would suggest to not modify |
Just to add another point to this, many Python packages don't support RPATH, and won't work unless |
Does Python maybe have a dedicated env variable for search paths it dlopens? If not, how about adding a prop |
Not that I know of, just |
Personally I would prefer that LD_LIBRARY_PATH always be prepended with useful shared libs, when available. Yes, it can cause trouble if you're trying to mix spack and non-spack packages. But, if you do that, you're already living in sin--don't do it. A middle ground would be to add a flag to 'spack load' that would optionally also export libs this way. So, they could be exported when needed, but not by default. If nothing else, it would be handy to (optionally?) set a package-specific env var so that the lib location in question could be easily derived, rather than having to determine it by magical means. |
|
Unfortunately, Any workarounds would be appreciated! |
1. I generally use spack environments not spack load. Either with views or
modules.
2. In assembling the environment I generally address issues like this as
the come up. In this case I would save LD-Library-Path then source all the
module loads, then restore ld library path. That would all happen in the
final environment loading script I produce.
3. In general I would use the spack command to build and assemble
environments but not to load them.
On Thu, Dec 23, 2021 at 23:56 Ben Wibking ***@***.***> wrote:
Unfortunatley, spack load cmake, spack load openmpi and spack load rsync
all break git on CentOS / Rocky 8 :(
Any workarounds would be appreciated!
—
Reply to this email directly, view it on GitHub
<#3955 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOVY52NKYOZO4GUGQXBV6LUSP4QZANCNFSM4DIUO3HQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Elizabeth Ashley Fischer, she/her
University of Alaska, Geophysical Institute
cell: 617-308-0436
UA is an AA/EO employer and educational institution and prohibits illegal
discrimination against any individual: www.alaska.edu/nondiscrimination. UAF
is located at Troth Yeddha', on the traditional homelands of the Lower
Tanana Dené People and UAF therefore benefits from the long stewardship of
these lands.
|
@BenWibking Can you try using the following modules:
prefix_inspections:: # notice the double colon
bin:
- PATH
man:
- MANPATH
share/man:
- MANPATH
share/aclocal:
- ACLOCAL_PATH
lib/pkgconfig:
- PKG_CONFIG_PATH
lib64/pkgconfig:
- PKG_CONFIG_PATH
share/pkgconfig:
- PKG_CONFIG_PATH
'':
- CMAKE_PREFIX_PATH This will override the default settings and prevent Spack from setting |
It works, thanks! |
I believed this cause I am not a Python user, but I think it's not true. Python packages typically open a wrapper library which has rpaths, right? So, I doubt they rely on LD_LIBRARY_PATH much? I still believe we should disable LD_LIBRARY_PATH by default. @giordano reports a system where |
(with apologies to Djikstra and everyone else who's recycled that title meme)
TL;DR: the library that one of my spack binaries uses depends on what other spack packages I've
module load
-ed. YIKES. See also #3926.I was trying to understand why @JusticeForMikeBrown was having trouble building bowtie2 (see #3950) when I've built it successfully with
gcc@4.x.y
.His problem with
gcc@4.x.y
was zlib related; I checked the package and noticed that it doesn't have a dependency on zlib. Perhaps it should, I thought. Wonder what zlib my "production" copy was linked against?That surprised me, because there's no zlib dependency in the package.
Sure enough, it's because I have something else
module load
-ed that has the side effect of adding zlib's directory toLD_LIBRARY_PATH
.My "newer" version of CentOS has a
/lib64/libz.so.1
that includes gzbuffer (nm
didn't help, library's stripped...):so it (probably) works for me either way.
But imagine if there were two versions of a library (perhaps something mathematical) that give different results. Now you have a program giving different results depending on what other Spack applications are also loaded.
THAT would be fun to track down (assuming you even noticed...).
W.R.T. the main problem, bowtie2 should probably have a dependency on a new-ish version of zlib, but stuff like this is why LD_LIBRARY_PATH is a slippery tool to reach for.
I'll argue that this kind of unpredictability is a bigger negative than being helpful and always setting
LD_LIBRARY_PATH
. This comment in the docs isn't actually correct:What would happen if
LD_LIBRARY_PATH
became opt-in, packages that need it specify it in their package definitions?Looking at the list of cases where RPATH support doesn't work, it seems like 1) is not relevant (I think it's referring to
PERL5LIB
, etc...) and 3) are simply bugs. That leaves 2), python extensions. IsRPATH
unworkable there or just not yet working?The text was updated successfully, but these errors were encountered: