[yocto] Shared library question

Max Krummenacher max.oss.09 at gmail.com
Mon Feb 27 12:11:21 PST 2017


Hi

Am Montag, den 27.02.2017, 15:03 +0100 schrieb Gary Thomas:
> I trying to create a package am335x-pru-support which creates a
> shared library used by another package pru-examples.  The library
> files installed with am335x-pru-support are (from <BUILD>/image)
> -rwxr-xr-x 4 gthomas gthomas 17074 Feb 27 13:40 usr/lib/libprussdrv.a
> lrwxrwxrwx 1 gthomas gthomas    16 Feb 27 13:40 usr/lib/libprussdrv.so -> libprussdrv.so.1
> lrwxrwxrwx 1 gthomas gthomas    18 Feb 27 13:40 usr/lib/libprussdrv.so.1 -> libprussdrv.so.1.0
> -rwxr-xr-x 1 gthomas gthomas 22092 Feb 27 13:40 usr/lib/libprussdrv.so.1.0
> -rw-r--r-- 4 gthomas gthomas 8074 Feb 27 13:40 usr/include/pruss/prussdrv.h
> -rw-r--r-- 4 gthomas gthomas 4286 Feb 27 13:40 usr/include/pruss/pruss_intc_mapping.h
> 
> These files are split by the packager as:
> gthomas at europa:packages-split$ find am335x-pru-support | sort
> am335x-pru-support
> am335x-pru-support/usr
> am335x-pru-support/usr/lib
> am335x-pru-support/usr/lib/libprussdrv.so.1
> am335x-pru-support/usr/lib/libprussdrv.so.1.0
> gthomas at europa:packages-split$ find am335x-pru-support-dev | sort
> am335x-pru-support-dev
> am335x-pru-support-dev/usr
> am335x-pru-support-dev/usr/include
> am335x-pru-support-dev/usr/include/pruss
> am335x-pru-support-dev/usr/include/pruss/prussdrv.h
> am335x-pru-support-dev/usr/include/pruss/pruss_intc_mapping.h
> am335x-pru-support-dev/usr/lib
> am335x-pru-support-dev/usr/lib/libprussdrv.so
> 
> These files get staged correctly to pru-examples recipe-specific-sysroot
> and I can build and link against them, using DEPENDS="am335x-pru-support".
> The problem is that when my build (target recipe) uses
>    $(CC) my_target_program.c $(LDFLAGS) -lprussdrv
> it gets satisfied by /usr/lib/libprussdrv.so and not /usr/lib/libprussdrv.so.1
> This in turn appears to keep the pru-examples package from having
> a runtime dependency against the am335x-pru-support package and the
> necessary library file does not end up on my target.
> 
> I've tried to work through this, following many recipes as examples,
> e.g. meta/recipes-multimedia/libogg (pattern for am335x-pru-support)
> and meta/recipes-multimedia/flac (pattern for pru-examples).  The
> libogg/flac combo works correctly, mine does not :-(
> 
> Any pointers on what I might be doing wrong?  I'm so close to getting
> this stuff going, it's just the packaging that's going to claim the
> last hairs from my head...

When linking a shared object file you have to pass the linker a soname which adds compatible version
information into the share object file.
Have a look here:
http://git.yoctoproject.org/cgit/cgit.cgi/meta-fsl-arm/commit/recipes-bsp?id=7ff327a4e3e8e19d1e3f848
865b6b27ba9f6250b
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html


Alternatively you can drop the libprussdrv.so.1 and libprussdrv.so.1.0, and force with FILES... the
libprussdrv.so into the not -dev package.
Probably you would also want to INSANE_SKIP_${PN} = "dev-so".


Max





> 
> Thanks
> 
> n.b. I'm happy to share any of the recipes, I just left them out for brevity.
> 
> -- 
> ------------------------------------------------------------
> Gary Thomas                 |  Consulting for the
> MLB Associates              |    Embedded world
> ------------------------------------------------------------



More information about the yocto mailing list