-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
[WIP] gcc: put target-specific libs in lib output #58606
Conversation
I think the header paths is an artifact of glibc not being stripped in cross build -- these paths you're seeing are in a debug section. This is a decision that was made in 2012 in commit 5481e67. I suspect the reasons to not strip glibc in cross build that applied at the time might not be current anymore. |
@illegalprime can you rebase this PR on top of #59787 now that it's merged and check that it fixes the libgcc / libc++ problem? Your issue with headers should be gone. |
b59ff58
to
3b8c0bb
Compare
thanks @delroth that worked! here's the new (much shorter) output:
|
Looks like the header situation isn't quite fixed yet. Still lots of references to |
@Thra11 you're right, seems to be https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/gcc/7/default.nix#L21 EDIT: seems to go as far back as 6 years ago (with gcc 4.8), maybe it could be removed? |
3b8c0bb
to
0b72fd7
Compare
0b72fd7
to
44d32d5
Compare
If I change it so that
However, we do still have a reference to |
@Thra11 it could also be this: nixpkgs/pkgs/development/compilers/gcc/builder.sh Lines 147 to 150 in 6e13c77
targetConfig is only set when cross compiling, i would just try removing the lines above.
|
@delroth @Mic92 there's some stripping hacks:
maybe some of these aren't needed anymore? |
Most likely the build systems are using the wrong strip for those cases. It's okay to remove them if you know for sure they're using strip correctly |
Most of these are probably obsolete. Stripping is done by the generic Nix builder script, there shouldn't be anything package-specific in selecting the right toolchain for stripping. gcc is the exception: it's a host package with some target libs in a subdir. It should likely have some custom stripping logic to handle this. Though so far I haven't hit any issues with running host strip on the target libs -- but my choice of (host, target) tuple might not be exotic enough :-) |
thinking about this a bit more, maybe if we only strip on the |
moveToOutput "lib/lib*.so*" "$lib" | ||
moveToOutput "lib/lib*.la" "$lib" | ||
moveToOutput "lib/lib*.dylib" "$lib" | ||
if [[ -d "$out/$target_triple/lib" && -n "$(ls -A $out/$target_triple/lib)" ]]; then |
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 should check if $target_triple
is defined first
I have confirmed that removing these lines nixpkgs/pkgs/development/compilers/gcc/builder.sh Lines 147 to 150 in 6e13c77
|
@Thra11 did you set stripped = true and remove those lines? When I try to do that I'm unable to compile glibc. Can you post what your derivation looks like? |
@illegalprime Here is the current state of my nixpkgs: https://github.com/Thra11/nixpkgs/tree/gcc-cross-contamination2 |
thanks @Thra11! but I still get an error with your nixpkgs:
|
I can only assume that the difference is the host architecture. I believe you are compiling on x86 (based on your original issue), while I am compiling on an aarch64 host. What architecture is the |
@Thra11 the file is an archive with ARM 32-bit files in it, but only the first file in the archive has the
this is the same problem I ran into when cross compiling rust libs: #56540 (comment) maybe if that field was EDIT: not sure how the strip process works now, but maybe it should unpack archive files and strip individually? Or just be changed somehow to accommodate EDIT 2: it seems that running the host's EDIT 3: maybe this means I need to set |
Thanks for take a stab at this you all! Someday I hope gcc can be changed so building the libraries separately is supported like LLVM, but this is definitely the right approach for now. |
@illegalprime I guess aarch64 strip must strip aarch32 files correctly |
turns out
even smaller than before, thanks for your help @Thra11! wouldn't it be sane to never call |
already talked on IRC with @matthewbauer a bit about this but I'm having trouble testing the other gcc versions to complete this PR (and building u-boot for the odroid-c1). Specifically I'm having trouble cross compiling with a different version of the gcc toolchain, I have tried:
which resulted in this log https://pastebin.com/3zhaiuKL trying:
runs without error, but a how should I do this? |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/proposal-a-dedicated-cross-compiling-team/3824/8 |
I'm waiting on #68395 to be resolved for this patch and to figure out how to test this patch against different gcc versions (i.e. how do i cross compile with a different gcc version?). |
To check target_triple's existence… diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index 795b52d0f59..157485fda4d 100644
--- a/pkgs/development/compilers/gcc/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
@@ -213,13 +213,13 @@ preInstall() {
postInstall() {
# Move runtime libraries to $lib.
- if [[ -d "$out/$target_triple/lib" && -n "$(ls -A $out/$target_triple/lib)" ]]; then
+ if [[ -n "$target_triple" && -d "$out/$target_triple/lib" && -n "$(ls -A $out/$target_triple/lib)" ]]; then
moveToOutput "$target_triple/lib/lib*.so*" "$lib"
moveToOutput "$target_triple/lib/lib*.la" "$lib"
moveToOutput "$target_triple/lib/lib*.dylib" "$lib"
mv "$lib/$target_triple"/lib/* "$lib/lib/"
rmdir -p --ignore-fail-on-non-empty "$lib/$target_triple/lib" || :
- elif [[ -d "$out/$target_triple/lib64" && -n "$(ls -A $out/$target_triple/lib64)" ]]; then
+ elif [[ -n "$target_triple" && -d "$out/$target_triple/lib64" && -n "$(ls -A $out/$target_triple/lib64)" ]]; then
moveToOutput "$target_triple/lib64/lib*.so*" "$lib"
moveToOutput "$target_triple/lib64/lib*.la" "$lib"
moveToOutput "$target_triple/lib64/lib*.dylib" "$lib" What else is missing for this not to be WIP anymore? |
Yeah, this looks ready to go. Make sure it goes to staging. /cc @Ericson2314 |
@@ -152,6 +152,9 @@ stdenv.mkDerivation ({ | |||
|
|||
libc_dev = stdenv.cc.libc_dev; | |||
|
|||
# set this var to use in builder.sh | |||
target_triple = targetPlatform.config; |
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.
you can use targetConfig below, actually
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.
Does this also need to be done for later gccs (8, 9) for this PR to apply to them?
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.
Yes, but as @matthewbauer wrote, this variable should probably be removed replaced with targetConfig
, which is already defined.
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.
@matthewbauer @lopsided98 I made a branch with this change applied (delete target_triple binding and use targetConfig in the script), and master
merged: https://github.com/eamsden/nixpkgs/tree/eamsden/gcc-cross-contamination
It fails with a long list of attempts to mv
files to the same directory:
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libasan.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libasan.so.5 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.so.5
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libasan.so.5.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.so.5.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libatomic.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libatomic.so.1 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.so.1
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libatomic.so.1.2.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.so.1.2.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libcc1.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libcc1.so.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.so.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libcc1.so.0.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.so.0.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libgcc_s.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgcc_s.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libgcc_s.so.1 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgcc_s.so.1
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libgomp.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libgomp.so.1 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.so.1
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libgomp.so.1.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.so.1.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libitm.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libitm.so.1 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.so.1
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libitm.so.1.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.so.1.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/liblsan.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/liblsan.so.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.so.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/liblsan.so.0.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.so.0.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libquadmath.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libquadmath.so.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.so.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libquadmath.so.0.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.so.0.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libssp.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libssp.so.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.so.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libssp.so.0.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.so.0.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libstdc++.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libstdc++.so.6 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so.6
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libstdc++.so.6.0.27 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so.6.0.27
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libstdc++.so.6.0.27-gdb.py to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so.6.0.27-gdb.py
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libtsan.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libtsan.so.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.so.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libtsan.so.0.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.so.0.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libubsan.so to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.so
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libubsan.so.1 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.so.1
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libubsan.so.1.0.0 to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.so.1.0.0
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libasan.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libatomic.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libcc1.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libgomp.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libitm.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/liblsan.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libquadmath.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libssp.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libssp_nonshared.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp_nonshared.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libstdc++.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libstdc++fs.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++fs.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libsupc++.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libsupc++.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libtsan.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
Moving /nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0//lib/libubsan.la to /nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.la
rmdir: failed to remove '/nix/store/s5rz11azrvlmsc9392r75wi79akygn88-gcc-9.2.0/lib': Directory not empty
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libasan.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libasan.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.so.5' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libasan.so.5' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libasan.so.5.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libasan.so.5.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libatomic.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libatomic.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.so.1' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libatomic.so.1' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libatomic.so.1.2.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libatomic.so.1.2.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libcc1.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libcc1.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.so.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libcc1.so.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libcc1.so.0.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libcc1.so.0.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgcc_s.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libgcc_s.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgcc_s.so.1' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libgcc_s.so.1' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libgomp.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libgomp.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.so.1' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libgomp.so.1' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libgomp.so.1.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libgomp.so.1.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libitm.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libitm.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.so.1' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libitm.so.1' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libitm.so.1.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libitm.so.1.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/liblsan.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/liblsan.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.so.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/liblsan.so.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/liblsan.so.0.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/liblsan.so.0.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libquadmath.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libquadmath.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.so.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libquadmath.so.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libquadmath.so.0.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libquadmath.so.0.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libssp.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libssp.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.so.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libssp.so.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp.so.0.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libssp.so.0.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libssp_nonshared.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libssp_nonshared.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libstdc++.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libstdc++.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so.6' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libstdc++.so.6' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so.6.0.27' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libstdc++.so.6.0.27' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++.so.6.0.27-gdb.py' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libstdc++.so.6.0.27-gdb.py' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libstdc++fs.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libstdc++fs.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libsupc++.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libsupc++.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libtsan.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libtsan.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.so.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libtsan.so.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libtsan.so.0.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libtsan.so.0.0.0' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.la' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libubsan.la' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.so' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libubsan.so' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.so.1' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libubsan.so.1' are the same file
mv: '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib//lib/libubsan.so.1.0.0' and '/nix/store/4dq9a667f3hsrk3lc6h5177i0nj1y297-gcc-9.2.0-lib/lib/libubsan.so.1.0.0' are the same file
builder for '/nix/store/6fiigj3xj5bm7h23kz4x6iws8fvws12c-gcc-9.2.0.drv' failed with exit code 1
(command: nix-build ./. -A pkgsCross.armv7l-hf-multiplatform.buildPackages.gcc-unwrapped
)
This same attribute path builds successfully (though of course with all the cross-contamination) on unpatched nixpkgs master
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.
targetConfig
is empty during native builds, so you need to add -n "${targetConfig}"
to the if statements in builder.sh
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.
Alternatively you could just add target_triple
to GCC 9 if that is easier.
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 think this one works: matthewbauer@16951cf
mv "$lib/$target_triple"/lib/* "$lib/lib/" | ||
rmdir -p --ignore-fail-on-non-empty "$lib/$target_triple/lib" || : | ||
elif [[ -d "$out/$target_triple/lib64" && -n "$(ls -A $out/$target_triple/lib64)" ]]; then | ||
moveToOutput "$target_triple/lib64/lib*.so*" "$lib" |
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 think you can remove the special handling of lib64
if you replace $out
with $out/$targetConfig
in the preInstall
hook above. This should cause the libraries to be installed into lib
rather than lib64
, and since $targetConfig
is empty during native builds, it will work for both native and cross.
I've been experimenting with this today, and came up a with a different version of this change that I think is somewhat cleaner: lopsided98@e1831eb It installs the libraries into |
Closing in favor of #81844. |
Motivation for this change
this attempts to solve #58501 and doesn't handle
lib64
yet.so far this seems like the right approach, building a cross package will have less contamination:
outputs:
so that's great!
*.so
s are correctly moved to thelib
output so we don't have to take the entire cross-gcc runtime closure with us, but there's still contamination! the rest of it comes from thestage-static-gcc
compiler and is in the form of references to/nix/store/HASH-armv7l-unknown-linux-gnueabihf-stage-static-gcc-debug-7.4.0/lib/gcc/armv7l-unknown-linux-gnueabihf/7.4.0/include
.You can verify this by taking a binary (say a lib from glibc) and grepping for the cross-compiler's hash:
So it turns out there's some headers stored in the cross-gcc closure whose path is compiled into a bunch of binaries. It's at this point where I'm unsure of what to do. I should separate the headers into a separate output, but then how do I tell other derivations to look at that path for header files (where do I add the extra
-I
flag)? Maybe in the gcc wrapper? not sure where that's built.Here's a running list of build dependencies that are brought into run-time:
stage-final-gcc-debug-7.4.0/armv7l-unknown-linux-gnueabihf/lib/*
stage-final-gcc-debug-7.4.0/armv7l-unknown-linux-gnueabihf/lib64/*
stage-static-gcc-debug-7.4.0/lib/gcc/armv7l-unknown-linux-gnueabihf/7.4.0/include/*
stage-final-gcc-debug-7.4.0/lib/gcc/armv7l-unknown-linux-gnueabihf/7.4.0/include/*
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)