Yocto Project Discussions
 help / color / mirror / Atom feed
* [yocto][meta-openembedded] How to properly build a lib package
@ 2024-08-07  8:47 Yann CARDAILLAC Pro
  2024-08-07  9:12 ` Alexander Kanavin
  2024-08-07  9:21 ` Mikko Rapeli
  0 siblings, 2 replies; 10+ messages in thread
From: Yann CARDAILLAC Pro @ 2024-08-07  8:47 UTC (permalink / raw)
  To: yocto

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

Hi all,

I'm working on upgrading different yocto BSPs to scarthgap, I'm having an
error that I haven't seen. It's the one described here on stack overflow by
someone else:

https://stackoverflow.com/questions/64984897/yocto-package-requires-shared-library-but-no-providers-found-in-rdepends

I have a very simple C library package that provides a shared library.

My package is looking very close to:
meta-openembedded/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
<https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb>

I don't really understand why we need to add the lib7z.so()(64bit)? Is
there a "proper" way of avoiding that as it's not so common in other libs?

I'm also not comfortable adding :
INSANE_SKIP:${PN} += "dev-so"

If any, can you point me to a simple library build that doesn't require the
(64bit) that I don't really understand nor the INSANE_SKIP ? To sum up my
need is to have a simple recipe for a shared library.

Best regards,

Yann CARDAILLAC

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

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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07  8:47 [yocto][meta-openembedded] How to properly build a lib package Yann CARDAILLAC Pro
@ 2024-08-07  9:12 ` Alexander Kanavin
  2024-08-07  9:21 ` Mikko Rapeli
  1 sibling, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2024-08-07  9:12 UTC (permalink / raw)
  To: yocto, ycnakajsph

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

Just about any recipe for libsomething in or-core. You need to find out
what is happening that is special. Is it a prebuilt binary?

Alex

On Wed 7. Aug 2024 at 11.48, Yann CARDAILLAC via lists.yoctoproject.org
<ycnakajsph=gmail.com@lists.yoctoproject.org> wrote:

> Hi all,
>
> I'm working on upgrading different yocto BSPs to scarthgap, I'm having an
> error that I haven't seen. It's the one described here on stack overflow by
> someone else:
>
>
> https://stackoverflow.com/questions/64984897/yocto-package-requires-shared-library-but-no-providers-found-in-rdepends
>
> I have a very simple C library package that provides a shared library.
>
> My package is looking very close to:
> meta-openembedded/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
> <https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb>
>
> I don't really understand why we need to add the lib7z.so()(64bit)? Is
> there a "proper" way of avoiding that as it's not so common in other libs?
>
> I'm also not comfortable adding :
> INSANE_SKIP:${PN} += "dev-so"
>
> If any, can you point me to a simple library build that doesn't require
> the (64bit) that I don't really understand nor the INSANE_SKIP ? To sum up
> my need is to have a simple recipe for a shared library.
>
> Best regards,
>
> Yann CARDAILLAC
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#63669):
> https://lists.yoctoproject.org/g/yocto/message/63669
> Mute This Topic: https://lists.yoctoproject.org/mt/107766049/1686489
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

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

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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07  8:47 [yocto][meta-openembedded] How to properly build a lib package Yann CARDAILLAC Pro
  2024-08-07  9:12 ` Alexander Kanavin
@ 2024-08-07  9:21 ` Mikko Rapeli
  2024-08-07 13:13   ` Yann CARDAILLAC Pro
  1 sibling, 1 reply; 10+ messages in thread
From: Mikko Rapeli @ 2024-08-07  9:21 UTC (permalink / raw)
  To: yocto, ycnakajsph

Hi,

On Wed, Aug 07, 2024 at 10:47:57AM +0200, Yann CARDAILLAC via lists.yoctoproject.org wrote:
> Hi all,
> 
> I'm working on upgrading different yocto BSPs to scarthgap, I'm having an
> error that I haven't seen. It's the one described here on stack overflow by
> someone else:
> 
> https://stackoverflow.com/questions/64984897/yocto-package-requires-shared-library-but-no-providers-found-in-rdepends
> 
> I have a very simple C library package that provides a shared library.
> 
> My package is looking very close to:
> meta-openembedded/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
> <https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb>
> 
> I don't really understand why we need to add the lib7z.so()(64bit)? Is
> there a "proper" way of avoiding that as it's not so common in other libs?
> 
> I'm also not comfortable adding :
> INSANE_SKIP:${PN} += "dev-so"
> 
> If any, can you point me to a simple library build that doesn't require the
> (64bit) that I don't really understand nor the INSANE_SKIP ? To sum up my
> need is to have a simple recipe for a shared library.

Please set soname correctly, see
https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

Shared libraries without soname are bad and this test correctly finds them.

Cheers,

-Mikko


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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07  9:21 ` Mikko Rapeli
@ 2024-08-07 13:13   ` Yann CARDAILLAC Pro
  2024-08-07 13:19     ` Mikko Rapeli
  0 siblings, 1 reply; 10+ messages in thread
From: Yann CARDAILLAC Pro @ 2024-08-07 13:13 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: yocto

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

Thanks for the fast reply!

- The library is *not* pre-compiled, here's the makefile rule that produce
it :

CFLAGS ?= -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-switch

shared-lib:
        $(CC) -fPIC -c $(LDFLAGS) $(CFLAGS) rj2d.c
        $(CC) $(LDFLAGS) -shared -o librj2d.so.1 rj2d.o
        ln -sf librj2d.so.1 librj2d.so

It seems ok to me, but there might be something missing?

- I don't think that the name "librj2d.so" is problematic however when I
remove the line INSANE_SKIP:${PN} += "dev-so" I get the following error:

ERROR: librj2d-1.1-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk-
package librj2d contains symlink .so '/usr/lib/librj2d.so' [dev-so]
ERROR: librj2d-1.1-r0 do_package_qa: Fatal QA errors were found, failing
task.

- Here's the recipe :

SUMMARY = "RJ2D lib"
DEPENDS = ""
LICENSE = "..."
LIC_FILES_CHKSUM = "file:/..."

SRC_URI = "git://...rj2d-lib;protocol=ssh;branch=master;"
SRCREV = "..."

S = "${WORKDIR}/git"

do_compile() {
        oe_runmake all
}

do_install() {
        install -d ${D}${libdir}
        install -m 0655 librj2d.so.1 ${D}${libdir}
        ln --relative --symbolic ${D}${libdir}/librj2d.so.1
${D}${libdir}/librj2d.so
        install -d ${D}${includedir}
        install -m 0655 rj2d.h ${D}${includedir}/rj2d.h
}


FILES:${PN} += "${libdir}/*.so"
FILES_SOLIBSDEV = ""
INSANE_SKIP:${PN} += "dev-so"

RPROVIDES:${PN} += "librj2d.so librj2d.so()(64bit)"

That's not the first time I have this kind of problem with shared libs and
yocto, so I really wish to make it right this time !

Bests,

Yann

On Wed, Aug 7, 2024 at 11:21 AM Mikko Rapeli <mikko.rapeli@linaro.org>
wrote:

> Hi,
>
> On Wed, Aug 07, 2024 at 10:47:57AM +0200, Yann CARDAILLAC via
> lists.yoctoproject.org wrote:
> > Hi all,
> >
> > I'm working on upgrading different yocto BSPs to scarthgap, I'm having an
> > error that I haven't seen. It's the one described here on stack overflow
> by
> > someone else:
> >
> >
> https://stackoverflow.com/questions/64984897/yocto-package-requires-shared-library-but-no-providers-found-in-rdepends
> >
> > I have a very simple C library package that provides a shared library.
> >
> > My package is looking very close to:
> > meta-openembedded/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
> > <
> https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
> >
> >
> > I don't really understand why we need to add the lib7z.so()(64bit)? Is
> > there a "proper" way of avoiding that as it's not so common in other
> libs?
> >
> > I'm also not comfortable adding :
> > INSANE_SKIP:${PN} += "dev-so"
> >
> > If any, can you point me to a simple library build that doesn't require
> the
> > (64bit) that I don't really understand nor the INSANE_SKIP ? To sum up my
> > need is to have a simple recipe for a shared library.
>
> Please set soname correctly, see
> https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
>
> Shared libraries without soname are bad and this test correctly finds them.
>
> Cheers,
>
> -Mikko
>

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

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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07 13:13   ` Yann CARDAILLAC Pro
@ 2024-08-07 13:19     ` Mikko Rapeli
  2024-08-07 14:14       ` Yann CARDAILLAC Pro
  0 siblings, 1 reply; 10+ messages in thread
From: Mikko Rapeli @ 2024-08-07 13:19 UTC (permalink / raw)
  To: Yann CARDAILLAC Pro; +Cc: yocto

Hi,

On Wed, Aug 07, 2024 at 03:13:31PM +0200, Yann CARDAILLAC Pro wrote:
> Thanks for the fast reply!
> 
> - The library is *not* pre-compiled, here's the makefile rule that produce
> it :
> 
> CFLAGS ?= -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-switch
> 
> shared-lib:
>         $(CC) -fPIC -c $(LDFLAGS) $(CFLAGS) rj2d.c
>         $(CC) $(LDFLAGS) -shared -o librj2d.so.1 rj2d.o
>         ln -sf librj2d.so.1 librj2d.so
> 
> It seems ok to me, but there might be something missing?
> 
> - I don't think that the name "librj2d.so" is problematic however when I
> remove the line INSANE_SKIP:${PN} += "dev-so" I get the following error:
> 
> ERROR: librj2d-1.1-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk-
> package librj2d contains symlink .so '/usr/lib/librj2d.so' [dev-so]
> ERROR: librj2d-1.1-r0 do_package_qa: Fatal QA errors were found, failing
> task.
> 
> - Here's the recipe :
> 
> SUMMARY = "RJ2D lib"
> DEPENDS = ""
> LICENSE = "..."
> LIC_FILES_CHKSUM = "file:/..."
> 
> SRC_URI = "git://...rj2d-lib;protocol=ssh;branch=master;"
> SRCREV = "..."
> 
> S = "${WORKDIR}/git"
> 
> do_compile() {
>         oe_runmake all
> }
> 
> do_install() {
>         install -d ${D}${libdir}
>         install -m 0655 librj2d.so.1 ${D}${libdir}
>         ln --relative --symbolic ${D}${libdir}/librj2d.so.1
> ${D}${libdir}/librj2d.so
>         install -d ${D}${includedir}
>         install -m 0655 rj2d.h ${D}${includedir}/rj2d.h
> }
> 
> 
> FILES:${PN} += "${libdir}/*.so"

Don't install the .so symlink to main package but to ${PN}-dev.

FILES:${PN} += "${libdir}/*.so.1"
FILES:${PN}-dev += "${libdir}/*.so"

if those are not the default, which I suspect they are.

Cheers,

-Mikko


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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07 13:19     ` Mikko Rapeli
@ 2024-08-07 14:14       ` Yann CARDAILLAC Pro
  2024-08-07 14:20         ` Mikko Rapeli
  0 siblings, 1 reply; 10+ messages in thread
From: Yann CARDAILLAC Pro @ 2024-08-07 14:14 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: yocto

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

Thanks Mikko, that was it indeed! I didn't test on target yet but it seems
ok so far!

I'm still not sure about the librj2d.so()(64bit) though any idea?

Yann CARDAILLAC,


On Wed, Aug 7, 2024 at 3:19 PM Mikko Rapeli <mikko.rapeli@linaro.org> wrote:

> Hi,
>
> On Wed, Aug 07, 2024 at 03:13:31PM +0200, Yann CARDAILLAC Pro wrote:
> > Thanks for the fast reply!
> >
> > - The library is *not* pre-compiled, here's the makefile rule that
> produce
> > it :
> >
> > CFLAGS ?= -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-switch
> >
> > shared-lib:
> >         $(CC) -fPIC -c $(LDFLAGS) $(CFLAGS) rj2d.c
> >         $(CC) $(LDFLAGS) -shared -o librj2d.so.1 rj2d.o
> >         ln -sf librj2d.so.1 librj2d.so
> >
> > It seems ok to me, but there might be something missing?
> >
> > - I don't think that the name "librj2d.so" is problematic however when I
> > remove the line INSANE_SKIP:${PN} += "dev-so" I get the following error:
> >
> > ERROR: librj2d-1.1-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk-
> > package librj2d contains symlink .so '/usr/lib/librj2d.so' [dev-so]
> > ERROR: librj2d-1.1-r0 do_package_qa: Fatal QA errors were found, failing
> > task.
> >
> > - Here's the recipe :
> >
> > SUMMARY = "RJ2D lib"
> > DEPENDS = ""
> > LICENSE = "..."
> > LIC_FILES_CHKSUM = "file:/..."
> >
> > SRC_URI = "git://...rj2d-lib;protocol=ssh;branch=master;"
> > SRCREV = "..."
> >
> > S = "${WORKDIR}/git"
> >
> > do_compile() {
> >         oe_runmake all
> > }
> >
> > do_install() {
> >         install -d ${D}${libdir}
> >         install -m 0655 librj2d.so.1 ${D}${libdir}
> >         ln --relative --symbolic ${D}${libdir}/librj2d.so.1
> > ${D}${libdir}/librj2d.so
> >         install -d ${D}${includedir}
> >         install -m 0655 rj2d.h ${D}${includedir}/rj2d.h
> > }
> >
> >
> > FILES:${PN} += "${libdir}/*.so"
>
> Don't install the .so symlink to main package but to ${PN}-dev.
>
> FILES:${PN} += "${libdir}/*.so.1"
> FILES:${PN}-dev += "${libdir}/*.so"
>
> if those are not the default, which I suspect they are.
>
> Cheers,
>
> -Mikko
>

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

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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07 14:14       ` Yann CARDAILLAC Pro
@ 2024-08-07 14:20         ` Mikko Rapeli
  2024-08-28  9:50           ` Yann CARDAILLAC Pro
  0 siblings, 1 reply; 10+ messages in thread
From: Mikko Rapeli @ 2024-08-07 14:20 UTC (permalink / raw)
  To: Yann CARDAILLAC Pro; +Cc: yocto

Hi,

On Wed, Aug 07, 2024 at 04:14:29PM +0200, Yann CARDAILLAC Pro wrote:
> Thanks Mikko, that was it indeed! I didn't test on target yet but it seems
> ok so far!
> 
> I'm still not sure about the librj2d.so()(64bit) though any idea?

I would leave all RPROVIDES for bitbake etc automation to set. I don't know
what is the reson for setting RPROVIDES manually.

Cheers,

-Mikko


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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-07 14:20         ` Mikko Rapeli
@ 2024-08-28  9:50           ` Yann CARDAILLAC Pro
  2024-08-29  7:34             ` Mikko Rapeli
  0 siblings, 1 reply; 10+ messages in thread
From: Yann CARDAILLAC Pro @ 2024-08-28  9:50 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: yocto

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

Hi Mikko,

Well without the RPROVIDES I get the following error when a package DEPENDS
on it :

ERROR: rj2d-com-1.1-r0 do_package_qa: QA Issue: /usr/bin/rj2d- com
contained in package rj2d- com requires librj2d.so()(64bit), but no
providers found in RDEPENDS:rj2d-com? [file-rdeps]

The only solution I found was to add the RPROVIDES. Is there something I'm
doing wrong?

Basically the rj2d-com package DEPENDS and RDEPENDS:${PN}  to librj2d, and
without the RPROVIDES with  librj2d.so()(64bit) I get errors.

Is there something wrong with the approach ?

Bests,

Yann

On Wed, Aug 7, 2024 at 4:20 PM Mikko Rapeli <mikko.rapeli@linaro.org> wrote:

> Hi,
>
> On Wed, Aug 07, 2024 at 04:14:29PM +0200, Yann CARDAILLAC Pro wrote:
> > Thanks Mikko, that was it indeed! I didn't test on target yet but it
> seems
> > ok so far!
> >
> > I'm still not sure about the librj2d.so()(64bit) though any idea?
>
> I would leave all RPROVIDES for bitbake etc automation to set. I don't know
> what is the reson for setting RPROVIDES manually.
>
> Cheers,
>
> -Mikko
>

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

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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-28  9:50           ` Yann CARDAILLAC Pro
@ 2024-08-29  7:34             ` Mikko Rapeli
  2024-09-04  8:55               ` Ola x Nilsson
  0 siblings, 1 reply; 10+ messages in thread
From: Mikko Rapeli @ 2024-08-29  7:34 UTC (permalink / raw)
  To: Yann CARDAILLAC Pro; +Cc: yocto

Hi,

On Wed, Aug 28, 2024 at 11:50:03AM +0200, Yann CARDAILLAC Pro wrote:
> Hi Mikko,
> 
> Well without the RPROVIDES I get the following error when a package DEPENDS
> on it :
> 
> ERROR: rj2d-com-1.1-r0 do_package_qa: QA Issue: /usr/bin/rj2d- com
> contained in package rj2d- com requires librj2d.so()(64bit), but no
> providers found in RDEPENDS:rj2d-com? [file-rdeps]
> 
> The only solution I found was to add the RPROVIDES. Is there something I'm
> doing wrong?
> 
> Basically the rj2d-com package DEPENDS and RDEPENDS:${PN}  to librj2d, and
> without the RPROVIDES with  librj2d.so()(64bit) I get errors.
> 
> Is there something wrong with the approach ?

I think bitbake should be auto-detecting the shared library RDEPENS. RPROVIDES
is usually only set when there is a virtual provider which multiple recipes
and binary package provide.

Something doesn't feel right about this.

Cheers,

-Mikko


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

* Re: [yocto][meta-openembedded] How to properly build a lib package
  2024-08-29  7:34             ` Mikko Rapeli
@ 2024-09-04  8:55               ` Ola x Nilsson
  0 siblings, 0 replies; 10+ messages in thread
From: Ola x Nilsson @ 2024-09-04  8:55 UTC (permalink / raw)
  To: yocto; +Cc: mikko.rapeli

On Thu, Aug 29 2024, Mikko Rapeli wrote:

> Hi,
>
> On Wed, Aug 28, 2024 at 11:50:03AM +0200, Yann CARDAILLAC Pro wrote:
>> Hi Mikko,
>> 
>> Well without the RPROVIDES I get the following error when a package DEPENDS
>> on it :
>> 
>> ERROR: rj2d-com-1.1-r0 do_package_qa: QA Issue: /usr/bin/rj2d- com
>> contained in package rj2d- com requires librj2d.so()(64bit), but no
>> providers found in RDEPENDS:rj2d-com? [file-rdeps]
>> 
>> The only solution I found was to add the RPROVIDES. Is there something I'm
>> doing wrong?
>> 
>> Basically the rj2d-com package DEPENDS and RDEPENDS:${PN}  to librj2d, and
>> without the RPROVIDES with  librj2d.so()(64bit) I get errors.
>> 
>> Is there something wrong with the approach ?
>
> I think bitbake should be auto-detecting the shared library RDEPENS. RPROVIDES
> is usually only set when there is a virtual provider which multiple recipes
> and binary package provide.
>
> Something doesn't feel right about this.

I think it is the missing soname mentioned earlier.  It needs to be set
using a linker flag.

/Ola


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

end of thread, other threads:[~2024-09-04  8:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07  8:47 [yocto][meta-openembedded] How to properly build a lib package Yann CARDAILLAC Pro
2024-08-07  9:12 ` Alexander Kanavin
2024-08-07  9:21 ` Mikko Rapeli
2024-08-07 13:13   ` Yann CARDAILLAC Pro
2024-08-07 13:19     ` Mikko Rapeli
2024-08-07 14:14       ` Yann CARDAILLAC Pro
2024-08-07 14:20         ` Mikko Rapeli
2024-08-28  9:50           ` Yann CARDAILLAC Pro
2024-08-29  7:34             ` Mikko Rapeli
2024-09-04  8:55               ` Ola x Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox