Skip to content
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

Fix build of linuxPackages.perf #34017

Merged
merged 2 commits into from Jan 19, 2018
Merged

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented Jan 18, 2018

It should build, but it doesn't.

#34013

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc #33813 @lopsided98 @bgamari

This looks OK, but maybe else "CROSS_COMPILE was meant to be replaced by else makeFlags.

@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Jan 18, 2018
@Ericson2314 Ericson2314 added this to Perhaps not priority for 18.03 in Cross compilation Jan 18, 2018
@Ericson2314 Ericson2314 moved this from Perhaps not priority for 18.03 to @bgamari's numerous fixes in Cross compilation Jan 18, 2018
@lopsided98
Copy link
Contributor

I'm trying to figure out why using the kernel makeFlags breaks the build. I tested the change on 4.14, but I don't think I tried 4.9 before.

I wanted to inherit the makeFlags from the kernel to avoid code duplication and because the kernel has some other make flags that I think are necessary for cross compiling (namely HOSTCC and ARCH), but I was not able to test cross builds because of failing dependencies.

@lopsided98
Copy link
Contributor

lopsided98 commented Jan 18, 2018

Strangely enough, this appears to be a kernel bug that is triggered when the ARCH flag is used (even if you are not cross compiling). Applying the linked patch fixes it for me. The issue doesn't exist in 4.4 because the problematic file was not yet created and it was fixed sometime after 4.9 due to some reorganization of headers.

We can either apply the patch or exclude the ARCH flag from makeFlags on 4.9 (which I think would break cross compiling).

@dtzWill
Copy link
Member Author

dtzWill commented Jan 18, 2018

Hmm, author of the patch seems to think it's a mistake: https://patchwork.kernel.org/patch/9676649/

Not so much setting ARCH but rather setting ARCH to the wrong value (with respect to the headers used, although I'm not sure how in the non-cross situation we mange to get this wrong!).

So... maybe only set ARCH on cross?

@lopsided98
Copy link
Contributor

I did some more digging, and it appears that it is probably caused by a different kernel bug, which was introduced in 4.8 and fixed in 4.12.

@lopsided98
Copy link
Contributor

Here is a version of the patch backported to 4.9, which fixes the issue for me.

@orivej orivej merged commit c053bab into NixOS:master Jan 19, 2018
@orivej
Copy link
Contributor

orivej commented Jan 19, 2018

@lopsided98 You patch looks good. Feel free to reapply 92083c3 together with the fix for Linux 4.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 10.rebuild-darwin: 0 10.rebuild-linux: 11-100
Projects
No open projects
Cross compilation
@bgamari's and @dtzWill's num...
Development

Successfully merging this pull request may close these issues.

None yet

5 participants