diff mbox series

rust: added missing runtime dependencies to run rust on target

Message ID 20230308172909.2052236-1-sundeep.kokkonda@gmail.com
State Accepted, archived
Commit bb781f452299cfa6ec7fffd215b0af3149178f32
Headers show
Series rust: added missing runtime dependencies to run rust on target | expand

Commit Message

Sundeep KOKKONDA March 8, 2023, 5:29 p.m. UTC
[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.

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
---
 meta/recipes-devtools/rust/rust_1.67.1.bb | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alex Kiernan March 8, 2023, 6:27 p.m. UTC | #1
On Wed, Mar 8, 2023 at 5:30 PM Sundeep KOKKONDA
<sundeep.kokkonda@gmail.com> wrote:
>
> [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.
>
> Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
> ---
>  meta/recipes-devtools/rust/rust_1.67.1.bb | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/meta/recipes-devtools/rust/rust_1.67.1.bb b/meta/recipes-devtools/rust/rust_1.67.1.bb
> index 2118faec8f..f4c6d9511d 100644
> --- a/meta/recipes-devtools/rust/rust_1.67.1.bb
> +++ b/meta/recipes-devtools/rust/rust_1.67.1.bb
> @@ -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?

>  # 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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kiernan@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin March 8, 2023, 6:31 p.m. UTC | #2
On Wed, 8 Mar 2023 at 18:30, Sundeep KOKKONDA
<sundeep.kokkonda@gmail.com> wrote:
> 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
Sundeep KOKKONDA March 9, 2023, 2:22 a.m. UTC | #3
All the 3 ' gcc g++ binutil ' are required to run rust on target.

> 
> Without binutils getting error 'cannot find ld ' and
> 

without g++ getting below error:

> 
> 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
> /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:

> 
> 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.
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rust/rust_1.67.1.bb b/meta/recipes-devtools/rust/rust_1.67.1.bb
index 2118faec8f..f4c6d9511d 100644
--- a/meta/recipes-devtools/rust/rust_1.67.1.bb
+++ b/meta/recipes-devtools/rust/rust_1.67.1.bb
@@ -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