[yocto] [meta-raspberrypi][PATCH 1/1] userland: Add '--no-as-needed' linker flag to ensure all specified shared libraries are linked against applications (e.g. raspivid)

Alex J Lennon ajlennon at dynamicdevices.co.uk
Mon Jun 2 03:04:15 PDT 2014


libmmal_vc_client.so makes use of __attribute__(constructor) to ensure that supplier components (e.g. camera) are loaded when the static library is loaded.

raspivid, and possibly other applications, link against libmmal_vc_client.so, causing the ctor to execute, but there is no needed dependency.

Some build environments (e.g. Yocto/OpenEmbedded) pass the '--no-as-needed' linker flag which removes the dependency on libmmal_vc_client and thus components are not r

In this situation raspivid then gives an error of the form

  root at raspberrypi:~# raspivid -o test
  mmal: mmal_component_create_core: could not find component 'vc.ril.camera'
  mmal: Failed to create camera component
  mmal: main: Failed to create camera component
  mmal: Failed to run camera app. Please check for firmware updates

For further details see: https://lists.yoctoproject.org/pipermail/yocto/2014-June/019933.html

Change-Id: I7d6b3751d043f2d79ea06f2d1205e7430f6e926d
Signed-off-by: Alex J Lennon <ajlennon at dynamicdevices.co.uk>
---
 recipes-graphics/userland/userland_git.bb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/recipes-graphics/userland/userland_git.bb b/recipes-graphics/userland/userland_git.bb
index a348090..95e038b 100644
--- a/recipes-graphics/userland/userland_git.bb
+++ b/recipes-graphics/userland/userland_git.bb
@@ -11,14 +11,18 @@ PROVIDES = "virtual/libgles2 \
             virtual/egl"
 COMPATIBLE_MACHINE = "raspberrypi"
 
+SRCBRANCH = "master"
+SRCFORK = "raspberrypi"
 SRCREV = "eccb81050afd177da1923404b366c6226f29bfe0"
-SRC_URI = "git://github.com/raspberrypi/userland.git;protocol=git;branch=master \
+
+SRC_URI = "git://github.com/${SRCFORK}/userland.git;protocol=git;branch=${SRCBRANCH} \
           "
+
 S = "${WORKDIR}/git"
 
 inherit cmake
 
-EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
+EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed'"
 
 # The compiled binaries don't provide sonames.
 SOLIBS = "${SOLIBSDEV}"
@@ -29,10 +33,10 @@ do_install_append() {
     rm -rf ${D}/opt
 }
 
+
 FILES_${PN} += "${libdir}/*${SOLIBS}"
 FILES_${PN}-dev = "${includedir} \
                    ${prefix}/src"
 FILES_${PN}-doc += "${datadir}/install"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-- 
2.0.0




More information about the yocto mailing list