mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
only link to one jemalloc build
Without setting JEMALLOC_OVERRIDE, we end up linking to two different jemalloc builds. Once dynamically, as a transitive dependency through rocksdb, and a second time to the static jemalloc that tikv-jemalloc-sys builds. This fixes dynamically-linked jemalloc builds, for the reasons described in <https://github.com/girlbossceo/conduwuit/pull/400#issue-2316700200>.
This commit is contained in:
parent
b6fc9b0feb
commit
ee43c2ff4c
2 changed files with 22 additions and 2 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
, pkgsBuildHost
|
, pkgsBuildHost
|
||||||
, rocksdb
|
, rocksdb
|
||||||
, rust
|
, rust
|
||||||
|
, rust-jemalloc-sys
|
||||||
, stdenv
|
, stdenv
|
||||||
|
|
||||||
# Options (keep sorted)
|
# Options (keep sorted)
|
||||||
|
|
@ -15,10 +16,23 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
featureEnabled = feature : builtins.elem feature features;
|
||||||
|
|
||||||
|
# This derivation will set the JEMALLOC_OVERRIDE variable, causing the
|
||||||
|
# tikv-jemalloc-sys crate to use the nixpkgs jemalloc instead of building it's
|
||||||
|
# own. In order for this to work, we need to set flags on the build that match
|
||||||
|
# whatever flags tikv-jemalloc-sys was going to use. These are dependent on
|
||||||
|
# which features we enable in tikv-jemalloc-sys.
|
||||||
|
rust-jemalloc-sys' = (rust-jemalloc-sys.override {
|
||||||
|
# tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature
|
||||||
|
unprefixed = true;
|
||||||
|
});
|
||||||
|
|
||||||
buildDepsOnlyEnv =
|
buildDepsOnlyEnv =
|
||||||
let
|
let
|
||||||
rocksdb' = rocksdb.override {
|
rocksdb' = rocksdb.override {
|
||||||
enableJemalloc = builtins.elem "jemalloc" features;
|
jemalloc = rust-jemalloc-sys';
|
||||||
|
enableJemalloc = featureEnabled "jemalloc";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
@ -60,6 +74,8 @@ let
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
# bindgen needs the build platform's libclang. Apparently due to "splicing
|
# bindgen needs the build platform's libclang. Apparently due to "splicing
|
||||||
# weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the
|
# weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the
|
||||||
|
|
|
||||||
|
|
@ -30,5 +30,9 @@ mkShell {
|
||||||
toolchain
|
toolchain
|
||||||
]
|
]
|
||||||
++
|
++
|
||||||
default.nativeBuildInputs;
|
default.nativeBuildInputs
|
||||||
|
++
|
||||||
|
default.propagatedBuildInputs
|
||||||
|
++
|
||||||
|
default.buildInputs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue