-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
gcc: fix building cross-compiler on 32-bit host platforms #82510
Conversation
Can we just get rid of that |
There is another fix already in master: b6ae819 |
That fix looks pretty broken IMO. It just creates an empty output to satisfy Nix, but the target libraries will be missing. Once master gets merged into staging, I will revert it in this PR. |
@lopsided98 just updated staging for you |
b755e65
to
b7b9f82
Compare
@@ -201,11 +201,11 @@ postConfigure() { | |||
|
|||
|
|||
preInstall() { | |||
mkdir -p "$out/${targetConfig}/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.
Still want [ -z "$enableMultilib" ]
though, right?
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.
Those directories should always be created. I think the logic for the conditional below is correct (other than is64bit
referring to wrong platform). On 32-bit platforms, there should only be a lib
directory. On 64-bit platforms, there should be lib
and lib64
, which should be linked unless multilib is enabled.
It doesn't seem to break anything to have lib64
on 32-bit as well (since it happens unintentionally in the armv7l cross compiler), but that kind of change seems out of scope for this PR.
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.
Well, I'm not sure we ever don't do enableMultilib
, but I think without multilib it never prefixes any directories like that.
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.
Multilib is disabled for normal builds. In all the 64-bit GCCs I have built, lib64
is a symlink to lib
. The only place I can find in nixpkgs where enableMultilib
is true is gcc_multi
.
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.
Oh oops I forgot the -z
and got it backwards.
This reverts commit b6ae819.
b7b9f82
to
83fa0d9
Compare
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 see no issue with this. Thanks.
It was rightly noted that armv7l suffers from the same issue: https://hydra.nixos.org/build/114263466#tabs-buildsteps
Motivation for this change
Fixes building cross-compiler on 32-bit host platforms, which was broken by #81844.
Some quirk/bug of
moveToOutput
seems to sometimes prevent it from creating the output if it does not already exist. Therefore we need to manually create the output. On 64-bit host platforms, the output gets created here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/gcc/builder.sh#L208. Note that theis64bit
variable refers to the host platform, although it would probably make more sense for it to refer to the target platform. This is why this bug does not occur for 32-bit ARM cross-compilers.I'm not sure why #81844 triggered the problem with
moveToOutput
, as that function's code is hard for me to understand: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/multiple-outputs.sh#L93Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)cc @matthewbauer @misuzu