[yocto] static libraries missing from sdk

Mircea Gliga mircea.gliga at vitheia.com
Wed Feb 7 06:01:32 PST 2018


Hi

This is the directory tree from the recipes packages-split/ folder, 
notice the empty main pkg, empty dbg etc

$ /usr/bin/tree
.
├── fmt
├── fmt-dbg
├── fmt-dev
│   └── usr
│       ├── include
│       │   └── fmt
│       │       ├── format.cc
│       │       ├── format.h
│       │       ├── ostream.cc
│       │       ├── ostream.h
│       │       ├── posix.h
│       │       ├── printf.h
│       │       ├── string.h
│       │       └── time.h
│       └── lib
│           └── cmake
│               └── fmt
│                   ├── fmt-config.cmake
│                   ├── fmt-config-version.cmake
│                   ├── fmt-targets.cmake
│                   └── fmt-targets-release.cmake
├── fmt-doc
├── fmt-locale
└── fmt-staticdev
     └── usr
         └── lib
             └── libfmt.a

See my notes below:


On 07/02/18 14:12, Robert Berger wrote:
> Hi,
>
> On 2018-02-07 09:46, Mircea Gliga wrote:
>> Thanks for your answer.
>> I already have the ALLOW_EMPTY_${PN} = "1" in the recipe
>>
>> What I still don't get is why the -dev gets installed but the 
>> -staticdev doesn't, even though the dependency is satisfied (the 
>> empty pkg exists).
>>
>>
> Just to understand what you are trying to do:
>
> Would like to have both .a and .so files for your library in your SDK?
I need the headers and the static library in the SDK, fmt-dev, 
fmt-staticdev
>
> What should be on the rootfs? I guess the .so
Nothing regarding this package.
>
> You can check the contents of your packages with:
>
> oe-pkgdata-util list-pkg-files -p <package-name>
$ oe-pkgdata-util list-pkg-files -p fmt
fmt:
fmt-dbg:
fmt-dev:
     /usr/include/fmt/format.cc
     /usr/include/fmt/format.h
     /usr/include/fmt/ostream.cc
     /usr/include/fmt/ostream.h
     /usr/include/fmt/posix.h
     /usr/include/fmt/printf.h
     /usr/include/fmt/string.h
     /usr/include/fmt/time.h
     /usr/lib/cmake/fmt/fmt-config-version.cmake
     /usr/lib/cmake/fmt/fmt-config.cmake
     /usr/lib/cmake/fmt/fmt-targets-release.cmake
     /usr/lib/cmake/fmt/fmt-targets.cmake
fmt-staticdev:
     /usr/lib/libfmt.a
>
> How do you build your stuff? autotools?
The pkg is compiled using cmake, hence the inherit cmake:
     FILES_${PN}-dev += "${libdir}/*"

     #we need the empty main pkg, as -dev and -staticdev depend on it = 
 > they end up in the SDK
     ALLOW_EMPTY_${PN} = "1"

     inherit cmake

It's a simple recipe, other than that it has the license info, SRC_URI, 
S vars set.

>
> I needed to do the following in my recipe with autotools:
>
> # By default EXTRA_OECONF is set to --disable-static ...
> # Let's get rid of this
> DISABLE_STATIC = ""
> EXTRA_OECONF := "${@oe_filter_out('--disable-static', 
> '${EXTRA_OECONF}', d)}"
> # enable static and disable shared (for fun)
> EXTRA_OECONF += "--enable-static --enable-shared"
>
> ----
>
> I added this to local.conf:
>
> # -->
> IMAGE_INSTALL_append = " libhw-so-a"
> # add libhw-so-a-dev and libhw-so-a-staticdev to SDK:
> TOOLCHAIN_TARGET_TASK_append = " libhw-so-a-staticdev libhw-so-a-dev"
> # <--
In my local.conf I have:
     SDKIMAGE_FEATURES += "dev-pkgs dbg-pkgs staticdev-pkgs"
There is *no*  usr/lib/libfmt.a in the SDK (no 
[...]toolchain/sysroots/cortexa5hf-neon-poky-linux-gnueabi/usr/lib/libfmt.a)

If I then add in local.conf also the following line:
     TOOLCHAIN_TARGET_TASK_append = " fmt-staticdev"

then I get the .a file in the SDK:
[...]toolchain/sysroots/cortexa5hf-neon-poky-linux-gnueabi/usr/lib/libfmt.a

Doesn't the staticdev-pkgs in the SDKIMAGE_FEATURES specify to install 
*all* the staticdev pkgs in the SDK ?
>
> That's the content of the packages produced:
>
> libhw-so-a:
>         /usr/lib/libhw.so.0
>         /usr/lib/libhw.so.0.0.0
> libhw-so-a-dbg:
>         /usr/lib/debug/usr/lib/libhw.so.0.0.0.debug
> /usr/src/debug/libhw-so-a/1.0-r0/libhw-so-a-1.0/lib/lib_hw1.c
> /usr/src/debug/libhw-so-a/1.0-r0/libhw-so-a-1.0/lib/lib_hw2.c
> libhw-so-a-dev:
>         /usr/include/lib_hw.h
>         /usr/lib/libhw.so
> libhw-so-a-staticdev:
>         /usr/lib/libhw.a
>
> in the rootfs:
>
> ./usr/lib/libhw.so.0
> ./usr/lib/libhw.so.0.0.0
>
> in the SDK:
>
> ./opt/poky/2.4/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libhw.so
> ./opt/poky/2.4/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libhw.a
> ./opt/poky/2.4/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libhw.so.0
> ./opt/poky/2.4/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libhw.so.0.0.0 
>
> ./opt/poky/2.4/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/lib_hw.h 
>
>
> Can you cook up an example where we can see/reproduce your problem?
Is the above enough ?
>
> ----
>
> Regards,
>
> Robert
>


Regards



More information about the yocto mailing list