Help: Bindgen, with CMake and Yocto SDK, C compiler - Broken when

Howdy,

I am working on packaging the azure-iot-sdk-c for rust. The work was based on existing work made by a community member. Which was forked here.

The project target an amv7 processor and therefore, a yocto SDK was generated. The config.toml specify the rootfs and linked:

[target.armv7-unknown-linux-gnueabihf]
linker="arm-poky-linux-gnueabi-gcc"
ar="arm-poky-linux-gnueabi-ar"

rustflags = [
    "-C", "link-arg=-march=armv7",
    "-C", "link-arg=-mfloat-abi=hard",
    "-C", "link-arg=-mthumb",
    "-C", "link-arg=-mfpu=neon-vfpv4",
    "-C", "link-arg=-mfloat-abi=hard",
    "-C", "link-arg=-mcpu=cortex-a5",
    "-C", "link-arg=--sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-agsolar-linux-gnueabi",
]

When starting the build I source the yocto sdk environment file. Then call $ cargo build --target armv7-unknown-linux-gnueabihf.

The build then fails:

error: failed to run custom build command for `azure-iot-rs-sys v0.0.0 (/home/user/workspace/azure-iot-rs-sys)`

Caused by:
  process didn't exit successfully: `/home/user/workspace/azure-iot-rs-sys/target/debug/build/azure-iot-rs-sys-dd8f230217101d41/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=wrapper.h
  cargo:rerun-if-changed=build.rs
  cargo:rustc-link-search=native=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib
  cargo:rustc-link-lib=uuid
  cargo:rustc-link-search=native=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib
  cargo:rustc-link-lib=ssl
  cargo:rustc-link-lib=crypto
  cargo:rustc-link-search=native=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib
  cargo:rustc-link-lib=curl

  running: cd "/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/home/user/workspace/azure-iot-rs-sys/azure-iot-sdk-c" "-Duse_edge_modules=ON" "-DCMAKE_SYSTEM_NAME=Linux" "-DCMAKE_SYSTEM_PROCESSOR=arm" "-DCMAKE_INSTALL_PREFIX=/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv7-a -mfpu=vfpv3-d16 -pipe -feliminate-unused-debug-types" "-DCMAKE_C_COMPILER=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv7-a -mfpu=vfpv3-d16 -pipe -feliminate-unused-debug-types" "-DCMAKE_CXX_COMPILER=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv7-a -mfpu=vfpv3-d16 -pipe -feliminate-unused-debug-types" "-DCMAKE_ASM_COMPILER=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc" "-DCMAKE_BUILD_TYPE=Debug"
  -- Toolchain file defaulted to '/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake'
  -- The C compiler identification is GNU 11.2.0
  -- The CXX compiler identification is GNU 11.2.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
  -- Check for working C compiler: /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc - broken
  -- Configuring incomplete, errors occurred!
  See also "/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/CMakeOutput.log".
  See also "/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  CMake Error at /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
    The C compiler

      "/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: /home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/CMakeTmp
      
      Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_5c143/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_5c143.dir/build.make CMakeFiles/cmTC_5c143.dir/build
      gmake[1]: Entering directory '/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/CMakeTmp'
      Building C object CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o
      /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi   -O2 -pipe -g -feliminate-unused-debug-types   -o CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o -c /home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
      Linking C executable cmTC_5c143
      /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5c143.dir/link.txt --verbose=1
      /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi  -O2 -pipe -g -feliminate-unused-debug-types   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  -Wl,-z,relro,-z,now  CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o -o cmTC_5c143 
      /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: error: cmTC_5c143 uses VFP register arguments, CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o does not
      /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: failed to merge target specific data of file CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o
      collect2: error: ld returned 1 exit status
      gmake[1]: *** [CMakeFiles/cmTC_5c143.dir/build.make:99: cmTC_5c143] Error 1
      gmake[1]: Leaving directory '/home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp'
      gmake: *** [Makefile:127: cmTC_5c143/fast] Error 2

CMakeOutput.log:

The target system is: Linux -  - cortexa5t2hf-neon-vfpv4-agsolar
The host system is: Linux - 5.15.0-56-generic - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc 
Build flags: ;-O2;-pipe;-g;-feliminate-unused-debug-types;
Id flags: -c 

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"

The C compiler identification is GNU, found in "/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/3.22.3/CompilerIdC/CMakeCCompilerId.o"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ 
Build flags: ;-O2;-pipe;-g;-feliminate-unused-debug-types;
Id flags: -c 

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o"

The CXX compiler identification is GNU, found in "/home/user/workspace/azure-iot-rs-sys/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-sys-e762df3e497105be/out/build/CMakeFiles/3.22.3/CompilerIdCXX/CMakeCXXCompilerId.o"

CMakeError.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc 
Build flags: ;-O2;-pipe;-g;-feliminate-unused-debug-types;
Id flags:  

The output was:
1
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find Scrt1.o: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find crti.o: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find crtbeginS.o: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find -lgcc: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find -lgcc_s: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find -lc: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find -lgcc: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find -lgcc_s: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find crtendS.o: No such file or directory
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

Detecting C compiler ABI info failed to compile with the following output:
Change Dir: /home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_e80c7/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_e80c7.dir/build.make CMakeFiles/cmTC_e80c7.dir/build
gmake[1]: Entering directory '/home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi   -O2 -pipe -g -feliminate-unused-debug-types     -v -o CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o -c /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c
Using built-in specs.
COLLECT_GCC=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
Target: arm-poky-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-11.2.0-r0/gcc-11.2.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --bindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --sbindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --libexecdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi --datadir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/com --localstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/var --libdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi --includedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/workdir/meta-poky/build-microchip/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/11.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-default-pie --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --disable-install-libiberty --disable-libssp --enable-libitm --enable-lto --disable-bootstrap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/11.2.0 --with-build-time-tools=/workdir/meta-poky/build-microchip/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/11.2.0-r0/recipe-sysroot-native/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/not/exist --with-build-sysroot=/workdir/meta-poky/build-microchip/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/11.2.0-r0/recipe-sysroot --enable-standard-branch-protection --enable-poison-system-directories --disable-static --enable-nls --with-glibc-version=2.28 --enable-initfini-array
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-O2' '-pipe' '-g' '-feliminate-unused-debug-types' '-v' '-o' 'CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o' '-c' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-mlibarch=armv5t' '-march=armv5t' '-dumpdir' 'CMakeFiles/cmTC_e80c7.dir/'
 /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/cc1 -quiet -v -isysroot /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_e80c7.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mcpu=arm10tdmi -mtls-dialect=gnu -marm -mlibarch=armv5t -march=armv5t -g -O2 -version -feliminate-unused-debug-types -o - |
 /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/as -v -march=armv5t -meabi=5 -o CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o
GNU assembler version 2.38 (arm-poky-linux-gnueabi) using BFD version (GNU Binutils) 2.38.20220313
GNU C17 (GCC) version 11.2.0 (arm-poky-linux-gnueabi)
	compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/11.2.0/include"
ignoring nonexistent directory "/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/local/include"
ignoring nonexistent directory "/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/../../../../../arm-poky-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/include
 /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/include-fixed
 /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/
End of search list.
GNU C17 (GCC) version 11.2.0 (arm-poky-linux-gnueabi)
	compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 7994d289578098be2268888ae5a0a192
COMPILER_PATH=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/
LIBRARY_PATH=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/lib/:/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/
COLLECT_GCC_OPTIONS='-O2' '-pipe' '-g' '-feliminate-unused-debug-types' '-v' '-o' 'CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o' '-c' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-mlibarch=armv5t' '-march=armv5t' '-dumpdir' 'CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.'
Linking C executable cmTC_e80c7
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e80c7.dir/link.txt --verbose=1
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi  -O2 -pipe -g -feliminate-unused-debug-types   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  -Wl,-z,relro,-z,now -v CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o -o cmTC_e80c7 
Using built-in specs.
COLLECT_GCC=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/lto-wrapper
Target: arm-poky-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-11.2.0-r0/gcc-11.2.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --bindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --sbindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --libexecdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi --datadir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/com --localstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/var --libdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi --includedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/workdir/meta-poky/build-microchip/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/11.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-default-pie --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --disable-install-libiberty --disable-libssp --enable-libitm --enable-lto --disable-bootstrap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/11.2.0 --with-build-time-tools=/workdir/meta-poky/build-microchip/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/11.2.0-r0/recipe-sysroot-native/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/not/exist --with-build-sysroot=/workdir/meta-poky/build-microchip/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/11.2.0-r0/recipe-sysroot --enable-standard-branch-protection --enable-poison-system-directories --disable-static --enable-nls --with-glibc-version=2.28 --enable-initfini-array
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (GCC) 
COMPILER_PATH=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/
LIBRARY_PATH=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/lib/:/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/11.2.0/:/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/
COLLECT_GCC_OPTIONS='-O2' '-pipe' '-g' '-feliminate-unused-debug-types' '-v' '-o' 'cmTC_e80c7' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-mlibarch=armv5t' '-march=armv5t' '-dumpdir' 'cmTC_e80c7.'
 /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/collect2 -plugin /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/liblto_plugin.so -plugin-opt=/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccH2ShEh.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi --build-id --eh-frame-hdr --hash-style=gnu -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -pie -o cmTC_e80c7 /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/Scrt1.o /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/crti.o /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/11.2.0/crtbeginS.o -L/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0 -L/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/lib -L/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/11.2.0 -L/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib -O1 --hash-style=gnu --as-needed -z relro -z now CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/11.2.0/crtendS.o /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/crtn.o
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: error: cmTC_e80c7 uses VFP register arguments, CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o does not
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: failed to merge target specific data of file CMakeFiles/cmTC_e80c7.dir/CMakeCCompilerABI.c.o
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_e80c7.dir/build.make:99: cmTC_e80c7] Error 1
gmake[1]: Leaving directory '/home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_e80c7/fast] Error 2

Determining if the C compiler works failed with the following output:
Change Dir: /home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_5c143/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_5c143.dir/build.make CMakeFiles/cmTC_5c143.dir/build
gmake[1]: Entering directory '/home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi   -O2 -pipe -g -feliminate-unused-debug-types   -o CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o -c /home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_5c143
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5c143.dir/link.txt --verbose=1
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi  -O2 -pipe -g -feliminate-unused-debug-types   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  -Wl,-z,relro,-z,now  CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o -o cmTC_5c143 
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: error: cmTC_5c143 uses VFP register arguments, CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o does not
/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/real-ld: failed to merge target specific data of file CMakeFiles/cmTC_5c143.dir/testCCompiler.c.o
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_5c143.dir/build.make:99: cmTC_5c143] Error 1
gmake[1]: Leaving directory '/home/user/workspace/azure-iot-rs-bindgen/target/armv7-unknown-linux-gnueabihf/debug/build/azure-iot-rs-bindgen-e762df3e497105be/out/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_5c143/fast] Error 2

The binaries listed in the CMakeError.log, does exist in the sdk at both localtion:

  • /opt/poky/sdk/sysroots/x86_64-agsolarsdk-linux/usr/lib
  • /opt/poky/sdk/sysroots/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/usr/lib

The cortex path is already in the cargo:rustc-link-search=native, so it should find the libraries.

Any input on what could be wrong?

Thanks

The command that's failing has nothing to do with cargo or rust, so I don't think setting the search path via cargo will help you. You probably need to set the search paths on cmake rather than[1] via cargo


  1. or possibly in addition to ↩ī¸Ž

One thing I forgot to mention. I am able to cross-compile azure-iot-sdk-c manually with the same sdk without any issue. That`s why I confident that the issue comes from something missing or broken in my cargo/rustc configuration.

If you run the cmake command that the log shows failed exactly as is, does it work? I don't see anything specifying search paths in that command, but I don't have a lot of experience with cmake.

When I source the yocto sdk environment there's OE_CMAKE_TOOLCHAIN_FILE=OEToolchainConfig.cmake.

That defines the followin:

set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE )
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS}  CACHE STRING "" FORCE )
set( CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE )
set( CMAKE_SYSROOT $ENV{OECORE_TARGET_SYSROOT} )

set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )

set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}")

# Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os).
if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+")
  set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
endif()

# Include the toolchain configuration subscripts
file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_FILE}.d/*.cmake" )
foreach(config ${toolchain_config_files})
    include(${config})
endforeach()

Thanks for helping out :slight_smile:

Turns out that rust's cmake librarie needs CMAKE_TOOLCHAIN_FILE environment to work correctly with the yocto SDK

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.