Don't set LD_LIBRARY_PATH on package load#28354
Conversation
9bb89ca to
7ebdff6
Compare
adamjstewart
left a comment
There was a problem hiding this comment.
This PR will break most Python/SCons packages with external dependencies. Python does not properly support RPATHs.
| - LD_LIBRARY_PATH | ||
| lib64: | ||
| - LD_LIBRARY_PATH | ||
| modules: {} |
There was a problem hiding this comment.
If these files are no longer being used they can just be removed
There was a problem hiding this comment.
That made the tests fail :( didn't check why, but then I thought it wouldn't hurt as a blueprint
|
Can't PythonPackage set LD_LIBRARY_PATH for link type deps that are meant to be dlopen'ed? Just like PYTHONPATH |
|
It can, although that will make it even harder to get rid of |
7ebdff6 to
8453847
Compare
| lib: | ||
| - DYLD_FALLBACK_LIBRARY_PATH | ||
| lib64: | ||
| - DYLD_FALLBACK_LIBRARY_PATH |
There was a problem hiding this comment.
I understand your concern with LD_LIBRARY_PATH, but this issue does not arise with DYLD_FALLBACK_LIBRARY_PATH. On macOS, there are two env vars that control library selection at load-time: DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH. The former acts just like LD_LIBRARY_PATH and can break system exes that aren't RPATHed. The latter acts more like RUNPATH and provides libraries to use only when the libraries aren't found in normal search locations. So I think it's safe to keep these here.
There was a problem hiding this comment.
Yeah, reverted that, it's just about linux now.
Is this really true @adamjstewart? Don't python packages usually call C functions through a generated wrapper library that does have rpaths already? For instance when running so it manages to load libraries without LD_LIBRARY_PATH just fine. And can you explain what you mean with SCons given that LD_LIBRARY_PATH is runtime. |
8453847 to
ed38dad
Compare
|
When I load an environment and E.g.: |
Most Python libraries use
If we do push through with this PR, we'll have to do this if we don't want to break hundreds of packages. |
|
I know I've been the main person opposing this for years, but I'm starting to warm up to this idea. I think the packages that require LD_LIBRARY_PATH are few enough that we can special case them. Now might be a good time to merge this and see what breaks since we just had a release. |
|
So, should we merge it? |
|
I'm fine with that but would like to get the opinions of a couple more core devs first. |
39054ff to
12c0a30
Compare
|
I am strongly in favor of this change -- the question is what to do for people who relied on this stuff. Basically I think Spack should work and loading an environment should not affect your compiler or
The last two AFAIK don't work on all compilers anyway, so it's at best inconsistent to set them. @haampie: could you modify this, though, so that we set these?
to the prior values of That way someone who loads an env will have something they can use to set the variables they need, but we won't be borking the user environment by default. |
|
I added this here since it's a fairly impactful change: #30634 |
|
Note that So this PR is really about
Do you mean to store Also, can we run a pipeline from scratch using this PR? It affects the builds too (note that |
Yes. They could do this, but IMO it's a little clunky, and having the env vars allows you do do more -- e.g., you may want to pass the list of transitive library search directories to CMake or use it on your link line or something. I'm basically saying that we should have a convention for that and throw it in a harmless env var (as opposed to a harmful one like now). Users will be familiar with this from module schemes like OpenHPC, where they have a similar policy. I think it's a good default. |
|
I personally agree with @haampie, if people want to set additional env vars in module files, Spack already has a way to do that, we don't need to set |
Ok fair enough -- I'll relent. They can add those settings via |
|
Worth documenting in the release notes too since it's a backwards incompatible change. |
LD_LIBRARY_PATH on package load
|
How about the case where you load a library by Spack and then link your objects with the library? Does it work after this change? |
This is my exact use-case (although with en environment) we distribute a spack env that people wanting to hack on our just have to load to start working. I recently noticed |
|
could a flag be provided to explicitly ask for |
|
The set of environment variables added by Spack is completely customizable. Although $ spack config add modules:prefix_inspections:lib64:[LD_LIBRARY_PATH]
$ spack config add modules:prefix_inspections:lib:[LD_LIBRARY_PATH]After this, Does that address your concerns? |
|
thank you for the pointer. Indeed, this should do the trick! |
Add option `PIC_ADD_RPATH` to controll if picongpu is setting the rpath. By default PIConGPU will now always use RPATH but optionally allow disabling this and falling back to the old behaviour. Using rpath's is motivated by the spack where `LD_LIBRARY_PATH` is not set anymore: spack/spack#28354
Add option `PIC_ADD_RPATH` to control if picongpu is setting the rpath. By default, PIConGPU will now always use RPATH but optionally allow disabling this and falling back to the old behavior. Using rpath's is motivated by the spack where `LD_LIBRARY_PATH` is not set anymore: spack/spack#28354
Add option `CUDA_MEMTEST__ADD_RPATH` to control if cuda_memtest is setting the rpath. The new default is that RPATH will be used but optionally allow disabling this and falling back to the old behaviori. Using rpath's is motivated by the spack where `LD_LIBRARY_PATH` is not set anymore: spack/spack#28354
Add option `PIC_ADD_RPATH` to control if picongpu is setting the rpath. By default, PIConGPU will now always use RPATH but optionally allow disabling this and falling back to the old behavior. Using rpath's is motivated by the spack where `LD_LIBRARY_PATH` is not set anymore: spack/spack#28354
|
Today I discovered while I was doing a fresh build, I discovered generated TCL modules do not export anymore Spack has been an extremely useful tool to install packages, self-build modules, expose to users these modules that can be used by users using Please documents very visibly the workaaround because a lot of your users and sysadmins will likely need it. |
|
Feel free to make a PR |
* As discussed at <spack/spack#28354>, spack no longer sets `LD_LIBRARY_PATH`, which makes it harder to run applications compiled by a spack-installed Clacc. This patch adds the spack config workaround suggested there. * Spack's Clacc recipe hasn't been updated since libcxx and libunwind are considered runtimes not projects in LLVM. This patch disables their builds where that causes a failure. * This patch removes the hwloc.h instructions for spack installs on leconte as they no longer appear to be necessary. * This patch updates various ExCL software packages.
For me this has been mostly just annoying, cause if I do
spack env activate ...and it sets LD_LIBRARY_PATH, system executables that don'tuse rpath will now consider spack-built libs first, and are sometimes
incompatible.
And executables built by Spack already use rpath anyways, so they know
where there libs are.
The only case is maybe when libs are dlopen'ed by say Python, but even
then, I think the libs are generally located because of Python's own
rpaths set by Spack.
Closes #3955 #31731