Closed allsey87 closed 11 months ago
What I find a bit strange about this error, however, is that it claims that /home/mallwright/poky/build/tmp/work/corei7-64-poky-linux/hello-rust/1.0.0-r0/target/release/build/log-72f27afcef2156d3/build-script-build
could not be found. However it does exist and is executable:
ls -al /home/mallwright/poky/build/tmp/work/corei7-64-poky-linux/hello-rust/1.0.0-r0/target/release/build/log-72f27afcef2156d3/build-script-build
-rwxr-xr-x 2 mallwright mallwright 3269416 Mar 8 15:24 /home/mallwright/poky/build/tmp/work/corei7-64-poky-linux/hello-rust/1.0.0-r0/target/release/build/log-72f27afcef2156d3/build-script-build
This sounds similar to https://github.com/rust-embedded/meta-rust-bin/issues/94 - could you please double-check that you've updated to the latest master
?
Hi @nastevens, I am indeed on the latest master, you can confirm that from the yocto build configuration:
meta-rust-bin = "master:f8e79ed922c765fca224b2318ab172e0b59f4a4d"
Perhaps this is an issue with build host and target architecture being (almost) the same?
BUILD_SYS = "x86_64-linux"
TARGET_SYS = "x86_64-poky-linux"
This is the output of ldd
for the build script. I think this issue is related to #94 and #56, in particular I suspect that the loader as specified on the last line of the output of ldd
: /lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fa2a21bc000)
is incorrect and should instead be something closer to: /lib64/ld-linux-x86-64.so.2 (0x00007fbe48ca0000)
ldd /home/mallwright/poky/build/tmp/work/corei7-64-poky-linux/hello-rust/1.0.0-r0/target/release/build/log-72f27afcef2156d3/build-script-build
linux-vdso.so.1 (0x00007fff20be0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa2a1fa4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa2a1d85000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa2a1b81000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa2a1790000)
/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fa2a21bc000)
Digging in a bit deeper, I can confirm that RUST_TARGET
and RUST_BUILD
are both set to x86_64-unknown-linux-gnu
. I am able to get the build to complete successfully by changing linker-wrapper.sh
to linker-wrapper-native.sh
, that is:
diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass
index bcb2c05..9f62759 100644
--- a/classes/cargo.bbclass
+++ b/classes/cargo.bbclass
@@ -61,7 +61,7 @@ create_cargo_config() {
else
echo > ${CARGO_HOME}/config
echo "[target.${RUST_TARGET}]" >> ${CARGO_HOME}/config
- echo "linker = '${WRAPPER_DIR}/linker-wrapper.sh'" >> ${CARGO_HOME}/config
+ echo "linker = '${WRAPPER_DIR}/linker-native-wrapper.sh'" >> ${CARGO_HOME}/config
fi
echo >> ${CARGO_HOME}/config
Although I am skeptical as to whether the final binary will run on my target. I will test this now.
Indeed, this doesn't work and reports file not found, which as I understand, means that the loader was not found.
root@up-core:~# which hello-rust
/usr/bin/hello-rust
root@up-core:~# ls -al `which hello-rust`
-rwxr-xr-x 1 root root 280888 Mar 9 10:34 /usr/bin/hello-rust
root@up-core:~# hello-rust
-sh: /usr/bin/hello-rust: No such file or directory
The output of ldd (run on the host since I don't have ldd on the target) is as follows, which is almost identical to #56
ldd hello-rust
linux-vdso.so.1 (0x00007fffbd8c7000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fb5a591d000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fb5a5912000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fb5a58f1000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fb5a58ea000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fb5a571d000)
/home/mallwright/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fb5a5bb7000)
@nastevens as you mentioned in your comment, the change in 2c460c05f4d0a8563fc9269e15c94728e2422074 causes problems for build.rs
in dependency crates.
@allsey87 last time I looked at this, we got non-build-script crates working. It seems we are blocked on Rust itself not allowing to have individual target setups for the same target.
@otavio do you know if there been an issue opened for this on the Rust's/cargo's repo?
@allsey87 yes, I found it in the past but didn't find it now. Sorry.
@allsey87 @otavio Seems like this might be the issue in question? https://github.com/rust-lang/cargo/issues/3349.
@rich-g exactly. It has a patch under work to fix it.
Looks like the right tooling is now (or will be shortly) in place in nightly: https://github.com/rust-lang/cargo/blob/master/src/doc/src/reference/unstable.md#host-config
Yes, however, I believe we cannot use it stable until it is release. Am I wrong?
Yes, however, I believe we cannot use it stable until it is release. Am I wrong?
You're correct for how things work at present. You can work around it as described in https://github.com/rust-embedded/meta-rust-bin/issues/101 but I wouldn't feel comfortable adding the changes more generally until this is stabilized. That said I'm definitely open to workarounds using current stable if anyone has any ideas.
The fix is available as of rust 1.54.0
stable, you can enable it like this.
Should be fixed with the merge of #146
Is it the case at the moment, that any package using a build script will not compile?
With an empty project, it seems that as soon as I add a dependency on a package that includes a
build.rs
, the build fails. For example, if I add log as a dependency, I get the output:My Yocto build configuration is as follows: