Closed cr1901 closed 3 years ago
Which version of nightly are you using? The directory names were rearranged recently, and src/libstd
is now library/std
. Make sure the version of nightly cargo you are using is in sync with the version of rustc in the git directory. If you have the latest master, the current nightly is 2020-08-08. You can also build cargo manually from the rust source tree, though it won't be linked into the toolchain automatically (you can sym link it manually if you want).
If you have the latest master, the current nightly is 2020-08-08.
I tried updating yesterday, but rustup
kept choosing older versions because some components were missing (which is good!):
william@xubuntu-dtrain:~/Projects/embedded/msp430/AT2XT$ rustup update nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-08-08, rust version 1.47.0-nightly (09f4c9f50 2020-08-07)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-08-07-x86_64-unknown-linux-gnu'
info: latest update on 2020-08-07, rust version 1.47.0-nightly (71f8d0c8f 2020-08-06)
cargo 1.47.0-nightly (aa6872140 2020-07-23)
I guess the directory names were changed between that window?
I can live without rustfmt
for now (any way to install an old version even if it's mixing toolchains?). So I did:
rustup toolchain install nightly --force
cargo -V
cargo 1.47.0-nightly (1653f3546 2020-08-04)
I got a successful compile:
cargo build -Zbuild-std=core --release --target=msp430-none-elf
Compiling compiler_builtins v0.1.32
Compiling core v0.0.0 (/home/william/Projects/toolchains/rust-msp430-fix/build-rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core)
Compiling autocfg v0.1.2
Compiling rand_core v0.4.2
Compiling semver-parser v0.7.0
Compiling proc-macro2 v0.4.30
Compiling libc v0.2.55
Compiling unicode-xid v0.1.0
Compiling syn v0.15.44
Compiling msp430-rt v0.2.4
Compiling bitflags v1.2.1
Compiling msp430g2211 v0.2.1 (https://github.com/cr1901/msp430g2211?rev=6f39636#6f396364)
Compiling rand_core v0.3.1
Compiling rand_jitter v0.1.4
Compiling semver v0.9.0
Compiling rand_chacha v0.1.1
Compiling rand_pcg v0.1.2
Compiling rand v0.6.5
Compiling rand_isaac v0.1.1
Compiling rand_hc v0.1.0
Compiling rand_xorshift v0.1.1
Compiling rustc_version v0.2.3
Compiling bare-metal v0.2.5
Compiling quote v0.6.13
Compiling rustc-std-workspace-core v1.99.0 (/home/william/Projects/toolchains/rust-msp430-fix/build-rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling r0 v1.0.0
Compiling vcell v0.1.0
Compiling bit_reverse v0.1.7
Compiling msp430-atomic v0.1.1 (https://github.com/cr1901/msp430-atomic?branch=llvm-asm#7e8f531d)
Compiling once_cell v1.4.0
Compiling rlibc v1.0.0
Compiling msp430 v0.2.2
Compiling panic-msp430 v0.2.0
Compiling msp430-rt-macros v0.2.4
Compiling at2xt v4.0.0 (/home/william/Projects/embedded/msp430/AT2XT)
Finished release [optimized] target(s) in 21.19s
msp430-elf-objdump -Cd target/msp430-none-elf/release/at2xt > target/msp430-none-elf/release/at2xt.lst
msp430-elf-readelf -a --wide target/msp430-none-elf/release/at2xt > target/msp430-none-elf/release/at2xt.sym
msp430-elf-size target/msp430-none-elf/release/at2xt
text data bss dec hex filename
I'm guessing the directory mismatch is going to affect a very small number of people, so feel free to close as invalid :).
Ok, sounds like this is resolved.
My Custom Rust
I have compiled my own Rust (commit 09f4c9f5082) in an attempt to test an LLVM patch for MSP430:
This Rust compiler's source directory symlinks directly to my git checkout of the rust source:
Attempt At Installing
rust-src
When I attempt to install
rust-src
viarustup
, as recommended by the manual, I get the following error telling me exactly what I need is impossible:Okay, fair enough. Let's see what happens when I try building anyway:
Indeed, in my
msp430-fix
toolchain, thelibstd
doesn't exist, while in mynightly
toolchain, the relevant directory does exist:Attempt At Manual Fix
At this point, because I'm desperate, I try to manually force the src directory the
msp430-fix
toolchain is using to have the layout thatcargo
expects:At which point the build bombs with this:
At This Point, I Decide To Open This Issue
I'm kind of stuck here. I need to be able to build my own libcore for testing, so I can test a patch against a target that does not get
libcore
/libstd
built by default (not built because it's a cross target?). Butcargo
is going out of it's way to prevent me from doing so. In the pastxargo
had an environment variable to set the source root to an external location (XARGO_RUST_SRC
). However, it seemsxargo
has completely stopped working recently, and thebuild-std
feature does not have an equivalent environment variable.So... what am I doing wrong? Is there any possible workaround?