Add a patch that enable to use libraries exposed via LIBRARY_PATH or#23042
Add a patch that enable to use libraries exposed via LIBRARY_PATH or#23042dagonzalezfo wants to merge 1 commit intoeasybuilders:developfrom
Conversation
relies on prefix provided ldconfig
|
I'll try to test this patch in a bit, but @ocaisa already remarked it's a "scary big hammer", since it changes a very fundamental standard python library. Previously, when we patched |
|
The good news is: the hammer does seem to solve my particular problem. Before, I got this issue: Now, PyTables builds succesfully, and I find this in the logs: Also, before, I got: Whereas now I get: As expected |
|
|
||
| try: | ||
| - proc = subprocess.Popen(('/sbin/ldconfig', '-r'), | ||
| + proc = subprocess.Popen((os.environ.get('EPREFIX') + '/sbin/ldconfig', '-r'), |
There was a problem hiding this comment.
I think this is another reason why we should resolve things at the EasyBlock level: there, we can query if EasyBuild was configured with a sysroot build option. If so, we get that value, instead of EPREFIX (which I believe is set by Gentoo-prefix, and thus specific to that OS?). That makes this more generic. It also excludes any possible name collisions (someone could set EPREFIX as an environment for a totally different purpose - unrelated to Gentoo-Prefix, but build_option('sysroot') can only mean one thing: someone wanted to set a sysroot).
|
@casparvl Can you try with/without the CUDA module loaded on a system with a GPU? I'm curious to see if it picks up the "correct" one |
|
@ocaisa correctly anticipated that this would be a problem: Now, it may or may not actually bite us in practice. If a One thing we could do - but this is even more invasive - is that we patch |
|
Lol, I was already doing that @ocaisa :D just needed time for the write-up (and got distracted by something on Slack :P) |
|
For EESSI, this is actually less of a problem as we drop CUDA to a build dependency. This means that at runtime the stubs |
| + if name and name.endswith(".so"): | ||
| + s = re.sub(r'lib', '', name) | ||
| + s = re.sub(r'\..*', '', s) | ||
| + self._name=util._findLib_ld(s) |
There was a problem hiding this comment.
I'm not sure I understand what's happening here. What issue is this actually resolving? Also, invoking _findLib_ld means we need to make absolutely sure that that searches the correct path (though I guess that's ensured by the changes below as well)
There was a problem hiding this comment.
oooh, wait, this is where you overwrite the name with the full path already? I.e. this, together with the change below, makes sure we get something like /home/casparl/eessi/versions/2023.06/software/linux/x86_64/amd/zen2/software/Blosc2/2.13.2-GCCcore-13.2.0/lib/libblosc2.so back, and then the rest of the CDLL call just acts on that full path?
In other words: this is where we are actually pretending the calling code called the function with the full path, thus avoiding the whole issue?
There was a problem hiding this comment.
Yes, by overriding self._name
|
I will encapsulate all changes using sysroot as condition, as you commented previously. |
|
Summarizing, my suggestion would be:
|
|
Patch migrated to easybuilders/easybuild-easyblocks#3798. |
Enabling using LIBRARY_PATH exposed shared libraries will enhance user experience using local installed packages that relies on external libraries. Current solution requires using LD_LIBRARY_PATH or adding the neeeded libraries to python main installation. This is related with an EESSI reported issue.
Further testing and refinement is needed.