Skip to content
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

control additional search paths for libraries via $EPREFIX/etc/ld.so.conf rather than customizing glibc? #77

Open
boegel opened this issue Feb 27, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@boegel
Copy link
Contributor

boegel commented Feb 27, 2021

We now add /opt/eessi/lib as (primary) search path for libraries, by baking it into glibc (see EESSI/gentoo-overlay#8).

@amadio pointed out to us that a better alternative may be simply adding these paths to $EPREFIX/etc/ld.so.conf instead.

@bartoldeman: Is there a particular reason you didn't take that approach for the ComputeCanada software stack?

@boegel boegel transferred this issue from EESSI/gentoo-overlay Feb 27, 2021
@boegel boegel added the enhancement New feature or request label Feb 27, 2021
@bartoldeman
Copy link

bartoldeman commented Feb 27, 2021

Yes: ld.so.conf(.d) at runtime merely acts as input to ldconfig, the real file that matters is the cache file $EPREFIX/etc/ld.so.cache. We cannot guarantee that the contents of the additional search path are the same on the clients as on the build node.

Unless you create a local cache via a symlink but then you need to run ldconfig on the clients!

@amadio
Copy link

amadio commented Mar 1, 2021

Yes, if the libraries differ in each client, then $EPREFIX/etc/ld.so.cache will not be up to date. I guess I understand better now why you did this in glibc, but this might be a case in which just using LD_LIBRARY_PATH on the client side would be ok.

@boegel
Copy link
Contributor Author

boegel commented Mar 1, 2021

@amadio All our binaries are linked with RPATH, so $LD_LIBRARY_PATH won't work at all.

@bartoldeman
Copy link

No LD_LIBRARY_PATH will do the job as well, for libraries that are not found in the RPATH.
We wanted the priority of /usr/lib64/nvidia as low as possible though but IIRC that was because of some libGL conflicts that should be behind us with libglvnd.

That leaves LD_LIBRARY_PATH as an ok choice except in some fortunately non-so-common environments that destroy it (Bazel comes to mind).

@boegel
Copy link
Contributor Author

boegel commented Mar 2, 2021

Our intention with the /opt/eessi/lib path(s) is to allow overriding libraries we include in our software stack though, not as fallback paths when stuff is not found.

@amadio
Copy link

amadio commented Mar 2, 2021

There are two versions of RPATH, the old style (DT_RPATH) and new style (DT_RUNPATH), which should be default these days. The new style lets you override with LD_LIBRARY_PATH. The man page ld.so(8) has more information on this.

@boegel
Copy link
Contributor Author

boegel commented Mar 2, 2021

@amadio Yes, we're aware of those differences. For now, we're using DT_RPATH, partially because we want to avoid people easily shooting themselves in the foot via $LD_LIBRARY_PATH (which is sometimes set by random software packages too, creating all kinds of weird problems).

@amadio
Copy link

amadio commented Mar 2, 2021

Ah, I see. I guess your approach to add the directory directly in glibc is indeed probably the best then.

poksumdo pushed a commit to poksumdo/compatibility-layer that referenced this issue Jun 8, 2023
Update automatically generated set files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants