From 4087d3fe41738cf73c347efebf96476e4c0798b4 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 12 Jun 2020 08:55:57 +0200 Subject: [PATCH] python: don't use optimizations on Darwin Also, don't use autoreconfHook on Darwin with Python 3. Darwin builds are still impure and fail with ld: warning: directory not found for option '-L/nix/store/6yhj9djska835wb6ylg46d2yw9dl0sjb-configd-osx-10.8.5/lib' ld: warning: directory not found for option '-L/nix/store/6yhj9djska835wb6ylg46d2yw9dl0sjb-configd-osx-10.8.5/lib' ld: warning: object file (/nix/store/0lsij4jl35bnhqhdzla8md6xiswgig5q-Libsystem-osx-10.12.6/lib/crt1.10.6.o) was built for newer OSX version (10.12) than being linked (10.6) DYLD_LIBRARY_PATH=/private/tmp/nix-build-python3-3.8.3.drv-0/Python-3.8.3 ./python.exe -E -S -m sysconfig --generate-posix-vars ;\ if test $? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi /nix/store/dsb7d4dwxk6bzlm845z2zx6wp9a8bqc1-bash-4.4-p23/bin/bash: line 5: 72015 Killed: 9 DYLD_LIBRARY_PATH=/private/tmp/nix-build-python3-3.8.3.drv-0/Python-3.8.3 ./python.exe -E -S -m sysconfig --generate-posix-vars generate-posix-vars failed make: *** [Makefile:592: pybuilddir.txt] Error 1 --- .../interpreters/python/cpython/2.7/default.nix | 4 +++- pkgs/development/interpreters/python/cpython/default.nix | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index db86b67835e3..62aae7b22129 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -23,6 +23,7 @@ , sha256 , passthruFun , static ? false +, enableOptimizations ? (!stdenv.isDarwin) }: assert x11Support -> tcl != null @@ -138,8 +139,9 @@ let --replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")' ''; - configureFlags = [ + configureFlags = optionals enableOptimizations [ "--enable-optimizations" + ] ++ [ "--enable-shared" "--with-threads" "--enable-unicode=ucs${toString ucsEncoding}" diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index ee77185cde65..694f661a9669 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -31,7 +31,9 @@ , stripBytecode ? false , includeSiteCustomize ? true , static ? false -, enableOptimizations ? true +# Not using optimizations on Darwin +# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found. +, enableOptimizations ? (!stdenv.isDarwin) }: assert x11Support -> tcl != null @@ -54,8 +56,9 @@ let version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; - nativeBuildInputs = [ + nativeBuildInputs = optionals (!stdenv.isDarwin) [ autoreconfHook + ] ++ [ nukeReferences ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc