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
meson: fix rpath fixup #35513
meson: fix rpath fixup #35513
Conversation
Failure on x86_64-darwin (full log) Partial log (click to expand)
|
Failure on x86_64-linux (full log) Partial log (click to expand)
|
Failure on aarch64-linux (full log) Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Partial log (click to expand)
|
Failure on x86_64-linux (full log) Partial log (click to expand)
|
Failure on x86_64-linux (full log) Partial log (click to expand)
|
Failure on aarch64-linux (full log) Partial log (click to expand)
|
paths += ':' | ||
paths += build_rpath | ||
- if len(paths) < len(install_rpath): | ||
- padding = 'X' * (len(install_rpath) - len(paths)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't hardcode /nix/store
here, rather substituteAll
the $NIX_STORE
shell variable here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean substituteAll
ing builtins.storePath
, or reading NIX_STORE
environment variable at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the value of $NIX_STORE
during build-time, but the builtins.storeDir
Nix variable seems to work as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Failure on x86_64-darwin (full log) Partial log (click to expand)
|
Failure on x86_64-linux (full log) Partial log (click to expand)
|
Failure on aarch64-linux (full log) Partial log (click to expand)
|
3318bb1
to
df33000
Compare
Rebasing onto master as it will be merged with GNOME 3.28. |
Success on x86_64-darwin (full log) Attempted: meson The following builds were skipped because they don't evaluate on x86_64-darwin: deja-dup, epiphany, gnome3.gnome-shell, systemd Partial log (click to expand)
|
Failure on aarch64-linux (full log) Attempted: deja-dup, epiphany, gnome3.gnome-shell, meson, systemd Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: deja-dup, epiphany, gnome3.gnome-shell, meson, systemd Partial log (click to expand)
|
In common distributions, RPATH is only needed for internal libraries so meson removes everything else. With Nix, the locations of libraries are not as predictable, therefore we need to keep them in the RPATH. [1] Previously we have just kept the RPATH produced by the linker, patching meson not to remove it. This deprived us of potentially replacing it with install_rpath provided by project so we had to re-add it manually, and also introduced a vulnerability of keeping build paths in RPATH. This commit restores the clean-up but modifies it so the items starting with /nix/store are retained. This should be relatively safe since the store is immutable, however, there might be some unwanted retainment of build_rpath [2] if it contains paths from Nix store. [1]: NixOS#31222 (comment) [2]: http://mesonbuild.com/Release-notes-for-0-42-0.html#added-build_rpath-keyword-argument
df33000
to
de75940
Compare
This belive this broke the systemd-cryptsetup-generator The binary is no longer able to find @jtojnar Any idea how to fix this? |
Meson fixes the rpath during |
The problem is the cyclic dependency this would introduce: It comes from here. |
Note that |
For now, you could re-add the removed |
Motivation for this change
In common distributions,
RPATH
is only needed for internal libraries so meson removes everything else. With Nix, the locations of libraries are not as predictable, therefore we need to keep them in theRPATH
. See #31222 (comment) for more details.Previously we have just kept the
RPATH
produced by the linker, patching meson not to remove it. This deprived us of potentially replacing it withinstall_rpath
provided by project so we had to re-add it manually, and also introduced a vulnerability of keeping build paths inRPATH
.This patch restores the clean-up but modifies it so the items starting with
/nix/store
are retained.This should be relatively safe since the store is immutable, however, there might be some unwanted retainment of
build_rpath
if it contains paths from Nix store.Closes: #31222
Things done
DT_NEEDED
items.wlrootsthey use a different fixup, let them (@primeos) clean it up themselvesbuild-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)cc @brandonedens @rasendubi @yegortimoshenko