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

nss: fix building for aarch32 on aarch64 #87748

Merged
merged 1 commit into from May 14, 2020
Merged

nss: fix building for aarch32 on aarch64 #87748

merged 1 commit into from May 14, 2020

Conversation

@Gaelan
Copy link
Contributor

Gaelan commented May 13, 2020

Motivation for this change

There are two ways to build a package for aarch32 on an aarch64 machine:

nix-build . --argstr system armv6l-linux -A nss # with armv6l-linux in extraPlatforms
nix-build . --arg crossSystem '(import <nixpkgs> {}).lib.systems.examples.raspberryPi' -A nss

Previously, NSS failed to build with both methods: when using extraPlatforms, things failed because NSS includes an armv8-specific file (presumably based on the result of uname); when cross compiling, NSS's build system expects to receive an architecture name of arm (not armv6l or whatever), so was failing to include some arch-specific code and failed with a linker error. Although my examples used armv6l, these issues occur on armv7l as well.

This PR fixes those things by a) always passing the arch, even when not cross-compiling, and b) special-cases aarch32 to always pass in an arch of arm.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@Gaelan
Copy link
Contributor Author

Gaelan commented May 14, 2020

pinging @andir - you seem to be the de facto maintainer for nss

@andir andir self-assigned this May 14, 2020
@andir
Copy link
Member

andir commented May 14, 2020

This looks good. I am trying this out on an aarch64 box right now. Can you make sure the information you provided in the PR description is also present in the commit?

There are two ways to build a package for aarch32 on an aarch64 machine:
either by cross compiling as normal, or by adding armv6l/armv7l to
extraPlatforms and doing a non-cross compile.

Previously, NSS failed to build with both methods: when using
extraPlatforms, things failed because NSS includes an armv8-specific
file (presumably based on the result of uname); when cross compiling,
NSS's build system expects to receive an architecture name of arm (not
armv6l or whatever), so was failing to include some arch-specific code
and failed with a linker error.

This commit fixes those things by a) always passing the arch, even when
not cross-compiling, and b) special-casing aarch32 to always pass in an
arch of arm.
@Gaelan Gaelan force-pushed the Gaelan:nss-arm-fix branch from 0a159c0 to b14d997 May 14, 2020
@Gaelan
Copy link
Contributor Author

Gaelan commented May 14, 2020

Added some comments and a longer commit message.

@andir andir merged commit bf60834 into NixOS:staging May 14, 2020
16 checks passed
16 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="b14d997"; rev="b14d99777815df862a5aaccd4957bf06cecacfb4"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
nss, nss.passthru.tests on aarch64-linux Success
Details
nss, nss.passthru.tests on x86_64-linux Success
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.