Hello, Trying to build simple Rust app, which contains a basic build.rs that triggers cmake to build cmake based c "Hello World" app: use cmake::Config; fn main() { // test_cmake_cpp - is the cmake c "hello world". let _dst = Config::new("test_cmake_cpp") .define("CMAKE_VERBOSE_MAKEFILE:BOOL", "ON") .define("CMAKE_SYSTEM_PROCESSOR", "aarch64") .define("CMAKE_HOST_SYSTEM_PROCESSOR", "x86_64") .very_verbose(false) .build(); } $ source /opt/poky/5.0.7_lts-mixins/environment-setup-cortexa57-poky-linux $ cargo build ... running: cd "/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-1fd237dd4f54f48a/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/home/adi/workspace/test_cmake/test_cmake_cpp" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" "-DCMAKE_SYSTEM_PROCESSOR=aarch64" "-DCMAKE_HOST_SYSTEM_PROCESSOR=x86_64" "-DCMAKE_TOOLCHAIN_FILE=/opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake" "-DCMAKE_INSTALL_PREFIX=/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-1fd237dd4f54f48a/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -pipe -feliminate-unused-debug-types" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -pipe -feliminate-unused-debug-types" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -pipe -feliminate-unused-debug-types" "-DCMAKE_BUILD_TYPE=Debug" -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: /opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc -- Check for working C compiler: /opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc - broken -- Configuring incomplete, errors occurred! --- stderr CMake Error at /opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "/opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: '/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-1fd237dd4f54f48a/out/build/CMakeFiles/CMakeScratch/TryCompile-Umye6e' Run Build Command(s): /opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E env VERBOSE=1 /opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/bin/make -f Makefile cmTC_ae83d/fast /opt/poky/5.0.7_lts-mixins/sysroots/x86_64-pokysdk-linux/usr/bin/make -f CMakeFiles/cmTC_ae83d.dir/build.make CMakeFiles/cmTC_ae83d.dir/build make[1]: Entering directory '/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-1fd237dd4f54f48a/out/build/CMakeFiles/CMakeScratch/TryCompile-Umye6e' make[1]: *** [CMakeFiles/cmTC_ae83d.dir/build.make:77: CMakeFiles/cmTC_ae83d.dir/testCCompiler.c.o] Segmentation fault (core dumped) make[1]: Leaving directory '/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-1fd237dd4f54f48a/out/build/CMakeFiles/CMakeScratch/TryCompile-Umye6e' make: *** [Makefile:127: cmTC_ae83d/fast] Error 2 ... Trying to build just the cmake "hello world" works ok (is cross compiled and can run on target). If I try to cargo build a simple rust app, builds ok and runs on target. The issue is happening when combining both (cargo -> build.rs -> cmake). The issue is always reproducible. Using: poky (scarthgap) meta-clang (scarthgap) meta-lts-mixins (scarthgap) meta-raspberrypi (scarthgap) All branches are up-to-date. Host PC: Linux archlinux 6.12.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 18 Jan 2025 02:26:57 +0000 x86_64 GNU/Linux
Are you able to reproduce the issue using just oe-core master and not using any mixin layers?
Yes, on master without lts mixins, still fails: ``` ❯ which cargo /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/cargo ❯ cargo build Compiling shlex v1.3.0 Compiling cc v1.2.10 Compiling cmake v0.1.53 Compiling test_cmake v0.1.0 (/home/adi/workspace/test_cmake) error: failed to run custom build command for `test_cmake v0.1.0 (/home/adi/workspace/test_cmake)` Caused by: process didn't exit successfully: `/home/adi/workspace/test_cmake/target/debug/build/test_cmake-3491091b33afdfed/build-script-build` (exit status: 101) --- stdout CMAKE_TOOLCHAIN_FILE_x86_64-pokysdk-linux-gnu = None CMAKE_TOOLCHAIN_FILE_x86_64_pokysdk_linux_gnu = None HOST_CMAKE_TOOLCHAIN_FILE = None CMAKE_TOOLCHAIN_FILE = Some("/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake") CMAKE_GENERATOR_x86_64-pokysdk-linux-gnu = None CMAKE_GENERATOR_x86_64_pokysdk_linux_gnu = None HOST_CMAKE_GENERATOR = None CMAKE_GENERATOR = None CMAKE_PREFIX_PATH_x86_64-pokysdk-linux-gnu = None CMAKE_PREFIX_PATH_x86_64_pokysdk_linux_gnu = None HOST_CMAKE_PREFIX_PATH = None CMAKE_PREFIX_PATH = None CMAKE_x86_64-pokysdk-linux-gnu = None CMAKE_x86_64_pokysdk_linux_gnu = None HOST_CMAKE = None CMAKE = None running: cd "/home/adi/workspace/test_cmake/target/debug/build/test_cmake-bafe7d4b371f08f6/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/home/adi/workspace/test_cmake/test_cmake_cpp" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" "-DCMAKE_SYSTEM_PROCESSOR=aarch64" "-DCMAKE_HOST_SYSTEM_PROCESSOR=x86_64" "-DCMAKE_TOOLCHAIN_FILE=/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake" "-DCMAKE_INSTALL_PREFIX=/home/adi/workspace/test_cmake/target/debug/build/test_cmake-bafe7d4b371f08f6/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -pipe" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -pipe" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -pipe" "-DCMAKE_BUILD_TYPE=Debug" -- The C compiler identification is GNU 14.2.0 -- The CXX compiler identification is GNU 14.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc -- Check for working C compiler: /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc - broken -- Configuring incomplete, errors occurred! --- stderr CMake Error at /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: '/home/adi/workspace/test_cmake/target/debug/build/test_cmake-bafe7d4b371f08f6/out/build/CMakeFiles/CMakeScratch/TryCompile-D0oJKU' Run Build Command(s): /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E env VERBOSE=1 /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/make -f Makefile cmTC_3503a/fast /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/make -f CMakeFiles/cmTC_3503a.dir/build.make CMakeFiles/cmTC_3503a.dir/build make[1]: Entering directory '/home/adi/workspace/test_cmake/target/debug/build/test_cmake-bafe7d4b371f08f6/out/build/CMakeFiles/CMakeScratch/TryCompile-D0oJKU' make[1]: *** [CMakeFiles/cmTC_3503a.dir/build.make:80: CMakeFiles/cmTC_3503a.dir/testCCompiler.c.o] Segmentation fault (core dumped) make[1]: Leaving directory '/home/adi/workspace/test_cmake/target/debug/build/test_cmake-bafe7d4b371f08f6/out/build/CMakeFiles/CMakeScratch/TryCompile-D0oJKU' make: *** [Makefile:134: cmTC_3503a/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) thread 'main' panicked at /home/adi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.53/src/lib.rs:1121:5: command did not execute successfully, got: exit status: 1 build script failed, must exit now note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
Actually the build command should have been: ❯ cargo build --target=aarch64-poky-linux-gnu the output is still simillar.
I think this maybe is caused by cargo using wrong compiler (instead of aarch64-poky-linux-gcc): strace output: 41801 execve("/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/lib/rustlib/x86_64-pokysdk-linux-gnu/bin/x86_64-pokysdk-linux-gcc", ["x86_64-pokysdk-linux-gcc", "/tmp/rustc0N8on8/symbols.o", "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "/home/adi/workspace/test_cmake/target/debug/build/"..., "-Wl,--as-needed", "-L", "/home/adi/workspace/test_cmake/target/debug/deps", "-L", "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "-Wl,-Bstatic", "/home/adi/workspace/test_cmake/target/debug/deps/l"..., "/home/adi/workspace/test_cmake/target/debug/deps/l"..., "/home/adi/workspace/test_cmake/target/debug/deps/l"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "/opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/li"..., "-Wl,-Bdynamic", "-lgcc_s", ...], 0x7260ac101f10 /* 129 vars */) = -1 ENOENT (No such file or directory)
Adrian, Thanks for the additional info about the behaviour on master and some debugging. Unless you'd like to work on the issue, I'll give it to our (fairly busy) toolchain team next week some time.
Sure, fine by me, if I find anything I'll write here.
Forgot to mention, following variables i added in local.conf: MACHINE ?= "qemuarm64" SDK_TOOLCHAIN_LANGS += " rust" CLANGSDK = "1" TOOLCHAIN_TARGET_TASK:append = " libclang dbus dbus-dev libc6-dev" TOOLCHAIN_HOST_TASK:append = " nativesdk-bindgen-cli nativesdk-make" IMAGE_INSTALL:append = " openssh openssh-sshd openssh-scp libgcc dbus dbus-dev"
Building rust crate aws-lc-sys (which uses bindgen and cmake) seems to be building successfully. cargo build --target=aarch64-poky-linux-gnu maybe there is something wrong that i am doing on my small test project.
Sundeep, this is in your court.
Sure Randy, we will look into it and post our analysis.
I tried to reproduce the issue in oe-core master by adding the specified layers and variables to local.conf and building the SDK. However, when I appended "nativesdk-bindgen-cli" to TOOLCHAIN_HOST_TASK, I encountered the following error: "Missing or unbuildable dependency chain was: ['core-image-minimal', 'buildtools-tarball', 'nativesdk-bindgen-cli']." I then built the SDK without it using the command "bitbake core-image-minimal -c do_populate_sdk" and ran the cargo build in the SDK environment: ❯ which cargo /home/15735/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/cargo ❯ cargo build --target=aarch64-poky-linux-gnu Compiling shlex v1.3.0 Compiling cc v1.2.14 Compiling cmake v0.1.54 Compiling test_check v0.1.0 (/home/15735/test_check) Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.12s It built without any errors. @Adrian Pop Can you please let me know which build you are testing? Also, I'm unclear about the Rust application files (aside from build.rs). Could you provide more information on them? A link to a Github repository or gist would be very helpful.
Added gist https://gist.github.com/adrianalin/e469c7fa8d7028800afd7e543efbbe2b Indeed on master it works on my side as well. On scarthgap branch I am getting the above mentioned errors. Not sure what I previously did wrong so the build failed on master.
We tried again to reproduce the issue without any success, by including the meta-lts-mixins layer (which we skipped in the last run). Please find the below poky build config along with the all the layers added (as specified above). Build Configuration: BB_VERSION = "2.8.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "aarch64-poky-linux" MACHINE = "qemuarm64" DISTRO = "poky" DISTRO_VERSION = "5.0.7" TUNE_FEATURES = "aarch64 crc cortexa57" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "scarthgap:ce9f4eaaae324ef4182a39293f3a6b2aa7207680" meta-clang = "scarthgap:8c77b427408db01b8de4c04bd3d247c13c154f92" meta-lts-mixins = "scarthgap/rust:1793a1b8fc92cf8688c72b7fd4181e3a2f5ade55" meta-raspberrypi = "scarthgap:923ac579c78ca42d425c303c34b65e199470ef67" We can observe that the command "cargo build --target=aarch64-poky-linux" is generating the below directory structure as expected. -> tree -L 4 . ├── Cargo.lock ├── Cargo.toml ├── src │ ├── build.rs │ ├── CMakeLists.txt │ ├── main.c │ └── main.rs └── target ├── aarch64-poky-linux-gnu │ ├── CACHEDIR.TAG │ └── debug │ ├── build │ ├── deps │ ├── examples │ ├── incremental │ ├── test_cmake │ └── test_cmake.d ├── CACHEDIR.TAG └── debug ├── build ├── deps ├── examples └── incremental 13 directories, 10 files The details of generated executable for the target is as below, -> file target/aarch64-poky-linux-gnu/debug/test_cmake target/aarch64-poky-linux-gnu/debug/test_cmake: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=5d6cf437b2b762dcee88db3ef292efb55c966480, for GNU/Linux 5.15.0, with debug_info, not stripped
The project tree should be: ❯ tree -L 4 . ├── Cargo.lock ├── Cargo.toml ├── build.rs ├── src │ └── main.rs └── test_cmake_cpp ├── CMakeLists.txt └── main.c ❯ source /opt/poky/scarthgap_mixins/environment-setup-cortexa57-poky-linux ❯ which cargo /opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/bin/cargo ❯ cargo clean && cargo build -vv --target=aarch64-poky-linux-gnu ... --- stderr CMake Error at /opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "/opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: '/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-57bc7b4e006715a5/out/build/CMakeFiles/CMakeScratch/TryCompile-l1hl5z' Run Build Command(s): /opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E env VERBOSE=1 /opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/bin/make -f Makefile cmTC_ca4f4/fast /opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/bin/make -f CMakeFiles/cmTC_ca4f4.dir/build.make CMakeFiles/cmTC_ca4f4.dir/build make[1]: Entering directory '/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-57bc7b4e006715a5/out/build/CMakeFiles/CMakeScratch/TryCompile-l1hl5z' /bin/sh: symbol lookup error: /opt/poky/scarthgap_mixins/sysroots/x86_64-pokysdk-linux/usr/bin/../../lib/libc.so.6: undefined symbol: __nptl_change_stack_perm, version GLIBC_PRIVATE make[1]: *** [CMakeFiles/cmTC_ca4f4.dir/build.make:77: CMakeFiles/cmTC_ca4f4.dir/testCCompiler.c.o] Error 127 make[1]: Leaving directory '/home/adi/workspace/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-57bc7b4e006715a5/out/build/CMakeFiles/CMakeScratch/TryCompile-l1hl5z' make: *** [Makefile:127: cmTC_ca4f4/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) thread 'main' panicked at /home/adi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.53/src/lib.rs:1121:5: command did not execute successfully, got: exit status: 1 build script failed, must exit now note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Poky build config: workspace/yocto-rpi-scarthgap/build ❯ bitbake core-image-base -c populate_sdk WARNING: Host distribution "arch" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution. Loading cache: 100% |############################################################################################################################################| Time: 0:00:00 Loaded 1962 entries from dependency cache. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "2.8.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "arch" TARGET_SYS = "aarch64-poky-linux" MACHINE = "qemuarm64" DISTRO = "poky" DISTRO_VERSION = "5.0.7" TUNE_FEATURES = "aarch64 crc cortexa57" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "scarthgap:ce9f4eaaae324ef4182a39293f3a6b2aa7207680" meta-clang = "scarthgap:8c77b427408db01b8de4c04bd3d247c13c154f92" meta-raspberrypi = "scarthgap:6df7e028a2b7b2d8cab0745dc0ed2eebc3742a17" meta-lts-mixins = "scarthgap/rust:c3f299f49bee998bd01a6953154f6906b0df4b58" WARNING: Your host glibc version (2.41) is newer than that in uninative (2.40). Disabling uninative so that sstate is not corrupted. Sstate summary: Wanted 1 Local 1 Mirrors 0 Missed 0 Current 3061 (100% match, 100% complete)####################################################### | ETA: 0:00:00 Initialising tasks: 100% |#######################################################################################################################################| Time: 0:00:02 NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 6834 tasks of which 6834 didn't need to be rerun and all succeeded. Summary: There were 2 WARNING messages.
Important to have this in build.rs https://gist.github.com/adrianalin/e469c7fa8d7028800afd7e543efbbe2b#file-build-rs-L45 ,I don't get it how it built successfully.
Pushed entire project that I'm using to test https://github.com/adrianalin/test_rust_cmake_yoctosdk Please use this for reproducing the issue.
Thank you for sharing the correct project tree for reproducing the issue. The issue is reproduced now. Could you please use "cargo.real build" command to build the project and let us know the results? For us, we didn't encounter the above errors but it failed while creating a directory during one of the cmake commands as follows (maybe since we don't have root access on our working machine): --- stderr ---CMAKE_HOST_SYSTEM_PROCESSOR: unknown ---CMAKE_SYSTEM_PROCESSOR: aarch64 CMake Error at cmake_install.cmake:60 (file): file cannot create directory: /home/adi. Maybe need administrative privileges. gmake: *** [Makefile:103: install] Error 1 thread 'main' panicked at /home/sdk/sysroots/core2-64-poky-linux/home/cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.53/src/lib.rs:1121:5: command did not execute successfully, got: exit status: 2 It tries to create a dir at home path via following cmd in cmake_install.cmake:60 : file(INSTALL DESTINATION "/home/adi" TYPE EXECUTABLE FILES "/home/user_abc/15735/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-92b80e12c468f880/out/build/tutorial") It seems this issue is similar to one reported in https://bugzilla.yoctoproject.org/show_bug.cgi?id=15579. The cargo build error is seen because of the wrapper present in cargo recipe. I believe it should work fine without the wrapper.
The install error happens because https://github.com/adrianalin/test_rust_cmake_yoctosdk/blob/main/test_cmake_cpp/CMakeLists.txt#L16 , you can update this line to some valid path.
As you mentioned this works ok: cargo clean && cargo.real build -vv --target=aarch64-poky-linux-gnu
I checked the "cargo clean && cargo build --target=aarch64-poky-linux-gnu" without the wrapper and it works fine. (cargo wrapper- https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/rust/cargo_1.75.0.bb?h=scarthgap#n52) Could you please confirm that removing the wrapper works for you as mentioned above?
On master https://github.com/yoctoproject/poky/blob/master/meta/recipes-devtools/rust/cargo_1.81.0.bb#L52 the wrapper is still created but as I tested, the build is ok on master (with the cargo wrapper). On scarthgap I just used the cargo.real instead of cargo wrapper, and the build works ok. Just to be clear, should I removed the line https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/rust/cargo_1.75.0.bb?h=scarthgap#n52 and do a clean rebuild of the SDK on scarthap branch, and retry?
Yes, you can remove that line and perform a clean rebuild of the SDK on the scarthgap branch. Also, can this issue be closed if the issues are resolved?
(In reply to Adrian Pop from comment #21) > On master > https://github.com/yoctoproject/poky/blob/master/meta/recipes-devtools/rust/ > cargo_1.81.0.bb#L52 the wrapper is still created but as I tested, the build > is ok on master (with the cargo wrapper). I did a fresh SDK build and the issue is reproduced with the wrapper on master as well. Can you also try with a clean SDK build for master perhaps using newly cloned oe-core sources? I guess the saved sstate cache of previous builds may not have triggered the failure in master. > > On scarthgap I just used the cargo.real instead of cargo wrapper, and the > build works ok. > > Just to be clear, should I removed the line > https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/rust/cargo_1.75. > 0.bb?h=scarthgap#n52 and do a clean rebuild of the SDK on scarthap branch, > and retry? Please let me know if removing the wrapper or using "cargo.real" resolves the issue for your application and this issue can be closed.
@Yash: We've other issues as well with that wrapper. Can you get the details of that wrapper function for what reason it was added and is it still valid? The wrapper removal is not a proper solution, we should analyze it's use case along with it's applicability on latest sources.
The sdk build on master I do in a totally separate directory (different than scarthgap dir): workspace/yocto-rpi/build took 2m19s ❯ bitbake core-image-base -c populate_sdk WARNING: Host distribution "arch" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution. Loading cache: 100% | | ETA: --:--:-- Loaded 0 entries from dependency cache. Parsing recipes: 100% |###########################################################################################| Time: 0:00:10 Parsing of 971 .bb files complete (0 cached, 971 parsed). 1944 targets, 229 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "2.9.1" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "arch" TARGET_SYS = "aarch64-poky-linux" MACHINE = "qemuarm64" DISTRO = "poky" DISTRO_VERSION = "5.1" TUNE_FEATURES = "aarch64 crc cortexa57" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "master:65e773f88b78ece2b4f4e117a0ce9ee5e84e6464" meta-clang = "master:84ce79bdf75e38b1d703339140e3611de15c344e" meta-raspberrypi = "master:b58e2af8598037d03cb7d8d9d6bb89a67f474146" WARNING: Your host glibc version (2.41) is newer than that in uninative (2.40). Disabling uninative so that sstate is not corrupted. Sstate summary: Wanted 3106 Local 0 Mirrors 0 Missed 3106 Current 0 (0% match, 0% complete)############# | ETA: 0:00:00 Initialising tasks: 100% |########################################################################################| Time: 0:00:01 NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 6503 tasks of which 0 didn't need to be rerun and all succeeded. Summary: There were 2 WARNING messages. test_cmake on main [?] is 📦 v0.1.0 ❯ which cargo /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/cargo test_cmake on main [?] is 📦 v0.1.0 ❯ file /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/cargo /opt/poky/5.1/sysroots/x86_64-pokysdk-linux/usr/bin/cargo: Bourne-Again shell script, ASCII text executable test_cmake on main [?] is 📦 v0.1.0 ❯ cargo clean && cargo build --target=aarch64-poky-linux-gnu Removed 137 files, 34.0MiB total Compiling shlex v1.3.0 Compiling cc v1.2.12 Compiling cmake v0.1.53 Compiling test_cmake v0.1.0 (/home/adi/workspace/test_cmake) warning: unused import: `cc` --> build.rs:1:5 | 1 | use cc; | ^^ | = note: `#[warn(unused_imports)]` on by default warning: `test_cmake` (build script) generated 1 warning Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.84s test_cmake on main [?] is 📦 v0.1.0 ❯ file target/aarch64-poky-linux-gnu/debug/test_cmake target/aarch64-poky-linux-gnu/debug/test_cmake: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=22436fc6a171d3aa751e94c6052bb304dbdd4518, for GNU/Linux 5.15.0, with debug_info, not stripped As you see, on master, the cargo bash wrapper is still used. I confirm that on scarthgap, removing the wrapper, and using cargo.real fixes the build.
(In reply to Sundeep Kokkonda from comment #24) > @Yash: > We've other issues as well with that wrapper. Can you get the details of > that wrapper function for what reason it was added and is it still valid? > The wrapper removal is not a proper solution, we should analyze it's use > case along with it's applicability on latest sources. https://git.openembedded.org/openembedded-core/commit/?id=388e7cac9f90e79ce8c3c1683d8ee0f4df1bc907 The cargo wrapper was introduced to work around conflicts with host system libraries, particularly observed in Tumbleweed-ty-3 by always adding /lib/ to the LD_LIBRARY_PATH during SDK builds. Currently, on latest sources Tumbleweed is not included in the list of tested distributions: https://git.openembedded.org/openembedded-core/commit/?id=388e7cac9f90e79ce8c3c1683d8ee0f4df1bc907 It was removed due to maintenance challenges: https://git.yoctoproject.org/yocto-autobuilder2/commit/?id=96e82ce670c02b166398500435c2df455b09b951 Richard didn't want to drop the wrapper, as it could potentially lead to issues with new combinations of host and nativesdk glibc. https://lists.openembedded.org/g/openembedded-core/message/210089 There is no mention of a proper reproducer for the issue that lead to the addition of the wrapper. So, to determine whether the wrapper is still necessary, I tested some cargo builds in the SDK environment without the wrapper using the openSUSE Leap 15.5 Docker image. The cargo builds completed successfully without any errors.
(In reply to Adrian Pop from comment #25) > The sdk build on master I do in a totally separate directory (different than > scarthgap dir): > > . > . > . > As you see, on master, the cargo bash wrapper is still used. I am not sure what's happening in your case but I can still reproduce the error on master. Build Configuration: BB_VERSION = "2.9.1" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "aarch64-poky-linux" MACHINE = "qemuarm64" DISTRO = "poky" DISTRO_VERSION = "5.1" TUNE_FEATURES = "aarch64 crc cortexa57" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "master:8f69906d5ed64f2fa94ebe2f7215e5087bf1e6df" meta-raspberrypi = "master:923ac579c78ca42d425c303c34b65e199470ef67" meta-clang = "master:93dec321980091b8abfa1f7d72c50b844c63167c" -> which cargo /home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/bin/cargo -> cargo clean && cargo build --target=aarch64-poky-linux-gnu Removed 0 files Compiling shlex v1.3.0 Compiling cc v1.2.14 Compiling cmake v0.1.54 Compiling test_cmake v0.1.0 (/home/m15735/test_cmake) warning: unused import: `cc` --> build.rs:1:5 | 1 | use cc; | ^^ | = note: `#[warn(unused_imports)]` on by default warning: `test_cmake` (build script) generated 1 warning error: failed to run custom build command for `test_cmake v0.1.0 (/home/m15735/test_cmake)` Caused by: process didn't exit successfully: `/home/m15735/test_cmake/target/debug/build/test_cmake-822f7893b14e940b/build-script-build` (exit status: 101) --- stdout CMAKE_TOOLCHAIN_FILE_aarch64-poky-linux-gnu = None CMAKE_TOOLCHAIN_FILE_aarch64_poky_linux_gnu = None TARGET_CMAKE_TOOLCHAIN_FILE = None CMAKE_TOOLCHAIN_FILE = Some("/home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake") CMAKE_GENERATOR_aarch64-poky-linux-gnu = None CMAKE_GENERATOR_aarch64_poky_linux_gnu = None TARGET_CMAKE_GENERATOR = None CMAKE_GENERATOR = None CMAKE_PREFIX_PATH_aarch64-poky-linux-gnu = None CMAKE_PREFIX_PATH_aarch64_poky_linux_gnu = None TARGET_CMAKE_PREFIX_PATH = None CMAKE_PREFIX_PATH = None CMAKE_aarch64-poky-linux-gnu = None CMAKE_aarch64_poky_linux_gnu = None TARGET_CMAKE = None CMAKE = None running: cd "/home/m15735/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-92b80e12c468f880/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/home/m15735/test_cmake/test_cmake_cpp" "-DCMAKE_TOOLCHAIN_FILE=/home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake" "-DCMAKE_INSTALL_PREFIX=/home/m15735/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-92b80e12c468f880/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -pipe" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -pipe" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -pipe" "-DCMAKE_BUILD_TYPE=Debug" -- The C compiler identification is GNU 14.2.0 -- The CXX compiler identification is GNU 14.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: /home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc -- Check for working C compiler: /home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc - broken -- Configuring incomplete, errors occurred! --- stderr CMake Error at /home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "/home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: '/home/m15735/test_cmake/target/aarch64-poky-linux-gnu/debug/build/test_cmake-92b80e12c468f880/out/build/CMakeFiles/CMakeScratch/TryCompile-UIxQNf' Run Build Command(s): /home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_3d40d/fast /usr/bin/gmake: symbol lookup error: /home/m15735/msdk/sysroots/x86_64-pokysdk-linux/usr/bin/../../lib/libc.so.6: undefined symbol: __tunable_is_initialized, version GLIBC_PRIVATE CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) thread 'main' panicked at /folk/user_abc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.54/src/lib.rs:1119:5: command did not execute successfully, got: exit status: 1 build script failed, must exit now note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace > > I confirm that on scarthgap, removing the wrapper, and using cargo.real > fixes the build. Thank you for confirming.
Duplicate of https://bugzilla.yoctoproject.org/show_bug.cgi?id=15579 The root cause of this SDK failure was identified as the use of a wrapper in the cargo recipe: https://git.openembedded.org/openembedded-core/commit/?id=388e7cac9f90e79ce8c3c1683d8ee0f4df1bc907 https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/rust/cargo_1.89.0.bb#n51 This wrapper was introduced to address conflicts with host system libraries, specifically in Tumbleweed-based systems (e.g., Tumbleweed-ty-3), by appending /lib/ to LD_LIBRARY_PATH during SDK builds. However, Tumbleweed is no longer part of the officially tested distributions in the Yocto AB due to maintenance challenges: https://git.yoctoproject.org/yocto-autobuilder2/tree/config.py?id=694d2a9bae523d9396b37da9cc6535a558e04d81#n168 https://git.yoctoproject.org/yocto-autobuilder2/commit/?id=96e82ce670c02b166398500435c2df455b09b951 Complete build tests were performed with the wrapper removed and no regressions or issues were observed. A patch was proposed to drop the wrapper. https://lists.openembedded.org/g/openembedded-core/message/210088 https://lists.openembedded.org/g/openembedded-core/message/210089 Although the wrapper is currently retained to mitigate potential issues with combinations of host and nativesdk glibc, an alternative fix is to use the 'cargo.real' binary instead of the wrapped cargo when building projects within the SDK. *** This bug has been marked as a duplicate of bug 15579 ***