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

Help relocatability of libraries/executables in the JLL wrappers #687

Open
giordano opened this issue Feb 23, 2020 · 7 comments
Open

Help relocatability of libraries/executables in the JLL wrappers #687

giordano opened this issue Feb 23, 2020 · 7 comments

Comments

@giordano
Copy link
Member

We have several cases where we need to set some environment variables at runtime (or using withenv) to relocate the libraries/executables:

We usually delegate the Julia packages calling the libraries to set these variables, but this has a couple of drawbacks:

  • all packages calling the JLL package need to do it, see the example of Cairo.jl and Fontconfig.jl, both using Fontconfig_jll
  • in some cases, the Julia packages doesn't need to know what JLL package it's using. This is for example the case of MPI.jl reported by @simonbyrne in openmpi launcher doesn't work Yggdrasil#390

Maybe we should allow setting these variables directly in the JLL wrappers, to alleviate the burden of the developers of the high-level interface of the package.

The problem is that sometimes these variables need to be set around an executable -- so that we could add these to the already existing wrapper -- but sometimes we need to define the variable globally because it's used by a library, so deciding an interface to do this may not be very easy.

@Keno
Copy link
Contributor

Keno commented Feb 24, 2020

I'm wondering if it doesn't make sense to try and carry patches that make these kinds of shenanigans unnecessary.

@giordano
Copy link
Member Author

In most cases patching the source code might work, but it's more burden on our side to prepare the patches and maintain them in the long term. However, for git we need to set

ENV["GIT_SSL_CAINFO"] = joinpath(dirname(Sys.BINDIR), "share", "julia", "cert.pem")

I don't think we can escape setting some sort of environment variable in this case.

@fingolfin
Copy link
Member

It would be really useful to go beyond just allowing to set a few custom variables: how about making it possible to inject some arbitrary extra initialization code? E.g. for libraries like GMP, FLINT and others, one might want to initialize memory management functions. Right now, every caller of such a library has to set these (or hope somebody else did it).

@simonbyrne
Copy link
Contributor

A very simple solution would be a way to specify a custom __init__ function for the _jll files (say as a quote block passed to build_tarballs)

@fingolfin
Copy link
Member

fingolfin commented May 29, 2020

Based on a comment by @staticfloat on PR #791, I had a look at which env var values are in fact in use. Here is what I got (based on @giordano's helpful list):

Based on the above, it seems that setting env variables to a path relative to the artifact_dir would cover most
cases; the exceptions in the list above being

  • GIT_SSL_CAINFO, which is set to a path relative to the Julia install path
  • Gtk.jl, which however all in all seems out of scope here anyway

There is of course a good chance that there are other relevant env vars out there which
also don't fit into the "relative to artifact_dir" scheme, but it still seems as if
adding a way to specify such env vars be set in JLLs would be useful.

That said, it might not be completely without issue: e.g. setting TERMINFO could have
ripple effects: it would e.g. affect subprocesses launched by Julia, which then might
break (because those subprocesses might run executable which are linked against a different
copy of ncurses and which expect require a different TERMINFO value to work right).
So I am not 100% sure how to resolve that (or perhaps nothing needs to be resolved and
I am just overthinking it?)

@vchuravy
Copy link
Member

I am encountering this in PMIx_jll and pprte_jll which both copy OpenMPI MCA approach. It is again an environment variable relative to the artifact_dir.

@simonbyrne
Copy link
Contributor

init_block was added in #791, it appears to be used in a couple of recipes in Yggdrasil.

simonbyrne added a commit to simonbyrne/Yggdrasil that referenced this issue Nov 29, 2021
simonbyrne added a commit to simonbyrne/Yggdrasil that referenced this issue Nov 29, 2021
simonbyrne added a commit to simonbyrne/Yggdrasil that referenced this issue Nov 29, 2021
giordano pushed a commit to JuliaPackaging/Yggdrasil that referenced this issue Nov 29, 2021
simeonschaub pushed a commit to simeonschaub/Yggdrasil that referenced this issue Feb 23, 2022
fingolfin added a commit to fingolfin/Yggdrasil that referenced this issue Jul 3, 2023
fingolfin added a commit to fingolfin/Yggdrasil that referenced this issue Jul 3, 2023
fingolfin added a commit to fingolfin/Yggdrasil that referenced this issue Jul 3, 2023
fingolfin added a commit to JuliaPackaging/Yggdrasil that referenced this issue Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants