From e3a7c410a77fb7ddcd24755ce1406e2994f068bc Mon Sep 17 00:00:00 2001 From: Dmitry Ivankov Date: Thu, 29 Sep 2022 23:50:19 +0200 Subject: jemalloc: fix aarch64-darwin build Switch to default clang11 and apply a patch to fix tests. The issue is compiler optimizations for unused `malloc` calls being applied to jemalloc tests with empty `--with-jemalloc-prefix=`. Tests want to test bad arguments to malloc and optimization broke such assertions in some of tests, so patch is applied to disable builtin functions optimizations (only for tests code). Fixes https://github.com/NixOS/nixpkgs/issues/152056 Patch submission upstream https://github.com/jemalloc/jemalloc/pull/2340 --- pkgs/development/libraries/jemalloc/default.nix | 9 +++++++++ pkgs/top-level/all-packages.nix | 6 +----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix index cb734508b34..c505dc6db55 100644 --- a/pkgs/development/libraries/jemalloc/default.nix +++ b/pkgs/development/libraries/jemalloc/default.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchurl +, fetchpatch # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which # then stops downstream builds (mariadb in particular) from detecting it. This # option should remove the prefix and give us a working jemalloc. @@ -19,6 +20,14 @@ stdenv.mkDerivation rec { sha256 = "sha256-LbgtHnEZ3z5xt2QCGbbf6EeJvAU3mDw7esT3GJrs/qo="; }; + patches = [ + # fix tests under --with-jemalloc-prefix=, see https://github.com/jemalloc/jemalloc/pull/2340 + (fetchpatch { + url = "https://github.com/jemalloc/jemalloc/commit/d00ecee6a8dfa90afcb1bbc0858985c17bef6559.patch"; + hash = "sha256-N5i4IxGJ4SSAgFiq5oGRnrNeegdk2flw9Sh2mP0yl4c="; + }) + ]; + # see the comment on stripPrefix configureFlags = [] ++ lib.optional stripPrefix "--with-jemalloc-prefix=" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8fe5c03a38c..eae93628852 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19720,11 +19720,7 @@ with pkgs; jbigkit = callPackage ../development/libraries/jbigkit { }; - jemalloc = callPackage ../development/libraries/jemalloc { - # tests fail with LLVM 11+ - # https://github.com/jemalloc/jemalloc/issues/2091 - stdenv = if stdenv.cc.isClang then llvmPackages_10.stdenv else stdenv; - }; + jemalloc = callPackage ../development/libraries/jemalloc { }; jose = callPackage ../development/libraries/jose { }; -- cgit 1.4.1