python3Packages.polars: disable jemalloc initial exec TLS

Otherwise, loading the polars native library fails:

    > python3 -c 'import polars.polars'
    /nix/store/hncw7v8djk0vm5asy0jcggia0k60dhdv-python3-3.11.5-env/lib/python3.11/site-packages/polars/utils/build_info.py:5: UserWarning: polars binary missing!
      from polars.utils.polars_version import get_polars_version
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: /nix/store/gsbfr5ar6bki41qwfz6wbrd59z5p9ciw-jemalloc-5.3.0/lib/libjemalloc.so.2: cannot allocate memory in static TLS block

Normally, the jemalloc-sys disable_initial_exec_tls Cargo feature
covers this, but we override jemalloc with our own.
This commit is contained in:
edef
2023-10-31 11:59:22 +00:00
parent 3e8293e893
commit 9c3d82c6ef
@@ -6,6 +6,7 @@
, libiconv
, fetchFromGitHub
, typing-extensions
, jemalloc
, rust-jemalloc-sys
, darwin
}:
@@ -18,6 +19,11 @@ let
rev = "refs/tags/py-${version}";
hash = "sha256-kV30r2wmswpCUmMRaFsCOeRrlTN5/PU0ogaU2JIHq0E=";
};
rust-jemalloc-sys' = rust-jemalloc-sys.override {
jemalloc = jemalloc.override {
disableInitExecTls = true;
};
};
in
buildPythonPackage {
inherit pname version;
@@ -51,7 +57,7 @@ buildPythonPackage {
nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
buildInputs = [
rust-jemalloc-sys
rust-jemalloc-sys'
] ++ lib.optionals stdenv.isDarwin [
libiconv
darwin.apple_sdk.frameworks.Security