static libraries missing from sdk
Hello,
I have a problem providing a static library in the SDK:
I have a recipe that builds a library. It outputs an -dev pkg with the /usr/{include,lib} libs in it and a -staticdev pkg with the static library. The main pkg is empty, in my recipe I have added ALLOW_EMPTY_${PN} = "1" because the -dev and -staticdev depend on it
In my local.conf I have added:
SDKIMAGE_FEATURES += "dev-pkgs dbg-pkgs staticdev-pkgs"
Then I run
bitbake my-image -c populate_sdk
After installing the SDK, I get the headers (from the -dev pkg) but not the static library from the -staticdev pkg.
Why is that ? From my understanding specifying staticdev-pkgs in the SDKIMAGE_FEATURE should have this covered.
I was able to "force" the install of the -staticdev pks by adding to local.conf:
TOOLCHAIN_TARGET_TASK_append = " mylibrary-staticdev"
Do you have to manually take care of this ? Then, what's the purpose of SDKIMAGE_FEATURES += " staticdev-pkgs" ? I would like to have all static libraries in the SDK.
Thanks and regards
Hi,
Quoted 15 lines · Mircea Gliga
Hello,
I have a problem providing a static library in the SDK:
I have a recipe that builds a library. It outputs an -dev pkg with the/usr/{include,lib}libs in it and a -staticdev pkg with the static library. The main pkg is empty, in my recipe I have added ALLOW_EMPTY_${PN} = "1" because the -dev and -staticdev depend on itIn my local.conf I have added:
SDKIMAGE_FEATURES+= "dev-pkgs dbg-pkgs staticdev-pkgs"Then I run
bitbake my-image -cpopulate_sdk
After installing the SDK, I get the headers (from the -dev pkg) but not the static library from the -staticdev pkg.Why is that ? From my understanding specifying staticdev-pkgs in the
SDKIMAGE_FEATUREshould have this covered.
Quoted 8 lines
I was able to "force" the install of the -staticdev pks by adding to local.conf:
TOOLCHAIN_TARGET_TASK_append= " mylibrary-staticdev"Do you have to manually take care of this ? Then, what's the purpose of
SDKIMAGE_FEATURES+= " staticdev-pkgs" ? I would like to have all static libraries in the SDK.Thanks and regards
This sounds like:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11724
Quoted 3 lines
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).
Quoted 35 lines · Robert Berger
Hi,
Quoted 15 lines · Mircea Gliga
Hello,
I have a problem providing a static library in the SDK:
I have a recipe that builds a library. It outputs an -dev pkg with the/usr/{include,lib}libs in it and a -staticdev pkg with the static library. The main pkg is empty, in my recipe I have added ALLOW_EMPTY_${PN} = "1" because the -dev and -staticdev depend on itIn my local.conf I have added:
SDKIMAGE_FEATURES+= "dev-pkgs dbg-pkgs staticdev-pkgs"Then I run
bitbake my-image -cpopulate_sdk
After installing the SDK, I get the headers (from the -dev pkg) but not the static library from the -staticdev pkg.Why is that ? From my understanding specifying staticdev-pkgs in the
SDKIMAGE_FEATUREshould have this covered.Quoted 8 lines
I was able to "force" the install of the -staticdev pks by adding to local.conf:
TOOLCHAIN_TARGET_TASK_append= " mylibrary-staticdev"Do you have to manually take care of this ? Then, what's the purpose of
SDKIMAGE_FEATURES+= " staticdev-pkgs" ? I would like to have all static libraries in the SDK.Thanks and regards
This sounds like:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11724
Quoted 3 lines
Hi,
Quoted 6 lines · Mircea Gliga
Thanks for your answer.
I already have the ALLOW_EMPTY_${PN} = "1" in the recipeWhat 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?
What should be on the rootfs? I guess the .so
You can check the contents of your packages with:
oe-pkgdata-util list-pkg-files -p <package-name>
How do you build your stuff? autotools?
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 thisDISABLE_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" # <--
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.clibhw-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?
----
Regards,
Robert
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:
Quoted 6 lines · Robert Berger
Hi,
Quoted 3 lines · Mircea Gliga
Thanks for your answer.
I already have the ALLOW_EMPTY_${PN} = "1" in the recipe
Quoted 8 lines
Quoted 5 lines
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
Quoted 2 lines
What should be on the rootfs? I guess the .so
Nothing regarding this package.
Quoted 4 lines
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
Quoted 2 lines
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.
Quoted 12 lines
I needed to do the following in my recipe with autotools:
# By default
EXTRA_OECONFis set to --disable-static ...
# Let's get rid of thisDISABLE_STATIC= ""EXTRA_OECONF:= "${@oe_filter_out('--disable-static', '${EXTRA_OECONF}', d)}"# enable static and disable shared (for fun) EXTRA_OECONF += "--enable-static --enable-shared"----
Quoted 7 lines
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 ?
Quoted 28 lines
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.clibhw-so-a-dev:
/usr/include/lib_hw.h
/usr/lib/libhw.so
libhw-so-a-staticdev:
/usr/lib/libhw.ain the rootfs:
./usr/lib/libhw.so.0./usr/lib/libhw.so.0.0.0in 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
Quoted 4 lines
./opt/poky/2.4/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/lib_hw.hCan you cook up an example where we can see/reproduce your problem?
Is the above enough ?
Quoted 7 lines
----
Regards,
Robert
Regards
Hi,
OK I think I understood.
You want a static library and apparently .h and friends as well as the .a file should end up in the SDK and nothing on the rootfs.
If you enable staticdev-pkgs in the SDKIMAGE_FEATURES *all* the staticdev pkgs should end up in the SDK (I assume), but you need to use TOOLCHAIN_TARGET_TASK_append = " fmt-staticdev" for the .a file to show up in the SDK.
You use a cmake project and try to build https://github.com/fmtlib/fmt.
Regards,
Robert
Hi,
On 2018-02-07 16:01, Mircea Gliga wrote:
With this line you try to add -dev (.so), -dbg and staticdev (.a) for **all** packages:
Quoted 1 line
SDKIMAGE_FEATURES+= "dev-pkgs dbg-pkgs staticdev-pkgs"
I am not sure it makes sense to build and add both the static and dynamic libs to an SDK.
Do you really want this?
Regards,
Robert
Hi,
I played around a bit with my autotooled lib, which produces only a static lib.
1) My preferred approach is this:
I add to local.conf:
TOOLCHAIN_TARGET_TASK_append = " libhw-a-staticdev libhw-a-dev"
The recipe looks like this:
2) But your approach works as well:
I add to local.conf:
# we need to add the empty package to the rootfs for # IMAGE_FEATURES_append to work: IMAGE_INSTALL_append = " libhw-a" # add all -dev, -dbg, -staticdev pkgs to the SDK (only): SDKIMAGE_FEATURES_append = " dev-pkgs dbg-pkgs staticdev-pkgs"
The recipe looks like this:
(needed to slightly modify my original recipe)
On the rootfs there is nothing with respect to this recipe.
In the SDK are:
./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/include/lib_hw.h
Regards,
Robert
Hi
Quoted 1 line
I am not sure it makes sense to build and add both the static and dynamic libs to an SDK.
The idea is that I want everything that is needed to build the app in the SDK and I don't want to individually specify what goes in because it's error prone and you can forget something. Some pkgs could have dynamic libs other could have static libs ...
See below further comments.
Thanks for your help!
Quoted 14 lines · Robert Berger
Hi,
I played around a bit with my autotooled lib, which produces only a static lib.
1) My preferred approach is this:
I add to local.conf:
TOOLCHAIN_TARGET_TASK_append= " libhw-a-staticdev libhw-a-dev"The recipe looks like this:
Quoted 7 lines
2) But your approach works as well:
I add to local.conf:
# we need to add the empty package to the rootfs for # IMAGE_FEATURES_append to work: IMAGE_INSTALL_append = " libhw-a"
That's what I've been missing... I need to add the empty main pkg in the image and then the static library ends up in the SDK - because the SDK it's build upon the image... It's not a perfect scenario... First you have to create the empty main pkg using ALLOW_EMPTY then install the empty pkg in the image...
Quoted 19 lines
# add all -dev, -dbg, -staticdev pkgs to the SDK (only): SDKIMAGE_FEATURES_append = " dev-pkgs dbg-pkgs staticdev-pkgs"The recipe looks like this:
(needed to slightly modify my original recipe)On the rootfs there is nothing with respect to this recipe.
In the SDK are:
./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/include/lib_hw.hRegards,
Robert