Skip to contentSkip to conversation

userland: Add '--no-as-needed' linker flag to ensure all specified shared libraries are linked against applications (e.g. raspivid)

PATCH In review Alex J Lennon 3 participants 7 messages Jun 2, 2014

lore
Share & tools
lore
#0 lore raw

cover userland: Add '--no-as-needed' linker flag to ensure all specified shared libraries are linked against applications (e.g. raspivid)

Please see following patch for details

Alex J Lennon (1):
userland: Add '--no-as-needed' linker flag to ensure all specified
shared libraries are linked against applications (e.g. raspivid)

 recipes-graphics/userland/userland_git.bb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.0.0
#1 lore raw

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

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@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
---
 recipes-graphics/userland/userland_git.bb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
recipes-graphics/userland/userland_git.bb +7 -3
index a348090..95e038b 100644
@@ -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}"
-
Signature · 1 line
2.0.0
#2 lore raw

It looks ok to me.
Waiting for a push on remote.

I like the suggestion regarding SRC_URI format but I would have suggested it to be another patch.
The reason would be that when someone wants to do a revert to the change the suggestion would still remain,
but this is only a personal preference.

Good work once again, you really did me a service.

Thank you,
Alex

On Mon, Jun 2, 2014 at 1:04 PM, Alex J Lennon <[email protected]

Quoted 77 lines

wrote:

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@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
---
 recipes-graphics/userland/userland_git.bb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
recipes-graphics/userland/userland_git.bb +7 -5
index a348090..95e038b 100644
@@ -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

#3 lore raw
Quoted 3 lines · Alexandru Vaduva

It looks ok to me.
Waiting for a push on remote.

Thanks Alex. Interesting issue. Next time I get a chance I need to turn back to getting gstreamer-1.0 working with it.

I've pushed the commit up to gherzan. Is there anything else I should be doing?

Quoted 6 lines

I like the suggestion regarding SRC_URI format but I would have suggested it to be another patch.
The reason would be that when someone wants to do a revert to the change the suggestion would still remain,
but this is only a personal preference.

OK, I could do that if it was needed. (I'm pleased you like it. I pushed a similar change upstream to my fork of
raspiberrypi/userland to try to make sure nobody else sinks time on this. Breaking out the fork and branch
that way helps me to manage the upstream commits and github pull request).

Quoted 3 lines

Good work once again, you really did me a service.

Cheers,

Alex

#4 lore raw

I am not sure, let`s wait and see what the maintainers(Andrei and John) have to say, if you pushed the
commit as recommended into the README file (
https://github.com/djwillis/meta-raspberrypi/blob/master/README).
I will try to contact them on Trello tonight if nothings happens until them.

Alex

On Mon, Jun 2, 2014 at 1:41 PM, Alex J Lennon <[email protected]

Quoted 36 lines

wrote:

Quoted 3 lines · Alexandru Vaduva

It looks ok to me.
Waiting for a push on remote.

Thanks Alex. Interesting issue. Next time I get a chance I need to turn back to getting gstreamer-1.0 working with it.

I've pushed the commit up to gherzan. Is there anything else I should be doing?

Quoted 6 lines

I like the suggestion regarding SRC_URI format but I would have suggested it to be another patch.
The reason would be that when someone wants to do a revert to the change the suggestion would still remain,
but this is only a personal preference.

OK, I could do that if it was needed. (I'm pleased you like it. I pushed a similar change upstream to my fork of
raspiberrypi/userland to try to make sure nobody else sinks time on this. Breaking out the fork and branch
that way helps me to manage the upstream commits and github pull request).

Quoted 3 lines

Good work once again, you really did me a service.

Cheers,

Alex

#5 lore raw
Quoted 6 lines · Alexandru Vaduva

I am not sure, let`s wait and see what the maintainers(Andrei and John) have to say, if you pushed the
commit as recommended into the README file
(https://github.com/djwillis/meta-raspberrypi/blob/master/README).
I will try to contact them on Trello tonight if nothings happens until them.

I did (I believe). Given your comment is echoed by Paul I will break the commit into two separate ones, add the cut-off word and generate another patch-set.

Alex

#6 lore raw
In reply to Alex J Lennon

Just jumping in to make a couple of minor comments, hope you don't mind.

Quoted 5 lines · Alex J Lennon

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

It looks like this line got cut off.

Quoted 22 lines

In this situation raspivid then gives an error of the form

  root@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
---
 recipes-graphics/userland/userland_git.bb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
recipes-graphics/userland/userland_git.bb +0 -0
index a348090..95e038b 100644

recipes-graphics/userland/userland_git.bb PROVIDES = "virtual/libgles2 \ · line 15

Quoted 5 lines
recipes-graphics/userland/userland_git.bb +2 -0
@@ -11,14 +11,18 @@ PROVIDES = "virtual/libgles2 \
             virtual/egl"
 COMPATIBLE_MACHINE = "raspberrypi"
 
+SRCBRANCH = "master"
+SRCFORK = "raspberrypi"

It looks like there are some changes here which are unrelated to the commit message, including the SRC_URI and whitespace changes below.

Quoted 30 lines
recipes-graphics/userland/userland_git.bb +5 -4
 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

Quoted 5 lines

--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Thanks,

Signature · 4 lines
Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk