Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ARibe6
Novice
2,931 Views

Making a Yocto Recipe that copies dynamic library (.so) to /usr/lib

Hi,

I'm creating a recipe to add on my image. My product have 1 executable and 4 libraries, which I load dynamically.

Here is how my recipe looks like:

FILESEXTRAPATHS_prepend := "${THISDIR}/files/:"

SRC_URI += "file://"

 

SRC_URI += "file://.service"

 

SRC_URI += "file://.so"

 

SRC_URI += "file://.so"

 

SRC_URI += "file://.so"

 

SRC_URI += "file://.so"

SYSTEMD_SERVICE_${PN} = ".service"

RDEPENDS_${PN} = "systemd"

 

DEPENDS = "systemd"

inherit systemd

S = "${WORKDIR}"

do_compile() {

}

do_install() {

 

# install service file

 

install -d ${D}${systemd_unitdir}/system

 

install -c -m 0644 ${WORKDIR}/.service ${D}${systemd_unitdir}/system

# install my binary

 

install -d ${D}${bindir}

 

install -c -m 0755 ${B}/ ${D}${bindir}

# install my libraries

 

install -d ${D}${libdir}

 

install -c -m 0755 ${B}/.so ${D}${libdir}

 

install -c -m 0755 ${B}/.so ${D}${libdir}

 

install -c -m 0755 ${B}/.so ${D}${libdir}

 

install -c -m 0755 ${B}/.so ${D}${libdir}

 

}

FILES_${PN} = "${base_libdir}/systemd/system/..service"

 

FILES_${PN} += "${bindir}/."

 

FILES_${PN} += "${libdir}/.so"

 

FILES_${PN} += "${libdir}/.so"

 

FILES_${PN} += "${libdir}/.so"

 

FILES_${PN} += "${libdir}/.so"

With that I have my executable copied to /usr/bin, but my dynamic libraries were not copied to /usr/lib... If I change from ${libdir} to ${binddir} I got the .so copied to /usr/bin, but this isn't what I want.

Do you have any idea why this is not working or what would be the correct way to have my dynamic libraries installed into /etc/lib?

Thanks a lot in advance,

Angelo Ribeiro.

5 Replies
idata
Community Manager
679 Views

Hi Angelo,

 

 

Have you tried using /usr/lib instead of {bindir} or {libdir}?

 

Also, you mentioned that you would like to include them on /etc/lib; I've seen these libraries on /usr/lib but not on /etc/lib. Are you creating this folder on your filesystem?

 

 

Regards,

 

Charlie

 

ARibe6
Novice
679 Views

Thanks Charlie,

/etc/lib was a typo, i want to put on /usr/lib.

I tried a bunch of variations without success.

DId you see any sample that generated a .so file and deployed into /usr/lib?

Also, do you know a good way of debugging these recipes? (like with echo or printf?)

Thanks

Angelo Ribeiro

idata
Community Manager
679 Views

Hi Angelo,

 

 

Have you checked if the .so are located on /lib? When you bitbake the image, do you get errors? Run a find instruction to see if the .so are being generated and where have been located when you build your image.

 

Did you also try without the FILES_${PN} lines? There could be a conflict with these instructions and install -d ${D}${libdir}.

 

I will do some tests and investigate regarding this and I will let you know, please let me know about my questions above.

 

 

What do you want to debug? How are the recipes being built or all the build process?

 

You can find some information here: http://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html# usingpoky-debugging http://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html# usingpoky-debugging You can also use FILES_${PN}-dbg. Let me know if this approach helps on how you want to debug this.

 

 

Regards,

 

Charlie
ARibe6
Novice
679 Views

Hi Chalie,

Yep, I have checked on /lib and everyplace and the .so was not there. It seems like we have a conflict when we put FILES_${PN} and do_install...

So, I fixed by adding the following like on my makefiles (not on my BB).

So, here is how I fixed the problem:

  1. Starting compiling my code, instead of copying binaries;
  2. Added the following line on my makefiles: install(TARGETS DESTINATION bin) for executables and install(TARGETS LIBRARY DESTINATION lib) for libraries.
  3. Changed my recipe (removed the do_install...

So, my new recipe is like this:

DESCRIPTION = ""

LICENSE = ""

SRC_URI = "file:///home//"

LIC_FILES_CHKSUM = "file:///;md5=4283671594edec4c13aeb073c219237a"

PROVIDES = ""

DEPENDS = "glib-2.0 curl"

EXTRA_OECMAKE = ""

S = "${WORKDIR}/home/"

SYSTEMD_SERVICE_${PN} = ".service"

FILES_${PN} = "${systemd_unitdir}/system/*"

FILES_${PN} += "${bindir}/*"

FILES_${PN} += "${libdir}/*.so"

FILES_SOLIBSDEV = ""

inherit pkgconfig cmake systemd

do_install_append() {

# install service file

install -d ${D}${systemd_unitdir}/system

install -c -m 0644 ${WORKDIR}/home/azure-iot-field-gateway-sdk/samples/simple_device_cloud_upload/src/simple_device_cloud_upload.service ${D}${systemd_unitdir}/system

}

That's it! Problem solved!

Thanks!

Angelo Ribeiro.

idata
Community Manager
679 Views

Hi Angelo,

 

 

I'm very glad to know that you were able to solve this.

 

 

Kind regards,

 

Charlie