sys-apps/fd-7.5.0 wants libjemalloc.so from the main OS (e.g. /usr/lib64/libjemalloc.so) because fd-7.5.0.ebuild contains ${ESYSROOT} instead of ${EROOT}. Suggested patch: ------------- --- ~/gentoo/var/db/repos/gentoo/sys-apps/fd/fd-7.5.0.ebuild.orig 2020-04-08 12:10:45.388738270 -0000 +++ ~/gentoo/var/db/repos/gentoo/sys-apps/fd/fd-7.5.0.ebuild 2020-04-08 12:11:00.773507481 -0000 @@ -85,7 +85,7 @@ src_compile() { export SHELL_COMPLETIONS_DIR="${T}/shell_completions" # this enables to build with system jemallloc, but musl targets do not use it at all - use elibc_musl || export JEMALLOC_OVERRIDE="${ESYSROOT}/usr/$(get_libdir)/libjemalloc.so" + use elibc_musl || export JEMALLOC_OVERRIDE="${EROOT}/usr/$(get_libdir)/libjemalloc.so" cargo_src_compile } ------------- Without the patch, the following error happens if jemalloc is not installed on the main system: ---------------- Compiling jemalloc-sys v0.3.2 Running `rustc --crate-name build_script_build /home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/cargo_home/gentoo/jemalloc-sys-0.3.2/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=1 --cfg 'feature="background_threads_runtime_support"' -C metadata=7e334fe11f076 5f3 -C extra-filename=-7e334fe11f0765f3 --out-dir /home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/build/jemalloc-sys-7e334fe11f0765f3 -L dependency=/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/deps --extern cc=/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/r elease/deps/libcc-91a7b2ebf1098d6b.rlib --extern fs_extra=/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/deps/libfs_extra-ab66b19d38ad8fcf.rlib --cap-lints allow` Running `/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/build/jemalloc-sys-7e334fe11f0765f3/build-script-build` error: failed to run custom build command for `jemalloc-sys v0.3.2` Caused by: process didn't exit successfully: `/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/build/jemalloc-sys-7e334fe11f0765f3/build-script-build` (exit code: 101) --- stdout TARGET=x86_64-unknown-linux-gnu HOST=x86_64-unknown-linux-gnu NUM_JOBS=20 OUT_DIR="/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/build/jemalloc-sys-76bb9fb603ac4451/out" BUILD_DIR="/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0/target/release/build/jemalloc-sys-76bb9fb603ac4451/out/build" SRC_DIR="/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/cargo_home/gentoo/jemalloc-sys-0.3.2" jemalloc override set --- stderr thread 'main' panicked at 'Path to `jemalloc` in `JEMALLOC_OVERRIDE=/usr/lib64/libjemalloc.so` does not exist', /home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/cargo_home/gentoo/jemalloc-sys-0.3.2/build.rs:83:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. warning: build failed, waiting for other jobs to finish... error: build failed * ERROR: sys-apps/fd-7.5.0::gentoo failed (compile phase): * cargo build failed * * Call stack: * ebuild.sh, line 125: Called src_compile * environment, line 1323: Called cargo_src_compile * environment, line 498: Called die * The specific snippet of code: * cargo build $(usex debug "" --release) "$@" || die "cargo build failed" * * If you need support, post the output of `emerge --info '=sys-apps/fd-7.5.0::gentoo'`, * the complete build log and the output of `emerge -pqv '=sys-apps/fd-7.5.0::gentoo'`. * The complete build log is located at '/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/temp/build.log'. * The ebuild environment file is located at '/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/temp/environment'. * Working directory: '/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0' * S: '/home/marcin/gentoo/var/tmp/portage/sys-apps/fd-7.5.0/work/fd-7.5.0' ---------------- Thanks Reproducible: Always Steps to Reproduce: 1. Make sure you do not have jemalloc dynamic lib in the main system: e.g. mv /usr/lib64/libjemalloc.so{,.bak} 2. emerge -v =sys-apps/fd-7.5.0
EROOT is not the correct fix, it is not to be used in src_compile: https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-10900011.1. ESYSROOT seems like the correct variable here. It's prefixed and it is where DEPEND-category packages should be installed: https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-720008.1.
JEMALLOC_OVERRIDE=/usr/lib64/libjemalloc.so seems to suggest ESYSROOT is not set, is the ebuild using a correct EAPI?