sdk: dev build failes with /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so
Version(s) of meta-rust
59c4377bdbc67aa306068d19b016136998fadcec based on rust 1.64.0 (also available in 1.58.1 based revisison)
Version(s) of poky and/or oe-core
poky d7194226b19e45251e80cc3c02f62849ec63f8b0 oe-core 6792ebdd966aa0fb662989529193a0940fbfee00
Expected result
cargo build uses sdk paths for aarch64 cross compilation
Actual result
# example:
$ cargo build
Compiling proc-macro2 v1.0.44
Compiling unicode-ident v1.0.4
Compiling quote v1.0.21
Compiling syn v1.0.101
Compiling serde_derive v1.0.145
Compiling serde v1.0.145
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.0.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.1.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.10.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.11.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.12.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.13.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.14.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.15.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.2.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.3.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.4.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.5.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.6.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.7.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.8.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.build_script_build.cee0a50d-cgu.9.rcgu.o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b.1c8388mo4pcg71ji.rcgu.o" "-Wl,--as-needed" "-L" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/deps" "-L" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6c1a3710590f8139.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-48fbfe5dd2c0ab5a.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libobject-4210c6cec6b7d890.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-22208719b7a9fe74.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-a0bee196d0c81b0b.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-c1b85d9e90b1e9de.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-b92be2e2394de3cb.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-fc6b441ffaab08a8.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-85dcea9e7773d8c8.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-f5bbcb007d18b5b7.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libadler-e09393430c13ddf5.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-baf61b4c557a4a02.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-3a964b8bbb6d046b.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-65b62faeee26ecee.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-7c3635af15e2965b.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c13a7200122452b6.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-529644e862aec1fe.rlib" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libcore-d72ad82cfa732bb9.rlib" "-Wl,--end-group" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-792bdce5346c13b1.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/lib/aarch64-beet-linux/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/andrehn/mdk/repos/swf/disp-handler/target/debug/build/quote-9403ab673029128b/build_script_build-9403ab673029128b" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: /opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so: error loading plugin: /opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/lib/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so)
collect2: error: ld returned 1 exit status
error: could not compile `quote` due to previous error
warning: build failed, waiting for other jobs to finish...
Steps to reproduce
- add packagegroup to TOOLCHAIN_HOST_TASK by
TOOLCHAIN_HOST_TASK:append = " packagegroup-rust-cross-canadian-${MACHINE}" bitbake <rust based (distro) image> -c do_populate_sdk- install sdk
- source sdk
- go to your project and run
cargo build
i have no idea why but it looks like the linker likes to load /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.soinstead of /opt/beet/2022.04/sysroots/x86_64-beetsdk-linux/usr/libexec/aarch64-beet-linux/gcc/aarch64-beet-linux/9.3.0/liblto_plugin.so
CMake and so on work as expected but cargo doesn't. hope you can help!
I wonted to chime in on this. I can build using bitbake ok, but for developing my package I obviously prefer using cargo build directly with the SDK-based toolchain. But this fails with similar issues. I'v looked into the cargo bbclass but didn't find anything obvious.
It appears to me as if cc is the systems gcc /usr/bin/gcc instead of the cross-compiler gcc.
Any suggestions are very welcome.