All of lore.kernel.org
 help / color / mirror / Atom feed
* how to include a static library in SDK?
@ 2017-03-29  8:37 Jovic, Vladimir
  2017-03-29  9:27 ` Burton, Ross
  2017-03-29 13:11 ` Anders Darander
  0 siblings, 2 replies; 3+ messages in thread
From: Jovic, Vladimir @ 2017-03-29  8:37 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 20432 bytes --]

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

* Re: how to include a static library in SDK?
  2017-03-29  8:37 how to include a static library in SDK? Jovic, Vladimir
@ 2017-03-29  9:27 ` Burton, Ross
  2017-03-29 13:11 ` Anders Darander
  1 sibling, 0 replies; 3+ messages in thread
From: Burton, Ross @ 2017-03-29  9:27 UTC (permalink / raw)
  To: Jovic, Vladimir; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

On 29 March 2017 at 09:37, Jovic, Vladimir <vladimir.jovic@ifm.com> wrote:

> I also tried adding this to local.conf:
>
> EXTRA_IMAGE_FEATURES += “staticdev-pkgs”
>
> but that also didn’t install the library.
>
>
That's for regular images, to control the SDK you want SDKIMAGE_FEATURES.
SDKIMAGE_FEATURES_append = " staticdev-pkgs" in the image recipe will get
all static libraries into the SDK.

Ross

[-- Attachment #2: Type: text/html, Size: 1190 bytes --]

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

* Re: how to include a static library in SDK?
  2017-03-29  8:37 how to include a static library in SDK? Jovic, Vladimir
  2017-03-29  9:27 ` Burton, Ross
@ 2017-03-29 13:11 ` Anders Darander
  1 sibling, 0 replies; 3+ messages in thread
From: Anders Darander @ 2017-03-29 13:11 UTC (permalink / raw)
  To: yocto

Hi,

* Jovic, Vladimir <vladimir.jovic@ifm.com> [170329 11:10]:

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

If you only want this staticdev package, the line above should go into
your *image* recipe, not `example-staticlib`.




> When I do:
> bitbake core-image-minimal -c populate_sdk

Did you ever add:

TOOLCHAIN_TARGET_TASK += "example-staticlib-staticdev"

to core-image-minimal.bb or core-image-minimal.bbappend?

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

Like Ross stated, if you want *all* staticdev packages, you need to add

SDKIMAGE_FEATURES += "staticdev-pkgs"


Cheers,
Anders

-- 
Anders Darander, Senior System Architect
ChargeStorm AB / eStorm AB


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

end of thread, other threads:[~2017-03-29 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29  8:37 how to include a static library in SDK? Jovic, Vladimir
2017-03-29  9:27 ` Burton, Ross
2017-03-29 13:11 ` Anders Darander

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.