I am attempting to incorporate parts of the chirpstack-gateway-os build into my own Yocto image. I had this working with v3, and I think I have worked out what I need to build everything in v4, except for an error in the cargo-native compile phase. I do not see this problem in the chirpstack-gateway-os build, only in my build. I have reconciled settings and I cannot determine what is different.
Here is the error in my build of cargo-native:
Error loading target specification: Could not find specification for target “x86_64-linux”. Run rustc --print target-list for a list of built-in targets
This is in response to the compile command (leaving out some of the path):
The difference is --target x86_64-linux vs. --target x86_64-unknown-linux-gnu . I do not understand why my build is using x86_64-linux, which is not in the result of the rustc ---print target-list command suggested in the error.
I am building with MACHINE = raspberrypi4-64, but I have successfully built the chirpstack-gateway-os image using that same setting.
I am fairly familiar with Yocto, but not rust or the rust layer. Can anyone point me in the right direction or explain why my image might be using x86_64-linux instead of x86_64-unknown-linux-gnu?
I have been able to get the rust build completed by adding release 1.66.1 to the official meta-rust layer. Pull request here (in the fix-kirkstone branch).
The next issue is with building paho-mqtt-sys during the chirpstack-mqtt-forwarder build, which fails with the error below. I am able to build the forwarder for the target platform aarch64 using the development Docker container, so for now I am removing it from my image build and manually moving it over once the OS is installed.
| debug:CMake output dir: /home/doug/os-build/build/tmp-glibc/work/cortexa72-oe-linux/chirpstack-mqtt-forwarder/4.0.0-r0/build/target/aarch64-oe-linux/release/build/paho-mqtt-sys-83b91adb360f1ce0/out
| debug:link Using SSL library
| debug:Using Paho C library at: /home/doug/os-build/build/tmp-glibc/work/cortexa72-oe-linux/chirpstack-mqtt-forwarder/4.0.0-r0/build/target/aarch64-oe-linux/release/build/paho-mqtt-sys-83b91adb360f1ce0/out/lib [paho-mqtt3as]
| debug:Using Paho C headers at: /home/doug/os-build/build/tmp-glibc/work/cortexa72-oe-linux/chirpstack-mqtt-forwarder/4.0.0-r0/build/target/aarch64-oe-linux/release/build/paho-mqtt-sys-83b91adb360f1ce0/out/include
| debug:Using bindgen for Paho C
| debug:clang version: clang version 14.0.3 (https://github.com/llvm/llvm-project 1f9140064dfbfb0bbda8e51306ea51080b2f7aac)
| debug:bindgen include path: -I/home/doug/os-build/build/tmp-glibc/work/cortexa72-oe-linux/chirpstack-mqtt-forwarder/4.
| --- stderr
| fatal: not a git repository (or any of the parent directories): .git
| /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
| /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found, err: true
| thread 'main' panicked at 'Unable to generate bindings: ()', /home/doug/os-build/build/tmp-glibc/work/cortexa72-oe-linux/chirpstack-mqtt-forwarder/4.0.0-r0/cargo_home/bitbake/paho-mqtt-sys-0.8.0/build.rs:195:14
| stack backtrace:
| 0: rust_begin_unwind
| 1: core::panicking::panic_fmt
| 2: core::result::unwrap_failed
| 3: core::result::Result<T,E>::expect
| 4: build_script_build::bindings::place_bindings
| 5: build_script_build::build::main
| 6: build_script_build::main
| 7: core::ops::function::FnOnce::call_once
| note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The next issue is with building paho-mqtt-sys during the chirpstack-mqtt-forwarder build, which fails with the error below.
It looks like the real error is /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found. Could it be that you are missing a dependency? I usually use the Debian package index to find to which package a missing file belongs:
Ah, yes – I did see that error but was assuming the missing file was something in the Yocto or recipe side of things. I changed my Dockerfile package install from gcc to gcc-multilib and it works.
The pull request I submitted to meta-rust (not the one in openembedded-core) adds Rust v1.66.1 to Kirkstone. That patch has now been merged into master. I am successfully building Chirpstack rust binaries in my image using the meta-rust layer.
I will likely stay on Kirkstone for a while, as I get tired of chasing Yocto releases.
It’s outdated, as there have been Yocto as well as Chirpstack updates that are not part of the image. However, I have used the same concept with the Kirkstone release and the latest version of Chirpstack recipes.
I would like to say I’ll update my example, but time is very short for me these days. Feel free to ask questions, though (probably best to do so in a new thread).