aboutsummaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/nss
diff options
context:
space:
mode:
authorGaelan Steele <gbs@canishe.com>2020-05-13 09:22:11 -0700
committerGaelan Steele <gbs@canishe.com>2020-05-14 09:26:09 -0700
commitb14d99777815df862a5aaccd4957bf06cecacfb4 (patch)
treeff42636025fc852ab784e757e00c718235b06d9a /pkgs/development/libraries/nss
parentd38bad590e75fb792ffdf4d223c9294d8e508808 (diff)
nss: fix building for aarch32 on aarch64
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.
Diffstat (limited to 'pkgs/development/libraries/nss')
-rw-r--r--pkgs/development/libraries/nss/default.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix
index d48b5a6ba735..5251c680361a 100644
--- a/pkgs/development/libraries/nss/default.nix
+++ b/pkgs/development/libraries/nss/default.nix
@@ -53,7 +53,9 @@ in stdenv.mkDerivation rec {
preConfigure = "cd nss";
makeFlags = let
- cpu = stdenv.hostPlatform.parsed.cpu.name;
+ # NSS's build systems expects aarch32 to be called arm; if we pass in armv6l/armv7l, it
+ # fails with a linker error
+ cpu = if stdenv.hostPlatform.isAarch32 then "arm" else stdenv.hostPlatform.parsed.cpu.name;
in [
"NSPR_INCLUDE_DIR=${nspr.dev}/include"
"NSPR_LIB_DIR=${nspr.out}/lib"
@@ -64,9 +66,11 @@ in stdenv.mkDerivation rec {
"USE_SYSTEM_ZLIB=1"
"NSS_USE_SYSTEM_SQLITE=1"
"NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
- ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+ # Pass in CPU even if we're not cross compiling, because otherwise it tries to guess with
+ # uname, which can be wrong if e.g. we're compiling for aarch32 on aarch64
"OS_TEST=${cpu}"
"CPU_ARCH=${cpu}"
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=1"
"NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling
] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1"