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

Conversation

Gaelan
Copy link
Contributor

@Gaelan 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants