问题
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).
回答1:
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}
}
来源:https://stackoverflow.com/questions/59741817/how-do-you-properly-build-gpiod-applications-from-yocto