From 8807cab81b09fa3c1d611e44a3ba4ac446d09f08 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 16 Dec 2021 21:06:07 -0800 Subject: [PATCH] libffi: Pass --build and --host to configure script Without this, building `libffi` would do something horrible when natively targeting `armv5tel-linux` on an `aarch64-linux` machine using the 32-bit compatibility sub-mode: ``` $ nix-build --system armv5tel-linux -A libffi --check [...] checking build system type... aarch64-unknown-linux-gnu checking host system type... aarch64-unknown-linux-gnu checking target system type... aarch64-unknown-linux-gnu [...] $ file result/lib/libffi.so.8.1.0 result/lib/libffi.so.8.1.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, not stripped $ nm result/lib/libffi.so.8.1.0 | grep ffi_call U ffi_call ``` Correct arch-specific code wouldn't be built at all, with the resulting binary subtly broken. --- pkgs/development/libraries/libffi/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix index 7387a4a1f062..43661198b281 100644 --- a/pkgs/development/libraries/libffi/default.nix +++ b/pkgs/development/libraries/libffi/default.nix @@ -28,6 +28,8 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + configurePlatforms = [ "build" "host" ]; + configureFlags = [ "--with-gcc-arch=generic" # no detection of -march= or -mtune= "--enable-pax_emutramp"