Skip to contentSkip to conversation

rust: added missing runtime dependencies to run rust on target

PATCH In review Sundeep KOKKONDA 4 participants 4 messages Mar 8, 2023 – Mar 9, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rust: added missing runtime dependencies to run rust on target

[YOCTO #14975]
rust files are not linking on target due to missing dependencies and observed below error.
error: linker x86_64-poky-linux-gcc not found

Added the required dependencies to run rust on target machine.

---
 meta/recipes-devtools/rust/rust_1.67.1.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/rust_1.67.1.bb +2 -0
index 2118faec8f..f4c6d9511d 100644
@@ -13,6 +13,8 @@ DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm"
 
 DEPENDS += "rust-llvm (=${PV})"
 
+RDEPENDS:${PN}:append:class-target = " gcc g++ binutils"
+
 # Otherwise we'll depend on what we provide
 INHIBIT_DEFAULT_RUST_DEPS:class-native = "1"
 # We don't need to depend on gcc-native because yocto assumes it exists
Signature · 1 line
2.34.1
#1 lore raw
Quoted 17 lines · Sundeep KOKKONDA

[YOCTO #14975]
rust files are not linking on target due to missing dependencies and observed below error.
error: linker x86_64-poky-linux-gcc not found

Added the required dependencies to run rust on target machine.

---
 meta/recipes-devtools/rust/rust_1.67.1.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/rust_1.67.1.bb +0 -0
index 2118faec8f..f4c6d9511d 100644

meta/recipes-devtools/rust/rust_1.67.1.bb DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" · line 17

Quoted 5 lines
meta/recipes-devtools/rust/rust_1.67.1.bb +2 -0
@@ -13,6 +13,8 @@ DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm"
 
 DEPENDS += "rust-llvm (=${PV})"
 
+RDEPENDS:${PN}:append:class-target = " gcc g++ binutils"
+

I did some digging a while ago (so it may have drifted) - I got to this list, which avoided g++

gcc gcc-symlinks binutils ${LIBC_DEPENDENCIES} libgcc-dev

What I don't understand is why doesn't gcc have a dependency on binutils?

Quoted 15 lines
meta/recipes-devtools/rust/rust_1.67.1.bb +0 -1
 # Otherwise we'll depend on what we provide
 INHIBIT_DEFAULT_RUST_DEPS:class-native = "1"
 # We don't need to depend on gcc-native because yocto assumes it exists
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178186): https://lists.openembedded.org/g/openembedded-core/message/178186
Mute This Topic: https://lists.openembedded.org/mt/97477865/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 1 line
Alex Kiernan
#2 lore raw
In reply to Sundeep KOKKONDA
Quoted 5 lines · Sundeep KOKKONDA

rust files are not linking on target due to missing dependencies and observed below error.
error: linker x86_64-poky-linux-gcc not found

Added the required dependencies to run rust on target machine. +RDEPENDS:${PN}:append:class-target = " gcc g++ binutils"

Are all three required? Particularly, why g++?

Alex

#3 lore raw

All the 3 ' gcc g++ binutil ' are required to run rust on target.

Quoted 3 lines

Without binutils getting error 'cannot find ld ' and

without g++ getting below error:

Quoted 26 lines
root@qemux86-64:~# rustc -o hello main.rs
error: linking with `x86_64-poky-linux-gcc` failed: exit status: 1
|
= note: "x86_64-poky-linux-gcc" "/tmp/rustcuD3OmE/symbols.o"
"hello.main.cbe1d0af-cgu.0.rcgu.o" "hello.main.cbe1d0af-cgu.1.rcgu.o"
"hello.main.cbe1d0af-cgu.2.rcgu.o" "hello.main.cbe1d0af
= note:
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find Scrt1.o: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find crti.o: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find crtbeginS.o: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -lgcc_s: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -lutil: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -lrt: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -lpthread: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -lm: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -ldl: No such file or directory
Quoted 9 lines
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find -lc: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find crtendS.o: No such file or directory
/usr/lib/gcc/x86_64-poky-linux/12.2.0/../../../../x86_64-poky-linux/bin/ld:
cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
error: aborting due to previous error

I tried the given dependencies ' gcc gcc-symlinks binutils ${LIBC_DEPENDENCIES} libgcc-dev ' to avoid g++ but that giving below QA error:

Quoted 11 lines

NOTE: Executing Tasks
ERROR: rust-1.67.1-r0 do_package_qa: QA Issue: rust rdepends on glibc-dbg [debug-deps]
ERROR: rust-1.67.1-r0 do_package_qa: QA Issue: rust rdepends on glibc-dev [dev-deps]
ERROR: rust-1.67.1-r0 do_package_qa: QA Issue: rust rdepends on libgcc-dev [dev-deps]
ERROR: rust-1.67.1-r0 do_package_qa: Fatal QA errors were found, failing task.