How to get static library in sdk? -


everyone searched how include static library in sdk, surely read this thread 2014. tried suggested, didn't work.

reading yocto mega manual version 2.1 (yocto morty), found in chapter 5.9.12. (poky reference distribution changes), added disable_static variable, disable generation of static libraries. tried adding recipe, , didn't enable adding static library sdk:

disable_static = "" 

i can see library in sysroot when building image. not getting in sdk.

so, need static library , headers in sdk?


what worked adding staticdev package ´image_install´ in local.conf, don't want have that.


i created example recipe, demonstrates problem. directory structure this:

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 

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" 

lib.c:

int foo() {     return 42; } 

lib.h:

int foo(); 

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) 

how modify recipe, in order static library in sdk?

following added example.

adding following line image recipe (or .bbappend, eg core-image-minimal.bbappend)

toolchain_target_task += "example-staticlib-staticdev" 

should work you. give .a file in sdk, after running bitbake core-image-minimal -c populate_sdk. (again assuming image used core-image-minimal).

that experiment add .a file ${pn}-dev didn't work, duet order of how files put packages. order ${pn}-dbg ${pn}-staticdev ${pn}-dev ${pn}-doc ${pn}-locale ${package_before_pn} ${pn}. thus, .a file will, regardless, put ${pn}-staticdev, packages handled prior {pn}-dev.

note, add line, toolchain_target_task += "example-staticlib-staticdev" image recipe, thus, need write package name instead of pn.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -