[yocto] how to include a static library in SDK?
Jovic, Vladimir
vladimir.jovic at ifm.com
Wed Mar 29 01:37:11 PDT 2017
Hello,
I have a recipe that creates a static library. The directory is as follows:
example-staticlib/
example-staticlib/example-staticlib_0.1.bb
example-staticlib/files/
example-staticlib/files/lib.c
example-staticlib/files/lib.h
example-staticlib/files/Makefile
Files content is:
1. example-staticlib_0.1.bb :
DESCRIPTION = "example stared library"
LICENSE = "LGPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/LGPL-2.0;md5=9427b8ccf5cf3df47c29110424c9641a"
SRC_URI = "file://lib.c \
file://lib.h \
file://Makefile"
PR = "r0"
S = "${WORKDIR}"
ALLOW_EMPTY_${PN} = "1"
do_install () {
oe_runmake install DEST=${D}
}
TOOLCHAIN_TARGET_TASK += "example-staticlib-dev"
TOOLCHAIN_TARGET_TASK += "example-staticlib-staticdev"
2. lib.c
int foo()
{
return 42;
}
3. lib.h
int foo();
4. Makefile
TARGET=libexample.a
all:$(TARGET)
install :
@install -d $(DEST)/usr/lib/
@install -m 0644 $(TARGET) $(DEST)/usr/lib/
@install -d $(DEST)/usr/include/
@install -m 0644 lib.h $(DEST)/usr/include/
$(TARGET) : lib.c
$(CC) -c lib.c -o lib.o
$(AR) rcs $@ lib.o
clean:
rm -rf lib.o $(TARGET)
When I do:
bitbake core-image-minimal -c populate_sdk
I can see that the library and the header are in build/tmp/sysroot
but when I call the generated script in build/tmp/deploy/sdk/ to install the sdk, I can see that the library is not installed in the sdk sysroot. The header is there, but the static library is not.
I also tried adding this to local.conf:
EXTRA_IMAGE_FEATURES += "staticdev-pkgs"
but that also didn't install the library.
The only thing that worked is:
IMAGE_INSTALL += "example-staticlib-staticdev"
but I would like not to have to do it that way.
So, what exactly do I need to do to get a static library installed in SDK?
Cheers,
Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170329/9babbafa/attachment.html>
More information about the yocto
mailing list