Open iulianR opened 4 years ago
libstd has an unconditional dependency on libunwind. But building libunwind seems to fail because you don't have aarch64-linux-musl-gcc which it requires for cross-building. You seem to have aarch64-openwrt-linux-musl-gcc, but well, that's not the same thing.
I'm afraid I have no experience cross-building for such platforms, so that is about all I can tell you...
Oops, I ended up pasting the wrong error (one where the linker was not in PATH) while trying to prepare a minimal setup. Here is the error that I'm getting:
error: failed to run custom build command for `unwind v0.0.0 (/home/master/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libunwind)`
Caused by:
process didn't exit successfully: `/tmp/xargo.C5ty0ZI1mUUm/target/release/build/unwind-080da0be54a1605a/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rustc-link-search=native=/tmp/xargo.C5ty0ZI1mUUm/target/aarch64-unknown-linux-musl/release/build/unwind-a98e36b91a645d82/out
running: "aarch64-openwrt-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "../llvm-project/libunwind/include" "-std=c99" "-std=c++11" "-nostdinc++" "-fno-exceptions" "-fno-rtti" "-fstrict-aliasing" "-funwind-tables" "-D__LITTLE_ENDIAN__=1" "-o" "/tmp/xargo.C5ty0ZI1mUUm/target/aarch64-unknown-linux-musl/release/build/unwind-a98e36b91a645d82/out/../llvm-project/libunwind/src/Unwind-EHABI.o" "-c" "../llvm-project/libunwind/src/Unwind-EHABI.cpp"
cargo:warning=aarch64-openwrt-linux-musl-gcc: error: ../llvm-project/libunwind/src/Unwind-EHABI.cpp: No such file or directory
cargo:warning=aarch64-openwrt-linux-musl-gcc: fatal error: no input files
cargo:warning=compilation terminated.
exit code: 1
--- stderr
error occurred: Command "aarch64-openwrt-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "../llvm-project/libunwind/include" "-std=c99" "-std=c++11" "-nostdinc++" "-fno-exceptions" "-fno-rtti" "-fstrict-aliasing" "-funwind-tables" "-D__LITTLE_ENDIAN__=1" "-o" "/tmp/xargo.C5ty0ZI1mUUm/target/aarch64-unknown-linux-musl/release/build/unwind-a98e36b91a645d82/out/../llvm-project/libunwind/src/Unwind-EHABI.o" "-c" "../llvm-project/libunwind/src/Unwind-EHABI.cpp" with args "aarch64-openwrt-linux-musl-gcc" did not execute successfully (status code exit code: 1).
It seems that path ../llvm-project/libunwind/src/Unwind-EHABI.cpp
does not exist. I replaced the compiler path with a bash script that does ls ..
and the llvm-project directory does not seem to exist:
total 52
drwxr-xr-x. 2 master master 4096 Mar 9 12:06 build_helper
drwxr-xr-x. 10 master master 4096 Mar 9 12:06 liballoc
drwxr-xr-x. 22 master master 4096 Mar 9 12:06 libcore
drwxr-xr-x. 2 master master 4096 Mar 9 12:06 libpanic_abort
drwxr-xr-x. 3 master master 4096 Mar 9 12:06 libpanic_unwind
drwxr-xr-x. 3 master master 4096 Mar 9 12:06 libproc_macro
drwxr-xr-x. 2 master master 4096 Mar 9 12:06 libprofiler_builtins
drwxr-xr-x. 14 master master 4096 Mar 9 12:06 libstd
drwxr-xr-x. 3 master master 4096 Mar 9 12:06 libterm
drwxr-xr-x. 5 master master 4096 Mar 9 12:06 libtest
drwxr-xr-x. 2 master master 4096 Mar 9 12:06 libunwind
drwxr-xr-x. 6 master master 4096 Mar 9 12:06 stdarch
drwxr-xr-x. 5 master master 4096 Mar 9 12:06 tools
This is what led me to believe that it's not a problem related to the compiler. rust-src
and rustc
seem up to date.
$ rustup component add rust-src
info: component 'rust-src' is up to date
$ rustc -V
rustc 1.43.0-nightly (564758c4c 2020-03-08)
Any idea what I should investigate next? I did manage to compile in the same manner some months ago, so it might be something that changed in Rust or Xargo since then.
The rustc src
directory contains llvm-project
... so it looks like some change in rustc's libunwind made that depend on the LLVM checkout, and therefore rust-src
is not self-contained any more.
Looking at the libunwind build script, LLVM libunwind is always used for Linux musl targets. That behavior got introduced by https://github.com/rust-lang/rust/pull/63173, so I would guess that PR broke xargo for such targets.
That said, it looks like before it relied on libunwind.a
being available somehow, and it is not clear how you got that file either.
That said, it looks like before it relied on libunwind.a being available somehow, and it is not clear how you got that file either.
It probably comes from -L/opt/toolchain/sdk-aarch64-gcc7-musl/staging_dir/target-aarch64_cortex-a72_musl/usr/lib
as my toolchain contains libunwind.a
compiled for aarch64 musl.
The rustc src directory contains llvm-project... so it looks like some change in rustc's libunwind made that depend on the LLVM checkout, and therefore rust-src is not self-contained any more.
Then this is mostly a problem of the rust-src
component in rustup
?
Well... either rust-src
should contain llvm-project/libunwind
, or else the libunwind build.rs
should be smart enough to pick up the libunwind.a
that is present on your system.
For now I was able to progress by cloning llvm-project
in the rust/src
directory, but this not ideal. If I have time, I will try to see if this issue is already reported somewhere in rustup
or in rust
.
rustup
just installs archives created by rust
, so that would be the right repo to report in. Probably the solution is to add src/llvm-project/libunwind
in this list, but I am not sure.
Ok, unless you want to (as you have more experience with the process), I will report this issue in rustup
. Thanks for help!
The issue should go to rust
, not rustup
. :)
You know all the actual details of what you want to do so it is probably better if you report it. Feel free to reference the discussion here.
EDIT: Ah, you already did.
The issue should go to rust, not rustup. :)
Right, I was under the impression that the list is actually maintained by rustup
and I didn't pay attention. I assume you talked with someone to move the issue, so thanks for that.
They moved the issue without my intervention, but anyway it is in the right place now. ;)
Hello!
With the following config:
This in $PATH:
With the directory containing:
Cargo.toml:
Xargo.toml:
This command fails:
Anyone has any idea? I can't figure it out where the problem comes from.