jemallocator icon indicating copy to clipboard operation
jemallocator copied to clipboard

build.rs script is missing rerun-if-env-changed indicators

Open orlp opened this issue 1 year ago • 4 comments

The build.rs script for jemallocator should output cargo::rerun-if-env-changed=VAR for each variable that its behavior depends on. One example where this currently goes wrong is if you specify environment variables in the [env] section of .cargo/config.toml and then change them.

orlp avatar Aug 12 '24 14:08 orlp

Do you have a reproduce repo?

BusyJay avatar Aug 13 '24 03:08 BusyJay

Sure, just use jemalloc in an otherwise empty new binary crate Then add .cargo/config.toml with

[env]
JEMALLOC_SYS_WITH_MALLOC_CONF = "stats_print:false"

and cargo build the crate. Now edit `.cargo/config.toml to

[env]
JEMALLOC_SYS_WITH_MALLOC_CONF = "stats_print:true"

Now jemalloc should be re-built and stats printed when you do cargo run, but it doesn't.

orlp avatar Aug 13 '24 09:08 orlp

Perhaps it's an issue about your setup or cargo itself, I can see jemalloc-sys does respect environment variable changes:

> env JEMALLOC_SYS_WITH_MALLOC_CONF="stats_print:false" cargo build
   Compiling tikv-jemalloc-sys v0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 29.56s
> env JEMALLOC_SYS_WITH_MALLOC_CONF="stats_print:true" cargo build
   Compiling tikv-jemalloc-sys v0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 29.68s
> env JEMALLOC_SYS_WITH_MALLOC_CONF="stats_print:true" cargo build
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s

BusyJay avatar Aug 13 '24 09:08 BusyJay

Those are not the reproduction steps I mentioned.

orlp avatar Aug 13 '24 10:08 orlp