Re: [poky] shared library location and linking

star <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <[email protected]>
I found my issue described here, more or less exactly:

https://docs.yoctoproject.org/ref-manual/variables.html#term-SYSROOT_DIRS_IGNORE

For me it turns out to need in recipe of lib:
SYSROOT_DIRS:append = " /opt/lib"

and in recipe of app, using that lib:
TARGET_LDFLAGS:append = " -L${RECIPE_SYSROOT}/opt/lib"

But that's not helping. Looking at bitbake <recipe_app> -e I can't see
why linker does not find it. As mentioned
${WORKDIR}/recipe-sysroot/opt/lib is populated for the app.
A bug? Usually I am just miss something, but I don't have a clue how to
debug.

Best regards,
Steve


> Hello,
> I have a problem if a shared lib should be located in some other than
> usual folder - in /opt/lib in my example. Althoug not usual, it should
> be possible, right?
> The lib itself is created well and with that including in recipe (which
> tooks me some time to find):
> SYSROOT_DIRS += "/opt/lib"
> this lib is also populated into sysroot-destdir/opt/lib
>
> But recipe of app, that is depending on that lib, will not link -
> although the lib is located in build directory of app in
> recipe-sysroot/opt/lib (thanks to the trick above).
>
> I couldn't figure out what is the problem:
>
> | arm-poky-linux-gnueabi-gcc  -mfpu=neon -mfloat-abi=hard
> -mcpu=cortex-a9 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2
> -Wformat -Wformat-security -Werror=format-security
> --sysroot=/home/user/y/yocto_4014_sp2/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/sps/0.1-r0/recipe-sysroot
> sps.c -L/opt/lib -lvision-device -o sps
> |
> /home/user/y/yocto_4014_sp2/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/sps/0.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld:
> cannot find -lvision-device: No such file or directory
> | collect2: error: ld returned 1 exit status
>
> I don't know where the linker is looking for? Just as a dirty hack I
> copied the libs in recipe as below, it works:
>
> do_compile () {
>      cp recipe-sysroot/opt/lib/* recipe-sysroot/usr/lib
>      oe_runmake -f Makefile-sps
> }
>
> I seems the -L is not passed through!? Is it a bug? Or what do I miss?
>
> Best regards and any help is welcome.
> Steve
>
> PS: Makefile is as simple:
>
> LIBSINC  = -L/opt/lib
> LIBS     = -lvision-device
>
> all: sps
>
> sps: *.c
>          $(CC) sps.c $(LIBSINC) $(LIBS) -o sps
>
> clean:
>          rm -f sps
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#13208): https://lists.yoctoproject.org/g/poky/message/13208
> Mute This Topic: https://lists.yoctoproject.org/mt/102707949/3618575
> Group Owner: [email protected]
> Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.