[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/build/tmp/hosttools/ld: expected aarch64 got x86 #431

Open
tym2k1 opened this issue Sep 22, 2023 · 2 comments
Open

/build/tmp/hosttools/ld: expected aarch64 got x86 #431

tym2k1 opened this issue Sep 22, 2023 · 2 comments

Comments

@tym2k1
Copy link
tym2k1 commented Sep 22, 2023

Version(s) of meta-rust

8af044c

Version(s) of poky and/or oe-core

poky: fd00d74f47ceb57a619c4d0a0553ff0a30bbb7a4 - honister

Expected result

I'm currently working on integrating the FIDO Device Onboard protocol into an IoT device based on the Raspberry Pi 3 using Yocto. I've chosen to use the fido-device-onboard-rs and im trying to include its fdo-client-linuxapp cargo into my image as an executable. However, I encountered issues with cross-compiling it from my x86 host sys to aarch64.

Actual result

It seems that somewhere the build system keeps using the /build/tmp/hosttools/ld linker that when inspected shows its a chain of symbolic links to an x86 linker. Shouldn't it be linked with an aarch64 linker?

$ file /build/tmp/hosttools/ld
    /build/tmp/hosttools/ld: symbolic link to /usr/bin/ld
$ file /usr/bin/ld
    /usr/bin/ld: symbolic link to x86_64-linux-gnu-ld
$ file /usr/bin/x86_64-linux-gnu-ld
    /usr/bin/x86_64-linux-gnu-ld: symbolic link to x86_64-linux-gnu-ld.bfd
$ file /usr/bin/x86_64-linux-gnu-ld.bfd 
    /usr/bin/x86_64-linux-gnu-ld.bfd: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=772ede85f67dbf03deb2a2d3e89f979b28f83380, for GNU/Linux 3.2.0, stripped

Is it possible that the problem revolves around custom TARGET_SYS? For this project im specifying:

BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "aarch64-custom-linux"
MACHINE = "custom-machine-rpb3"

I'm using kas-container to dockerize my build environment so i cant use a package manager to provide needed files.

It also doesn't help that comments inside of rust-common.bbclass dont diffirentiate betwen HOST_SYS and TARGET_SYS

I understand that some challenges may stem from the implementation in fido-device-onboard-rs (with all due respect to its creators/maintainers) and not be a problem with meta-rust. For instance, openssl is known to have issues when being cross-compiled.

Logs:

| error: linking with `/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/wrapper/build-rust-ccld` failed: exit status: 1
|   |
|   = note: LC_ALL="C" PATH="/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/bin:/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/work/poky/scripts:/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/bin/aarch64-custom-linux:/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/bin/crossscripts:/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/sbin:/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/bin:/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/sbin:/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/bin:/work/poky/bitbake/bin:/build/tmp/hosttools" VSLANG="1033" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/wrapper/build-rust-ccld" "/tmp/rustcDkYHUz/symbols.o" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/build/fdo-data-formats-bf1975f18618981e/build_script_build-bf1975f18618981e.build_script_build.583f4c067a164812-cgu.0.rcgu.o" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/build/fdo-data-formats-bf1975f18618981e/build_script_build-bf1975f18618981e.vr4leaafjnm0upp.rcgu.o" "-Wl,--as-needed" "-L" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps" "-L" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib" "-L" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib" "-Wl,-Bstatic" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libopenssl_kdf-7a7a2f949b4a394a.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libopenssl-6d4e9993d95839af.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libonce_cell-bd63b52fd41a868b.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libbitflags-e9c22c7510615308.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libforeign_types-2287afda2a8b2464.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libforeign_types_shared-c877908e25f2b53c.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libcfg_if-469b3bc690cf9dc8.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libopenssl_sys-4c7854e73587e566.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/liblibc-7962cbbc3bd5d501.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libthiserror-a81b4c165a0d4dec.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libpanic_unwind-765e0d37e5f2e0ec.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libobject-75c7d75415c95f37.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libmemchr-9ebd44678be2eb75.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libaddr2line-ecce90ba1d4f89cc.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libgimli-011eb637a1edcbed.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/librustc_demangle-5185689a83f24d0b.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd_detect-de2591c4cde7d707.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libhashbrown-870508aa1a3856fd.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/librustc_std_workspace_alloc-b3be8167e442e616.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libminiz_oxide-92d8b4db24c9538a.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libadler-c9586b71e8bdb5b2.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libunwind-d61b3807132b22d3.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libcfg_if-570744b6a37e1fe6.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/liblibc-6ab65dda7e4b5a0a.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/liballoc-7f55c5c69e500af8.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/librustc_std_workspace_core-4c3882ec9aaeb347.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libcore-968d94de92f54fdf.rlib" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libcompiler_builtins-212f28ac96a84d68.rlib" "-Wl,-Bdynamic" "-lssl" "-lcrypto" "-lssl" "-lcrypto" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib" "-o" "/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/build/fdo-data-formats-bf1975f18618981e/build_script_build-bf1975f18618981e" "-Wl,--gc-sections" "-pie" "-nodefaultlibs"
|   = note: /build/tmp/hosttools/ld: skipping incompatible /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/librt.so when searching for -lrt
|           /build/tmp/hosttools/ld: skipping incompatible /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libpthread.so when searching for -lpthread
|           /build/tmp/hosttools/ld: skipping incompatible /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libm.so when searching for -lm
|           /build/tmp/hosttools/ld: skipping incompatible /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libm.a when searching for -lm
|           /build/tmp/hosttools/ld: skipping incompatible /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libc.so when searching for -lc
|           /build/tmp/hosttools/ld: skipping incompatible /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libc.a when searching for -lc
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.05.rcgu.o): in function `std::panicking::try':
|           std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h25bb5507765a386fE+0x1c): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h25bb5507765a386fE+0x3a): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h25bb5507765a386fE+0x89): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.05.rcgu.o): in function `std::panicking::try':
|           std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x76): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0xa5): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0xbd): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0xde): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0xe6): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x12c): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x15b): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x173): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x194): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x19c): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x239): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x268): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x280): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x2a1): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x2ac): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x656): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x683): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x69a): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x6b9): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x6c1): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x706): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x733): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x74a): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x769): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x771): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x80a): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x837): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x84a): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x869): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h5a6b229d2ca35f54E+0x874): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.05.rcgu.o): in function `std::panicking::try':
|           std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h92f19a5ef925ea80E+0x23): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17h92f19a5ef925ea80E+0x51): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.05.rcgu.o): in function `std::panicking::try':
|           std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17had0c3735ffdb3288E+0x23): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17had0c3735ffdb3288E+0x51): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.05.rcgu.o):std.73e5dfd667a5043f-cgu.05:(.text._ZN3std9panicking3try17hf12ee7985023519bE+0x1c): more undefined references to `pthread_setspecific' follow
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.10.rcgu.o): in function `std::sys::unix::thread::guard::init':
|           std.73e5dfd667a5043f-cgu.10:(.text._ZN3std3sys4unix6thread5guard4init17hf751097bef06342aE+0x5e): undefined reference to `pthread_getattr_np'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.10:(.text._ZN3std3sys4unix6thread5guard4init17hf751097bef06342aE+0x8f): undefined reference to `pthread_attr_getstack'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.01.rcgu.o): in function `std::sys::common::thread_local::os_local::Key<T>::get':
|           std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h037a620794dbaa01E+0x14): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h037a620794dbaa01E+0x2c): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h037a620794dbaa01E+0x53): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h037a620794dbaa01E+0xa8): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h037a620794dbaa01E+0xe1): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.01.rcgu.o): in function `std::sys::common::thread_local::os_local::Key<T>::get':
|           std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h49bfe8d845ee02eeE+0x14): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h49bfe8d845ee02eeE+0x2c): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h49bfe8d845ee02eeE+0x54): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h49bfe8d845ee02eeE+0xb1): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h49bfe8d845ee02eeE+0xfd): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.01.rcgu.o): in function `std::sys::common::thread_local::os_local::Key<T>::get':
|           std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h4c935fdbf138cd69E+0x18): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h4c935fdbf138cd69E+0x30): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h4c935fdbf138cd69E+0x55): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h4c935fdbf138cd69E+0xc7): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17h4c935fdbf138cd69E+0xf1): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.01.rcgu.o): in function `std::sys::common::thread_local::os_local::Key<T>::get':
|           std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17hb973d2e734d58f72E+0x18): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17hb973d2e734d58f72E+0x30): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17hb973d2e734d58f72E+0x55): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17hb973d2e734d58f72E+0xd6): undefined reference to `pthread_setspecific'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.01:(.text._ZN3std3sys6common12thread_local8os_local12Key$LT$T$GT$3get17hb973d2e734d58f72E+0x10b): undefined reference to `pthread_getspecific'
|           /build/tmp/hosttools/ld: /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-linux/lib/libstd-e7724688093bf9ba.rlib(std-e7724688093bf9ba.std.73e5dfd667a5043f-cgu.04.rcgu.o): in function `std::sys_common::thread_local_key::StaticKey::lazy_init':
|           std.73e5dfd667a5043f-cgu.04:(.text._ZN3std10sys_common16thread_local_key9StaticKey9lazy_init17hdff62e0f9809fde3E+0x1b): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.04:(.text._ZN3std10sys_common16thread_local_key9StaticKey9lazy_init17hdff62e0f9809fde3E+0x41): undefined reference to `pthread_key_create'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.04:(.text._ZN3std10sys_common16thread_local_key9StaticKey9lazy_init17hdff62e0f9809fde3E+0x54): undefined reference to `pthread_key_delete'
|           /build/tmp/hosttools/ld: std.73e5dfd667a5043f-cgu.04:(.text._ZN3std10sys_common16thread_local_key9StaticKey9lazy_init17hdff62e0f9809fde3E+0x6b): undefined reference to `pthread_key_delete'
|           collect2: error: ld returned 1 exit status
| 
|   = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
|   = note: use the `-l` flag to specify native libraries to link
|   = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
| 
| warning: `fdo-data-formats` (build script) generated 2 warnings (2 duplicates)
| error: could not compile `fdo-data-formats` (build script) due to previous error; 2 warnings emitted
| 
| Caused by:
|   process didn't exit successfully: `rustc --crate-name build_script_build --edition=2018 data-formats/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C metadata=bf1975f18618981e -C extra-filename=-bf1975f18618981e --out-dir /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/build/fdo-data-formats-bf1975f18618981e -C linker=/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/wrapper/build-rust-ccld -L dependency=/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps --extern openssl_kdf=/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/build/target/release/deps/libopenssl_kdf-7a7a2f949b4a394a.rlib -L native=/build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib` (exit status: 1)
| warning: build failed, waiting for other jobs to finish...
|     Building [=================>       ] 135/183: regex-syntax, num-derive,...
| warning: `tss-esapi-sys` (build script) generated 2 warnings (2 duplicates)
|     Building [=================>       ] 136/183: regex-syntax, num-derive,...
| warning: `num-derive` (lib) generated 2 warnings (2 duplicates)
|     Building [=================>       ] 137/183: regex-syntax, serde, serd...
| warning: `openssl` (lib) generated 2 warnings (2 duplicates)
|     Building [=================>       ] 138/183: regex-syntax, serde, serd...
| warning: `regex-syntax` (lib) generated 2 warnings (2 duplicates)
|     Building [=================>       ] 139/183: serde, serde, regex
| warning: `serde` (lib) generated 2 warnings (2 duplicates)
|     Building [==================>      ] 140/183: serde, regex
| warning: `serde` (lib) generated 2 warnings (2 duplicates)
|     Building [==================>      ] 141/183: regex
| warning: `regex` (lib) generated 2 warnings (2 duplicates)
| WARNING: exit code 101 from a shell command.

The found files are aarch64 ELF files:

$ file /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libm.so 
    /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/usr/lib/libm.so: symbolic link to ../../lib/libm.so.6
$ file /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/lib/libm.so.6
    /build/tmp/work/cortexa53-custom-linux/fdo-test/1.0.AUTOINC+068346128f-r0/recipe-sysroot/lib/libm.so.6: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=bccc5d867c6f63823c5f13059065ee5956e2f0ad, for GNU/Linux 3.14.0, with debug_info, not stripped

Steps to reproduce

I've created the .bb recipe using cargo-bitbake at first for fdo-client-linuxapp but after it threw errors during compilation of fdo-data i've decided to nail it's proper build process first so thats what im currently troubleshooting.

  • create .bb recipe from fdo-data using cargo-bitbake
  • add
DEPENDS += " openssl tpm2-tss clang"
RDEPENDS_${PN} += "openssl"

add patch for crate openssl-kdf:

SRC_URI += "file://openssl-kdf_test_patch.patch;patchdir=${WORKDIR};striplevel=0"
--- cargo_home/bitbake/openssl-kdf-0.4.1/build.rs	1973-11-29 21:33:09.000000000 +0000
+++ openssl_kdf	2023-09-20 09:23:40.287589561 +0000
@@ -28,14 +28,14 @@
         let openssl_version = openssl.version;
         if openssl_version.starts_with("1.") {
             // Determine if this version of OpenSSL has the requisite patch backported
-            let kdf_h_cts = std::fs::read_to_string("/usr/include/openssl/kdf.h").unwrap();
+            let kdf_h_cts = std::fs::read_to_string("/build/tmp/work/cortexa53-custom-linux/fdo-data/0.4.12.AUTOINC+068346128f-r0/recipe-sysroot/usr/include/openssl/kdf.h").unwrap();
             if kdf_h_cts.contains("KDF_CTX_new_id") {
                 available_implementations.push(Implementation::Ossl11);
             }
         } else if openssl_version.starts_with("3.") {
             available_implementations.push(Implementation::Ossl3);
             let core_names_h =
-                std::fs::read_to_string("/usr/include/openssl/core_names.h").unwrap();
+                std::fs::read_to_string("/build/tmp/work/cortexa53-custom-linux/fdo-data/0.4.12.AUTOINC+068346128f-r0/recipe-sysroot/usr/include/openssl/core_names.h").unwrap();
             if core_names_h.contains("OSSL_KDF_PARAM_KBKDF_R") {
                 println!("cargo:rustc-cfg=ossl3_supported=\"kbkdf_r\"");
             }

I've tried using openssl vendored but the error remains. I've also tried overwriting the TARGET_SYS to point to aarch64-unknown-linux-gnu but to no avail.

Any insights, guidance, or pointers would be greatly appreciated.

@tym2k1
Copy link
Author
tym2k1 commented Jan 5, 2024

Fixed by adding

# By default pkg-config variables point to aarch64 libraries which are picked up
# during x86_64 builds, this causes aarch64 include directories and linker
# search paths to into x86_64 builds, causing problems.
#
# Host libraries already use absolute paths so set sysroot to /
export PKG_CONFIG_SYSROOT_DIR="/"
export PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${RECIPE_SYSROOT_NATIVE}/usr/share/pkgconfig"
export PKG_CONFIG_LIBDIR="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig"
export PKG_CONFIG_DIR="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig"

# Those variables are handled internally by pkg-config crate.
# All paths are relative to sysroot, so set PKG_CONFIG_SYSROOT_DIR
# The PKG_CONFIG_*_{TARGET} needs underscores in it's triple instead of hyphens

export PKG_CONFIG_TARGET_VAR = "${@d.getVar('TARGET_SYS').replace('-','_')}"

do_compile:prepend() {
    export PKG_CONFIG_SYSROOT_DIR_${PKG_CONFIG_TARGET_VAR}="${RECIPE_SYSROOT}"
    export PKG_CONFIG_PATH_${PKG_CONFIG_TARGET_VAR}="${RECIPE_SYSROOT}/usr/lib/pkgconfig:${RECIPE_SYSROOT}/usr/share/pkgconfig"
    export PKG_CONFIG_LIBDIR_${PKG_CONFIG_TARGET_VAR}="${RECIPE_SYSROOT}/usr/lib/pkgconfig"
    export PKG_CONFIG_DIR_${PKG_CONFIG_TARGET_VAR}="${RECIPE_SYSROOT}/usr/lib/pkgconfig"
}

@tym2k1 tym2k1 closed this as completed Jan 5, 2024
@codyps
Copy link
Member
codyps commented Jan 5, 2024

This seems like something that should be integrated into oe-core or meta-rust directly, at least as a .inc or similar so everyone doesn't need to write the same thing.

I am really suspicious of export PKG_CONFIG_SYSROOT_DIR="/" as that seems like it could bust the RECIPE_SYSROOT_NATIVE isolation, but I haven't examined closely. The other bits looks fairly reasonable.

@codyps codyps reopened this Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants