All of lore.kernel.org
 help / color / mirror / Atom feed
* static libraries missing from sdk
@ 2018-02-06 12:53 Mircea Gliga
  2018-02-06 20:25 ` Robert Berger
  0 siblings, 1 reply; 9+ messages in thread
From: Mircea Gliga @ 2018-02-06 12:53 UTC (permalink / raw)
  To: Yocto Project

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-06 12:53 static libraries missing from sdk Mircea Gliga
@ 2018-02-06 20:25 ` Robert Berger
  2018-02-07  7:46   ` Mircea Gliga
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Berger @ 2018-02-06 20:25 UTC (permalink / raw)
  To: Mircea Gliga, Yocto Project

Hi,

On 2018-02-06 14:53, Mircea Gliga wrote:
> 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

This sounds like:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11724

> 
> 
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-06 20:25 ` Robert Berger
@ 2018-02-07  7:46   ` Mircea Gliga
  2018-02-07 12:12     ` Robert Berger
  0 siblings, 1 reply; 9+ messages in thread
From: Mircea Gliga @ 2018-02-07  7:46 UTC (permalink / raw)
  To: Robert Berger, Yocto Project

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).


On 06/02/18 22:25, Robert Berger wrote:
> Hi,
>
> On 2018-02-06 14:53, Mircea Gliga wrote:
>> 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
>
> This sounds like:
>
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=11724
>
>>
>>
>>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-07  7:46   ` Mircea Gliga
@ 2018-02-07 12:12     ` Robert Berger
  2018-02-07 14:01       ` Mircea Gliga
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Berger @ 2018-02-07 12:12 UTC (permalink / raw)
  To: Mircea Gliga, Yocto Project

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?

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 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"
# <--

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?

----

Regards,

Robert


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-07 12:12     ` Robert Berger
@ 2018-02-07 14:01       ` Mircea Gliga
  2018-02-07 16:06         ` Robert Berger
                           ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mircea Gliga @ 2018-02-07 14:01 UTC (permalink / raw)
  To: Robert Berger, Yocto Project

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-07 14:01       ` Mircea Gliga
@ 2018-02-07 16:06         ` Robert Berger
  2018-02-07 16:58         ` Robert Berger
  2018-02-07 18:56         ` Robert Berger
  2 siblings, 0 replies; 9+ messages in thread
From: Robert Berger @ 2018-02-07 16:06 UTC (permalink / raw)
  To: Mircea Gliga, Yocto Project

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-07 14:01       ` Mircea Gliga
  2018-02-07 16:06         ` Robert Berger
@ 2018-02-07 16:58         ` Robert Berger
  2018-02-07 18:56         ` Robert Berger
  2 siblings, 0 replies; 9+ messages in thread
From: Robert Berger @ 2018-02-07 16:58 UTC (permalink / raw)
  To: Mircea Gliga, Yocto Project

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:

>      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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-07 14:01       ` Mircea Gliga
  2018-02-07 16:06         ` Robert Berger
  2018-02-07 16:58         ` Robert Berger
@ 2018-02-07 18:56         ` Robert Berger
  2018-02-09 12:18           ` Mircea Gliga
  2 siblings, 1 reply; 9+ messages in thread
From: Robert Berger @ 2018-02-07 18:56 UTC (permalink / raw)
  To: Mircea Gliga, Yocto Project

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:

https://pastebin.com/YLUvQSSx

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)

https://pastebin.com/VcsqNuMf

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: static libraries missing from sdk
  2018-02-07 18:56         ` Robert Berger
@ 2018-02-09 12:18           ` Mircea Gliga
  0 siblings, 0 replies; 9+ messages in thread
From: Mircea Gliga @ 2018-02-09 12:18 UTC (permalink / raw)
  To: Robert Berger, Yocto Project

Hi


 > 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!

On 07/02/18 20:56, Robert Berger wrote:
> 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:
>
> https://pastebin.com/YLUvQSSx
>
> 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...

> # 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)
>
> https://pastebin.com/VcsqNuMf
>
> 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
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-02-09 12:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 12:53 static libraries missing from sdk Mircea Gliga
2018-02-06 20:25 ` Robert Berger
2018-02-07  7:46   ` Mircea Gliga
2018-02-07 12:12     ` Robert Berger
2018-02-07 14:01       ` Mircea Gliga
2018-02-07 16:06         ` Robert Berger
2018-02-07 16:58         ` Robert Berger
2018-02-07 18:56         ` Robert Berger
2018-02-09 12:18           ` Mircea Gliga

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.