I am trying to incorporate a CPLD programming utility on Github available at https://github.com/kontron/altera-stapl into my Yocto build but am getting undefined references to gpiod functions. I have that it depends on libgpiod in my recipe. Am I specifying the dependency correctly?
Here is my recipe:
SUMMARY = "CPLD STAPL Programming"
DESCRIPTION = "A userspace port of the Altera Jam STAPL Bytecode Player."
MAINTAINER = "Michael Walle <michael.walle#kontron.com>"
HOMEPAGE = "https://github.com/kontron/altera-stapl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b"
SRC_URI = "git://github.com/kontron/altera-stapl.git"
SRCREV = "71540fb3dccf57ea0e43cef77d628244de402152"
SRC_URI[sha256sum] = "DCF8A052CD7908F484EAEE8A1924809056611E68EA28652E17C021BE836FAA6C"
DEPENDS = "libgpiod"
S="${WORKDIR}/git"
do_install () {
install -d ${D}${bindir}
install -m 0755 altera-stapl ${D}${bindir}
}
These are the linker errors I am getting (there are a lot of them, not just this one, I can post the whole log if needed)
gnueabi/gcc/arm-poky-linux-gnueabi/9.2.0/ld: altera-gpio.c:(.text+0x3f4): undefined reference to `gpiod_line_request_output'
/home/gen-ccm-root/workdir/tools/poky/build-dev/tmp/work/armv7at2hf-neon-poky-linux-gnueabi/altera-stapl/1.0-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.2.0/ld: altera-gpio.o: in function `close_jtag_hardware':
altera-gpio.c:(.text+0x4da): undefined reference to `gpiod_line_release'
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'altera-stapl' failed
What is the correct way to set the dependency?
Update: I am running Yocto Zeus on Ubuntu 18.04 (my GCC is 7.4.0).
Turns out this issue was in the Makefile that was part of the GitHub project, and was actually fixed in a recent version. In case anyone else ever wants to use this project, the final recipe is as follows (just update the SRCREV if newer versions are release):
SUMMARY = "CPLD STAPL Programming"
DESCRIPTION = "A userspace port of the Altera Jam STAPL Bytecode Player."
HOMEPAGE = "https://github.com/kontron/altera-stapl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b"
SRC_URI = "git://github.com/kontron/altera-stapl.git"
SRCREV = "852ff9d13cc06fef7d207abe12cc19ea5b67a16b"
DEPENDS = "libgpiod"
S="${WORKDIR}/git"
do_install () {
install -d ${D}${bindir}
install -m 0755 altera-stapl ${D}${bindir}
}
Related
I am cross-compiling my project from my M1 Mac for the Raspberry Pi. The project comprises circa 17Kloc and building it on the Pi exhausts available memory (and 1G of extra swap). Building it via cross compiler gets me this compiler complaint
error occurred: Failed to find tool. Is `arm-linux-gnueabihf-binutils-gcc` installed?
.. which is reasonable, because while the foreign linker package arm-linux-gnueabihf-binutils includes arm-linux-gnueabihf-binutils-ld and arm-linux-gnueabihf-binutils-ranlib as well as other familiar names, it lacks the C compiler.
But where can I get it? Not on Homebrew AFAIKS. This is a simplified reproduction of the problem.
$HOME/.cargo/config is
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-ld"
Cargo.toml is
[package]
name = "nics"
version = "0.1.0"
edition = "2021"
[dependencies]
network-interface = "0.1.3"
.. and main.rs is
use network_interface::{NetworkInterface, NetworkInterfaceConfig};
fn main() {
let nics = NetworkInterface::show().unwrap();
println!("Found {} NICs", nics.len());
for itf in nics.iter() {
println!("{:?}", itf);
}
}
Following this otherwise splendid article, I
installed the Rust target for the Raspberry Pi rustup target add armv7-unknown-linux-musleabihf
installed the linker brew install arm-linux-gnueabihf-binutils
attempted to build it for the Pi with cargo build --target armv7-unknown-linux-musleabihf
This fails saying ...
error: failed to run custom build command for `network-interface v0.1.3`
Caused by:
process didn't exit successfully: `/Users/martincowie/Development/rust/nics/target/debug/build/network-interface-77fc30e746fc938b/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("armv7-unknown-linux-musleabihf")
OPT_LEVEL = Some("0")
HOST = Some("aarch64-apple-darwin")
CC_armv7-unknown-linux-musleabihf = None
CC_armv7_unknown_linux_musleabihf = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_armv7-unknown-linux-musleabihf = None
CFLAGS_armv7_unknown_linux_musleabihf = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = None
running: "arm-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv7-a" "-mfpu=vfpv3-d16" "-Wall" "-Wextra" "-o" "/Users/martincowie/Development/rust/nics/target/armv7-unknown-linux-musleabihf/debug/build/network-interface-339c444064457e48/out/src/target/macos/ffi/lladdr.o" "-c" "src/target/macos/ffi/lladdr.c"
--- stderr
error occurred: Failed to find tool. Is `arm-linux-musleabihf-gcc` installed?
Where can I get arm-linux-musleabihf-gcc, or what more fundamental issue am I not seeing?
Installing the musl cross compiler toolchains might help you:
$ brew tap MarioSchwalbe/gcc-musl-cross
$ brew install gcc-8-musl-cross
(Disclaimer: Can't verify, don't own a Mac)
I am trying to use Bitbake tool for the cross-compilation of a Git project from x86 architecture to aarm64 architecture, but I am getting ld errors during the do_compile stage. I already checked d/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot/ and those missing files are actually exist! I don't know why bitbake complains about missing files. I also tried to add related paths to my custom recipe using FILES_${PN} = "" but this didn't help.
Also, I have glibc as a dependency in my recipe but this doesn't help:
# dependencies DEPENDS += "glibc" RDEPENDS_${PN} = "glibc"
Errors I am getting are as the following:
| ~/bin/build/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/ld: cannot find /lib/libc.so.6
| ~/bin/build/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/ld: cannot find /usr/lib/libc_nonshared.a
| ~/bin/build/tmp/work/aarch64-xilinx-linux/commandlinetool/1.0+gitAUTOINC+ce84868f3c-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/ld: cannot find /lib/ld-linux-aarch64.so.1
Edit: Here is the recipe I am using. It depends on another Git project named "deviceaccess" (which my recipe for that project cross-compiled successfully):
LICENSE = "GPLv3 & Unknown"
LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d \
file://cmake/debian_package_templates/copyright;md5=0630bd8af87d19e6a57f9d1f9c5cf11f"
SRC_URI = "git://github.com/ChimeraTK/CommandLineTools.git;protocol=https"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "ce84868f3c86f3f0790772a31fb5202a14f38fb8"
S = "${WORKDIR}/git"
# dependencies
DEPENDS += "glibc deviceaccess"
RDEPENDS_${PN} = "glibc deviceaccess"
# cmake
inherit pkgconfig cmake
FILES_${PN} = ""
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OEMAKE = ""
Scenario:
I am working with yocto linux recipes. I am trying to make a recipe which simply copies a prebuilt MyLibrary.a and its headers available on the built linux image. So, I have a libMyLibrary.a which I want to copy to /usr/lib. And MyLibrary's headers files MyLibrary.h and MyLibrary.hpp into /usr/include. Note that MyLibrary is already built and I just want to copy the binary and headers into desired locations of the built linux image.
So following is the recipe:
SUMMARY = "Script to make a static library available in yocto linux image"
LICENSE = "CLOSED"
FILES_${PN} += "${libdir}"
SRC_URI = "file://libMyLibrary.a \
file://MyLibrary..hpp \
file://MyLibrary..h \
"
S = "${WORKDIR}"
do_install () {
install -d ${D}${libdir}
install -d ${D}${includedir}
install -m 0644 ${WORKDIR}/libMyLibrary.a ${D}${libdir}/
install -m 0644 ${WORKDIR}/MyLibrary.h ${D}${includedir}/
install -m 0644 ${WORKDIR}/MyLibrary.hpp ${D}${includedir}/
}
Initially I started with getting some errors in the do_install step. I resolved them but now the do_rootfs step is complaining about my bb file that is mylibrary_1.0.bb. I am pretty sure that the parent recipe that calls my recipe has no errors since it builds a lot of other recipes and mine is just additional to it. Also, the errors started to appear after I wrote the do_install step.
Question
Can someone point out what is wrong with my recipe above?
Or is there a simple example recipe which copies a .a and its headers into the desired location i.e. /usr/lib and /usr/include like I am doing above?
Explaining what the errors are would be useful. Note that because your recipe only ships a static library and headers it won't generate a mylibrary package, which is probably what the errors are about.
I am playing a bit around with my Raspberry Pi and Yocto. I wrote a program. This is build with cmake and links against some parts of the boost library.
To keep the sd-card memory food print as small as possible I like to tell yocto, that it has only to link/build & deploy against some certain parts of the the boost library. My problem I do not know how to do this. Maybe someone can tell me.
Below I put the listing of my recipe:
SUMMARY = "mytest"
SECTION = "app"
LICENSE = "CLOSED"
inherit cmake
DEPENDS = "boost libconfig"
SRCREV = "${AUTOREV}"
SRC_URI = "git:///home/mytest/;protocol=file"
S = "${WORKDIR}/git"
I am only using from boost:
system thread program_options
As far as I see Yocto is building separate packages for the libs - like
libboost-thread1.66.0-1.66.0-r0.cortexa7hf_neon_vfpv4.rpm
The source of the boost recipe does not tell how to include the parts.
You can add the following instructions to your recipe:
DEPENDS = "boost libconfig"
RDEPENDS_${PN} = "boost-system boost-thread boost-program-options"
And it will ship only requested libs.
I am trying to write my own custom recipe. I am using Yocto Project with Bitbake.
The following package when given bitbake apriltags commands does the following and throws error at do_package
It successfully does the following tasks:
do_fetch
unpack
do_compile
and then fails at do_package
In my /yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r4/git/build/lib there is a pkgconfig.pc and libapriltags.a which is causing the error.
My package recipe:
DESCRIPTION = "Apriltags application"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r3"
DEPENDS = "opencv"
SRC_URI = "git://github.com/zafrullahsyed/apriltags.git;protocol=https;tag=v0.1"
S = "${WORKDIR}/git"
inherit pkgconfig autotools
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/git/build/bin/apriltags_demo ${D}${bindir}
}
My error as follows:
ERROR: QA Issue: package apriltags contains bad RPATH /home/zaif/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r3/git/build/lib in file /home/zaif/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r3/packages-split/apriltags/usr/bin/apriltags_demo
ERROR: QA run found fatal errors. Please consider fixing them.
ERROR: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/zaif/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/apriltags/0.1-r3/temp/log.do_package.21621
ERROR: Task 10 (/home/zaif/yocto/poky/meta-bebot/recipes-bebot/apriltags/apriltags_0.1.bb, do_package) failed with exit code '1'
The Apriltags has dependencies which need to be modified according to the machine you are working on.
You need to have the values of the requires, Libs and Cflags accordingly. Also verify whether you need the python pod packages or not.
My package Apriltags has bad dependencies that are according to PC in AprilTags/cmake/pods.cmake such as Eigen3(default), whereas for OE eigen3 package is libeigen. Hard coded the requires, Libs and Cflags and also removed python pod packages which are not required.
pods.cmake:
"Name: ${pc_name}\n"
"Description: ${pc_description}\n"
"Requires: ${libeigen}\n"
# "Version: ${pc_version}\n"
"Libs: -L\${bindir} ${pc_libs}\n"
"Cflags: -I\${bindir} ${pc_cflags}\n")
My recipe is as follows:
DESCRIPTION = "Apriltags application"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r5"
DEPENDS = "opencv"
SRC_URI = "git://github.com/zafrullahsyed/apriltags.git;protocol=https;tag=v0.3"
S = "${WORKDIR}/git"
inherit pkgconfig autotools
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/git/build/bin/apriltags_demo ${D}${bindir}
}