-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
stdenv/linux: remove perl enableThreading=false override from stage1 #169746
Conversation
In general we want less files in bootstrap rather than more, but since it's there already anyway, why not use it. Is it in all bootstrap packages? |
See latest comment further downthread. this discussion is moot, since it turns out that the comment explaining `enableThreading=false` was wrong> In general we want less files in bootstrap rather than more,Er, maybe if you say "packages" instead of "files". Deleting some parts of a package from the bootstrap but including other parts really does not seem like a maintainability win. Especially when it forces weird hacks like what we're currently doing to perl5's
It's present on all but: powerpc64le, arm, and riscv. I have personally verified that the bootstrap (including both this PR and #161925) build and work on powerpc64le and arm. So apparently In any event, if we can't reproduce the failure that led to the hack being added, and removing the hack doesn't break anything, we really ought to remove the hack.
|
@ofborg eval |
This comment was marked as resolved.
This comment was marked as resolved.
The comment for the line removed by this patch states that "A threaded perl build needs glibc/libpthread_nonshared.a, which is not included in bootstrapTools". This is not the reason why it is necessary -- libpthread_nonshared.a part of the bootstrap-files on many platforms. The reason why this workaround was needed is because nuke-refs erases the rpath from libpthread.so, and unpack-bootstrap-tools.sh neglects to undo this using patchelf. Let's apply patchelf to libpthread.so, so we aren't leaving dangling /nix/store/eeee.... refs in libpthread.so, and remove the enableThreading=false override since it is no longer necessary. Additional background: The enableThreading=false attribute not only removes the "-Dusethreads" from the invocation of perl's Configure script, it also patches the script like this: # We need to do this because the bootstrap doesn't have a static libpthread sed -i 's,\(libswanted.*\)pthread,\1,g' Configure Although this prevents the perl interpreter from linking against libpthread.so, it does not prevent the libraries bundled with the interpreter from doing so. Time/HiRes/HiRes.so will still try to link against libpthread.so, and is only prevented from doing so by the fact that unpack-bootstrap-tools.sh neglects to patchelf out all of the nuke-refs'd rpaths. When all of the nuke-refs'd paths are patchelf'ed out, HiRes.so links against libpthread.so in the bootstrap tools, and the stdenv bootstrap fails: Can't load '/nix/store/7ny8kmppjzx6kx4xr5kphjz8fqqrlsll-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux/auto/Time/HiRes/HiRes.so' for module Time::HiRes: libpthread.so.0: cannot open shared object file: No such file or directory at /nix/store/7ny8kmppjzx6kx4xr5kphjz8fqqrlsll-perl-5.34.1/lib/perl5/5.34.1/XSLoader.pm line 93. at /nix/store/7ny8kmppjzx6kx4xr5kphjz8fqqrlsll-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux/Time/HiRes.pm line 94. Compilation failed in require at lib/Autom4te/FileUtils.pm line 42. BEGIN failed--compilation aborted at lib/Autom4te/FileUtils.pm line 42. Compilation failed in require at bin/autom4te line 46. BEGIN failed--compilation aborted at bin/autom4te line 46. make[1]: *** [Makefile:2259: tests/wrapper.in] Error 2 make[1]: *** Waiting for unfinished jobs.... Perl implements its own custom library loading routines for its modules, which likely do not fully implement rpath searching. This problem was revealed during the course of writing PR #161925, which depends on this PR in order to pass CI.
The latest push breaks the dependency cycle between this PR and #161925, so they can be evaluated independently. |
Edit: reworked to break the dependency cycle between this and #161925.
Description of changes
This commit removes the
enableThreading=false
override from the stage1 perl build. The comment describing that override states that "A threaded perl build needs glibc/libpthread_nonshared.a, which is not included in bootstrapTools". This is not the reason why this workaround was needed. The reason why this workaround was needed is becausenuke-refs
erases the rpath fromlibpthread.so
, andunpack-bootstrap-tools.sh
neglects to undo this usingpatchelf
.Let's use
patchelf
onlibpthread.so
, so we aren't leaving dangling/nix/store/eeee....
refs inlibpthread.so
, and remove theenableThreading=false
override since it is no longer necessary.Additional Background
The
enableThreading=false
override not only removes the-Dusethreads
from the invocation of perl'sConfigure
script, it also patches the script like this:Although this prevents the perl interpreter from linking against
libpthread.so
, it does not prevent the libraries bundled with the interpreter from doing so.Time/HiRes/HiRes.so
will still try to link againstlibpthread.so
, and is only prevented from doing so by the fact thatunpack-bootstrap-tools.sh
neglects to patchelf out all of thenuke-refs
'd rpaths. When all of thenuke-refs
'd paths arepatchelf
'ed out, but theenableThreading=false
override is left in place,HiRes.so
links againstlibpthread.so
in the bootstrap tools, and the stdenv bootstrap fails:To reproduce the error message above, apply the last commit (only) of #161925 (64d30ac321aa7c20a3802328635f1e133a3d85f3) and build
stdenv-linux
. Perl implements its own custom library loading routines for its modules, which likely do not fully implement rpath searching. This problem was revealed during the course of writing PR #161925, which depends on this PR in order to pass CI.Things done
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)