问题
I have a Yocto BSP with my own layer that includes an autotools
3rdy part library (libcoap).
My application ".bb" file has the following lines, telling libcoap
is needed:
DEPENDS += "libcoap"
RDEPENDDS_${PN} += " libcoap libcoap-dev libcoap-devstatic"
I can see the library files are being copied to sysroot:
$ ls -l /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap*
-rw-r--r-- 2 udev udev 286430 Ago 21 13:53 /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.a
lrwxrwxrwx 1 udev udev 173 Ago 29 14:33 /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.so -> ../../projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/libcoap/4.1.2+gitAUTOINC+d48ab449fd-r0/image/usr/lib/libcoap.so.4.1.2
-rwxr-xr-x 2 udev udev 38444 Ago 21 13:53 /projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.so.4.1.2
It is not hard to noticed that the symlink is kind of weird:
/projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/coap-playground/1.0-r0/recipe-sysroot/usr/lib/libcoap.so -> ../../projects/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/libcoap/4.1.2+gitAUTOINC+d48ab449fd-r0/image/usr/lib/libcoap.so.4.1.2
My libcoap.bb
contains inherit relative_symlinks
(otherwise an absolute link to "/projects" is created and bitbake fails) but the symlink created simply prepends "../../" to the original link.
So... the questions are:
- Why do I need
inherit relative_symlinks
? Shouldn'tmake install
create a symlink relative to sysroot out of the box?
Generated Makefile
contains:
librootdir = $(DESTDIR)$(prefix)/lib
# ...
ln -s $(librootdir)/$(LIBSO).4.1.2 $(librootdir)/$(LIBSO)
And I thought $(DESTDIR)
would already point to the correct place during bitbake
's installation...
- What is the right way to fix it? Could it be something wrong at the other side (the application trying to link against
libcoap
)?
Thanks in advance.
Resources
libcoap.bb
is based on Internet and quite simple:
SUMMARY = "A C implementation of IETF Constrained Application Protocol (RFC 7252)"
DESCRIPTION = "Libcoap provides an implementation of the IETF CoAP protocol"
HOMEPAGE = "http://sourceforge.net/projects/libcoap/"
SECTION = "libs/network"
PROVIDES = "libcoap"
SRCREV = "d48ab449fd05801e574e4966023589ed7dac500b"
# Lookout for PV bump too when SRCREV is changed
PV = "4.1.2+git${SRCPV}"
LICENSE = "GPLv2 | BSD"
LIC_FILES_CHKSUM = "file://${S}/LICENSE.BSD;md5=1164f52f9c4db2c13f681b201010d518 \
file://${S}/LICENSE.GPL;md5=4641e94ec96f98fabc56ff9cc48be14b"
S = "${WORKDIR}/git"
SRC_URI = "git://git.code.sf.net/p/libcoap/code"
inherit autotools-brokensep relative_symlinks
EXTRA_OECONF += "--with-shared"
EXTRA_OEMAKE += "all"
INSANE_SKIP_${PN} = "ldflags"
BBCLASSEXTEND = "native nativesdk"
来源:https://stackoverflow.com/questions/52098050/yocto-autotools-library-cmake-application-linker-error