-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Unwrapped GCC is propagated to user environments #21751
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Still relevant, I think. This might be interacting badly with newer versions of autoconf-archive macros
...and aarch64...
which causes the following error in a project that uses
On aarch64, here are the directory contents:
This probably affects any package that uses the most recent versions of the @Ericson2314, if you do have time could you give me some advice on how to make those new autoconf-archive macro versions not pick up unwrapped compilers? Thanks in advance, and sorry for cold-pinging! EDIT: To be clear, although the problem involves |
I think I've found a solution to this: 12cd91d#diff-1c3f080fce43dce74a94146b22cf2b6cb88f4a72c3491e82fef185393c152ff7R13 We just need |
Thanks for taking a look at this! Does this work for cross? If I understand correctly, Edit: Indeed, adding |
That's a good question. It builds, but I actually haven't tested the cross-compiled binaries. I think it works though. |
|
@collares I am a bit confused. IMO the unwrapped binaries being used is the problem. Those should be pretty "bannished" from showing up in Nix builds. |
All this makes me wish more I had time to fix #132343. We can then simplify cc-wrapper, which will generally help restore sanity. We might also be able to use the resulting freed up "complexity budget" to make a |
Here's
|
@collares is your |
The error happens with a nix build, but to access log file I did |
I can see the unwrapped compiler on the path of any derivation. Let me know if I'm doing something wrong.
|
@collares so the weird thing is how does the autoconf macro somehow get the prefixed gcc which should be "shadowed" by the wrapper coming earlier in the PATH. |
There's no wrapper for the prefixed gcc here, just for the unprefixed one:
On x86_64 this doesn't matter because the macro searches for the wrong prefix ( |
I am not familiar with how autoconf works, but to me it looks like it tries looking for the compilers in |
Ah, it's probably what collares says. |
Why is this? We should always be using wrapped compilers in nix builds. |
I don't think I have any good explanation here, but I would be happy to run any tests you think would be useful. Three things seem to be happening:
The end result is that the macro ends up finding an unwrapped compiler. The macro was only updated last year (in autoconf-archive/autoconf-archive#207), and the first version of |
After reading https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cc-wrapper/default.nix#L36, I think I see a possible source of confusion. To clarify, my comment above (#21751 (comment)) does not refer to a cross build: The build that failed on aarch64 was supposed to generate aarch64 binaries. The |
Hmm so the issue is that the native unwrapped binaries are both prefixed and unprefixed, but the wrapped ones are only unprefixed? CC @sternenseemann who was looking down exactly when GCC is prefixed to help dodge this sort of thing. |
Yep, that's the issue! This wasn't a problem before, but with the new autoconf macros it is. |
We force the prefix to be the same as what nix thinks |
@sternenseemann I am not sure CC_FOR_BUILD is set at all in this case, I think autoconf is just guessing names, tries with the prefix first, and then slips passed the wrapped one to find the unwrapped one. But I am not sure. |
Yes, exactly, |
If it helps, I have confirmed that autoconf-archive/autoconf-archive@9c26407 is the particular commit that causes the By the way, is it possible for |
Yeah I put no blame on autoconf. We simple should make sure that no compiler, unprefixed otherwise, can Put simply, if the unwrapped provides prefixed, the wrapped should provide prefixed, and if the unwrapped provides unprefixed, the wrapped should also provide unprefixed. |
I think we just need to prevent |
That makes sense, thanks for taking a look. I guess we can rename those but also see why they were make like that in the first place. |
It creates both |
https://github.com/steveicarus/iverilog/releases/tag/v12_0 Bump `iverilog` to 12.0, fixing two build failures: 1. autoconf now picks up on the unwrapped `x86_64-unknown-gnu-gcc` in path that fails at configurePhase to link executables. See: NixOS#21751 fix/hack: define the `{CC,CXX}_FOR_BUILD` variables. 2. buildPhase generates a `-Werror=format-security` error. Backport the the upstream patch that fixed the warning very shortly after the release was cut. And in the process, - use post-install tests from `.github/test.sh` and as a result, remove the now unneeded clone of `ivtest` - un-pin the verilog autoconf version Signed-off-by: Jack Leightcap <[email protected]>
Issue description
Our CC wrapper doesn't wrap all the binaries that GCC provides -- namely prefixed with architecture
x86_64-unknown-gnu-gcc
and variations. Because unwrapped GCC is propagated to user environments from the wrapper it ends up in the path (for example in FHS environments). One example of problem that it causes is that OpenWrt picks it up and fails to compile.wrapCC
needs to detect and wrap those.Steps to reproduce
buildEnv { paths = [ gcc ]; }
(you can also add it toenvironment.systemPackages
orbuildFHSUserEnv
);x86_64-unknown-gnu-gcc
(prefix may vary).Technical details
nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion
) 59dbcefThe text was updated successfully, but these errors were encountered: