{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/43637","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/43637/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/43637/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/43637/events","html_url":"https://github.com/rust-lang/rust/issues/43637","id":247912433,"number":43637,"title":"libstd tries to link to liballoc_jemalloc even when it is not enabled","user":{"login":"RalfJung","id":330628,"avatar_url":"https://avatars1.githubusercontent.com/u/330628?v=4","gravatar_id":"","url":"https://api.github.com/users/RalfJung","html_url":"https://github.com/RalfJung","followers_url":"https://api.github.com/users/RalfJung/followers","following_url":"https://api.github.com/users/RalfJung/following{/other_user}","gists_url":"https://api.github.com/users/RalfJung/gists{/gist_id}","starred_url":"https://api.github.com/users/RalfJung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RalfJung/subscriptions","organizations_url":"https://api.github.com/users/RalfJung/orgs","repos_url":"https://api.github.com/users/RalfJung/repos","events_url":"https://api.github.com/users/RalfJung/events{/privacy}","received_events_url":"https://api.github.com/users/RalfJung/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-04T06:15:45Z","updated_at":"2017-08-04T06:54:16Z","closed_at":null,"body":"I am trying to use xargo to build a libstd without jemalloc. (That should enable cross-compiling libstd without cross-sompiling any C code.)\r\n\r\nI have the following Xargo.toml:\r\n```\r\n[dependencies]\r\nstd = {features = [\"panic_abort\", \"force_alloc_system\"]}\r\n```\r\nNow `xargo build -v` shows:\r\n```\r\n...\r\n     Running `rustc --crate-name std /home/r/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/lib.rs --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=3 --cfg 'feature=\"force_alloc_system\"' --cfg 'feature=\"panic_abort\"' -C metadata=f2ad81e4aae1da77 --out-dir /tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/tmp/xargo.j52xO5VAig3n/target/release/deps --extern rustc_tsan=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/librustc_tsan-b7ca73d041615ffd.rlib --extern alloc=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/liballoc-210591387bfdd319.rlib --extern panic_abort=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/libpanic_abort-2640770c1084be03.rlib --extern core=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/libcore-c98bfbbe49faadd5.rlib --extern std_unicode=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/libstd_unicode-c551e0da6902f65e.rlib --extern libc=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/liblibc-a777dc7e09579a84.rlib --extern unwind=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/libunwind-bfa0f42576422ec8.rlib --extern compiler_builtins=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-77a37c3c1af692d9.rlib --extern rustc_asan=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/librustc_asan-1b93e3a38c735df5.rlib --extern collections=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/libcollections-9a131e253f0f0440.rlib --extern rand=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/librand-5667d73b4da05dc4.rlib --extern alloc_system=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/liballoc_system-f1890d93ca3ab3ce.rlib --extern rustc_msan=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/librustc_msan-e33a58e222e716d7.rlib --extern rustc_lsan=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/deps/librustc_lsan-ad0c635ae24b3237.rlib --sysroot /home/r/.xargo/HOST -l dl -l rt -l pthread -L native=/tmp/xargo.j52xO5VAig3n/target/x86_64-unknown-linux-gnu/release/build/compiler_builtins-7685fddded0d8535/out`\r\nerror[E0463]: can't find crate for `alloc_jemalloc`\r\n\r\nerror: aborting due to previous error\r\n\r\nerror: Could not compile `std`.\r\n```\r\nThis shows that the correct feature flags are passed to rustc. However, for some reason, rustc behaves as if libstd contained `extern crate alloc_jemalloc`, which it does not. Is there magic going on here that adds alloc_jemalloc nevertheless? I did some grepping of the code but found nothing.\r\n\r\n(EDIT: There seems to be similar magic behavior for panic_unwind.)\r\n\r\nIf somehow it is not possible to get rid of this magic \"link against liballoc_jemalloc\", then (a) `libstd/Cargo.toml` should be changed to reflect this fact by always depending on liballoc_jemalloc, and (b) I hope there's a chance we can get a feature flag on liballoc_jemalloc itself to enable \"dummy_jemalloc\" mode (currently controlled by build.rs), and have libstd set that flag when force_alloc_system is set."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/320172348","html_url":"https://github.com/rust-lang/rust/issues/43637#issuecomment-320172348","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/43637","id":320172348,"user":{"login":"oli-obk","id":332036,"avatar_url":"https://avatars2.githubusercontent.com/u/332036?v=4","gravatar_id":"","url":"https://api.github.com/users/oli-obk","html_url":"https://github.com/oli-obk","followers_url":"https://api.github.com/users/oli-obk/followers","following_url":"https://api.github.com/users/oli-obk/following{/other_user}","gists_url":"https://api.github.com/users/oli-obk/gists{/gist_id}","starred_url":"https://api.github.com/users/oli-obk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oli-obk/subscriptions","organizations_url":"https://api.github.com/users/oli-obk/orgs","repos_url":"https://api.github.com/users/oli-obk/repos","events_url":"https://api.github.com/users/oli-obk/events{/privacy}","received_events_url":"https://api.github.com/users/oli-obk/received_events","type":"User","site_admin":false},"created_at":"2017-08-04T06:54:16Z","updated_at":"2017-08-04T06:54:16Z","body":"cc @aidanhs "}}
{"actor":{"display_login":"oli-obk"}}