From 2898079603c59ab3b8631083295780fa0ce36d66 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Jun 2020 02:23:33 +1200 Subject: [PATCH 1/4] Fix missing -lnuma when linking musl test exes --- builder/comp-builder.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix index dce42bb9ec..133cd91f2f 100644 --- a/builder/comp-builder.nix +++ b/builder/comp-builder.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp, zlib, ncurses, nodejs }: +{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp, zlib, ncurses, numactl, nodejs }: lib.makeOverridable ( let self = @@ -123,6 +123,7 @@ let "--ghc-option=-optl=-L${gmp.override { withStatic = true; }}/lib" "--ghc-option=-optl=-L${zlib.static}/lib" "--ghc-option=-optl=-L${ncurses.override { enableStatic = true; }}/lib" + "--ghc-option=-optl=-L${numactl.overrideAttrs (_: { configureFlags = "--enable-static"; })}/lib" ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}" ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}" ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}" From e7727f1218d9d253a07a4353c9b682a039649e52 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Jun 2020 03:08:58 +1200 Subject: [PATCH 2/4] Reduce the number of calls to override functions --- builder/comp-builder.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix index 133cd91f2f..7d8d7c02e2 100644 --- a/builder/comp-builder.nix +++ b/builder/comp-builder.nix @@ -1,5 +1,11 @@ { stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp, zlib, ncurses, numactl, nodejs }: - +let + # These are here to avoid multiple calls to override + gmpStatic = gmp.override { withStatic = true; }; + zlibStatic = zlib.static; + ncursesStatic = ncurses.override { enableStatic = true; }; + numactlStatic = numactl.overrideAttrs (_: { configureFlags = "--enable-static"; }); +in lib.makeOverridable ( let self = { componentId @@ -120,10 +126,10 @@ let "--disable-executable-dynamic" "--ghc-option=-optl=-pthread" "--ghc-option=-optl=-static" - "--ghc-option=-optl=-L${gmp.override { withStatic = true; }}/lib" - "--ghc-option=-optl=-L${zlib.static}/lib" - "--ghc-option=-optl=-L${ncurses.override { enableStatic = true; }}/lib" - "--ghc-option=-optl=-L${numactl.overrideAttrs (_: { configureFlags = "--enable-static"; })}/lib" + "--ghc-option=-optl=-L${gmpStatic}/lib" + "--ghc-option=-optl=-L${zlibStatic}/lib" + "--ghc-option=-optl=-L${ncursesStatic}/lib" + "--ghc-option=-optl=-L${numactlStatic}/lib" ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}" ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}" ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}" From 201d3fade9a9253147391a64ff9285d1523b1e03 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Jun 2020 03:33:48 +1200 Subject: [PATCH 3/4] cp -L is not needed for user to cp calculateNoHash --- lib/materialize.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/materialize.nix b/lib/materialize.nix index e9e752f23c..c1f7bc625e 100644 --- a/lib/materialize.nix +++ b/lib/materialize.nix @@ -77,7 +77,7 @@ let if materialized != null && !__pathExists materialized then '' echo "Materialized nix used for ${name} is missing. To fix run :" >> $ERR - echo " cp -Lr ${calculateNoHash} ${toString materialized}" >> $ERR + echo " cp -r ${calculateNoHash} ${toString materialized}" >> $ERR echo " chmod -R +w ${toString materialized}" >> $ERR cat $ERR false @@ -91,7 +91,7 @@ let diff -ru ${materialized} ${calculateNoHash} || true echo "Materialized nix used for ${name} incorrect. To fix run :" >> $ERR echo " rm -rf ${toString materialized}" >> $ERR - echo " cp -Lr ${calculateNoHash} ${toString materialized}" >> $ERR + echo " cp -r ${calculateNoHash} ${toString materialized}" >> $ERR echo " chmod -R +w ${toString materialized}" >> $ERR fi '') From 506d974e8858e61551564668258baf752b644f93 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Jun 2020 03:37:25 +1200 Subject: [PATCH 4/4] Update dummy-ghc files --- .../dummy-ghc/ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global | 2 +- .../dummy-ghc/ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global | 2 +- .../ghc-pkg/dump-global | 2 +- .../ghc-pkg/dump-global | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/materialized/dummy-ghc/ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global b/materialized/dummy-ghc/ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global index b5942cc13d..5219af3d74 100644 --- a/materialized/dummy-ghc/ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global +++ b/materialized/dummy-ghc/ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global @@ -1001,7 +1001,7 @@ maintainer: glasgow-haskell-users@haskell.org exposed: True hs-libraries: HSrts extra-libraries: - m rt dl ffi pthread + m rt dl ffi numa pthread includes: Stg.h ld-options: "-Wl,-u,base_GHCziTopHandler_runIO_closure" diff --git a/materialized/dummy-ghc/ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global b/materialized/dummy-ghc/ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global index 85039b0929..fb295bb748 100644 --- a/materialized/dummy-ghc/ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global +++ b/materialized/dummy-ghc/ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global @@ -1526,7 +1526,7 @@ maintainer: glasgow-haskell-users@haskell.org exposed: True library-dirs: hs-libraries: HSrts -extra-libraries: m rt dl ffi pthread +extra-libraries: m rt dl ffi numa pthread include-dirs: includes: Stg.h ld-options: diff --git a/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global b/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global index f0c317f2a5..80da1ee210 100644 --- a/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global +++ b/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global @@ -1000,7 +1000,7 @@ maintainer: glasgow-haskell-users@haskell.org exposed: True hs-libraries: HSrts extra-libraries: - m rt dl ffi + m rt dl ffi numa includes: Stg.h ld-options: "-Wl,-u,base_GHCziTopHandler_runIO_closure" diff --git a/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global b/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global index 5a411450ad..31c5b9a4e4 100644 --- a/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global +++ b/materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.8.3-x86_64-linux/ghc-pkg/dump-global @@ -1491,7 +1491,7 @@ maintainer: glasgow-haskell-users@haskell.org exposed: True library-dirs: hs-libraries: HSrts -extra-libraries: m rt dl ffi +extra-libraries: m rt dl ffi numa include-dirs: includes: Stg.h ld-options: