rust-lang / wg-cargo-std-aware

Repo for working on "std aware cargo"
137 stars 8 forks source link

Figure out why profile override causes linker errors. #32

Closed ehuss closed 5 years ago

ehuss commented 5 years ago

The following override causes a linker error:

[profile.dev.overrides.std]
opt-level = 2

Whereas an override like [profile.dev.overrides."*"] works fine. Here is a gist of the error: https://gist.github.com/ehuss/6973e2fad5663f10592f71de08b3eff0

I haven't investigated much, but this seems like a worrisome problem. Perhaps there is a simple explanation, but it may make profile overrides much more difficult to use, and we may want to make it easier if there is some workaround.

Maybe it has something to do with monomorphization of std code happens in the caller, or module re-exports?

alexcrichton commented 5 years ago

Ok so this is strange. I am able to reproduce this on OSX and MSVC, but not on Linux. Additionally the linker error happens building libstd.so, not the final binary.

While this would just happen to get fixed if we drop the dylib crate type for libstd, I'd prefer to dig in more to figure out what's going on.

alexcrichton commented 5 years ago

Reduced!

What do you think of closing in favor of the usptream issue?

alexcrichton commented 5 years ago

I'm gonna close this since we did indeed figure it out (https://github.com/rust-lang/rust/issues/64319) and a fix is in progress