Hm I'm hitting an error that I'm not sure what to make of. This is during
Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> armv7-unknown-linux-musleabihf)
The error message itself is incredibly long, but boils down to
Compiling rustc_driver v0.0.0 (/home/ubuntu/rutos-mdm9x07-trb1-gpl/build_dir/hostpkg/rust-1.58.0/compiler/rustc_driver)
error: linking with `arm-openwrt-linux-muslgnueabi-gcc` failed: exit status: 1
|
= note: "arm-openwrt-linux-muslgnueabi-gcc" [...very long list of options, including:] "-Wl,-Bdynamic" "-lLLVM-13-rust-1.58.0-stable" "-Wl,-rpath,$ORIGIN/../lib"
= note: /home/ubuntu/rutos-mdm9x07-trb1-gpl/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/8.4.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: cannot find -lLLVM-13-rust-1.58.0-stable
collect2: error: ld returned 1 exit status
At this stage I have several relevant-looking LLVM libraries present at the following paths (under the OpenWRT root):
./build_dir/hostpkg/rust-1.58.0/build/x86_64-unknown-linux-gnu/llvm/lib/libLLVM-13-rust-1.58.0-stable.so
./build_dir/hostpkg/rust-1.58.0/build/x86_64-unknown-linux-gnu/llvm/build/lib/libLLVM-13-rust-1.58.0-stable.so
./build_dir/hostpkg/rust-1.58.0/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-13-rust-1.58.0-stable.so
./build_dir/hostpkg/rust-1.58.0/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.58.0-stable.so
I can't quite tell if I just don't have the correct environment set (seems more likely), or there's a missing LLVM artifact. @Grommish any ideas/pointers? Not sure if you faced anything like this before.
There's some discussion here: https://github.com/rust-lang/rust/issues/68714 which indicates that it's an environment variable issue. To be honest - and this is maybe the bigger issue - I have very little idea how to troubleshoot this, given how far-removed this step is from the original environment in which the build is run. I don't for example know what the value of $ORIGIN
is - it doesn't seem to appear anywhere else in the build log. I also wouldn't even know where to start in terms of trying to set $LIBRARY_PATH
(suggestion from the linked issue). Finally, it doesn't seem that I can just attempt to re-run the command in my shell (to try and narrow down the root cause), since it relies on a linker script in a temporary directory that gets cleared after the error.
Any pointers on how I might be able to isolate and troubleshoot this?
[Finally, @Grommish, just wanted to point out that I've slightly tweaked the original options to (a) build version 1.58.0 rather than 1.57.0 and (b) use from the stable
rather than the nightly
channel. This was actually in an attempt to get some more alignment between the versions, since I noticed that trying to build 1.57.0 with your original script was attempting to build against LLVM-13-rust-1.59.0-nightly
- and crashing with the error above - and my initial assumption was that maybe the error was due to a version mismatch]