rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
95.37k stars 12.29k forks source link

Running "x.py build library --target XYZ" breaks previously built targets #121092

Open nikic opened 5 months ago

nikic commented 5 months ago

After building an x86_64-unknown-linux-gnu toolchain, I wanted to add libstd for i586-unknown-linux-gnu by running ./x.py build library --target i586-unknown-linux-gnu.

However, doing this apparently removes libstd for x86_64-unknown-linux-gnu.

What is the correct way to build multiple libstds without touching config.toml?

onur-ozkan commented 5 months ago

With no configuration, I did:

x build

then

x build library --target i686-unknown-linux-gnu

and still have both:

  ~/devspace/.other/rustc-builds  $ sha256sum build/host/stage1-std/x86_64-unknown-linux-gnu/release/libstd.so
418caaf8d9c3e440da9ca3ccc6c7461e6514bce7964ec9c6ee1253a5c205d9be  build/host/stage1-std/x86_64-unknown-linux-gnu/release/libstd.so

  ~/devspace/.other/rustc-builds  $ sha256sum build/host/stage1-std/i686-unknown-linux-gnu/release/libstd.so
bf2bc9c7bca9773124563a36e337b8094a4ed7eabca6eb8b9d6748e8d65e37f3  build/host/stage1-std/i686-unknown-linux-gnu/release/libstd.so
nikic commented 5 months ago

Are you able to use both targets with rustc +stage1 --target after linking rustup toolchain link stage1 build/x86_64-unknown-linux-gnu/stage1?

onur-ozkan commented 5 months ago

Ah, now I can see that.

What is the correct way to build multiple libstds without touching config.toml?

You could try defining multiple targets in --target, like x build library --target="x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu". Does this help?