-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build issue causing raspivid to fail (components not registered) #178
Comments
This will break libmpv reference to libmmal_vc_client.so see raspberrypi/userland#178
@ajlennon is this still an issue? |
yes |
@Ruffio not sure I'm afraid. I submitted a patch to meta-raspberrypi to prevent the --as-needed being used. I I get a chance I'll see if that is working |
+1 |
@ajlennon is it working? |
Anyone contributing to the thread have any further comment or possible fixes? |
Sorry I don't, I'm not using this for a while. |
I get the same issue building from this repository on a raspberry with Ubuntu 16.04.4 LTS, gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) - so, is this a configuration issue of the build environment? |
Yes, as covered in some of the linked issues. edit Correction - it's over-eager in determining that the application (raspistill/raspivid etc) doesn't use any functions from libmmal_vc_client.so, therefore drops the advertised dependency. libmmal_vc_client.so is complete with all the expected functionality. |
@pelwell from #303 (comment) where you point a similar VPU issue. Having had a play I don't believe that is going to help here. Your VPU solution (I think) was the equivalent of the compiler for libmmal_vc_client.so determining that none of the functions were exported and therefore it could optimise them out of the .so. Your mod adds in an extra use of the variables to stop it optimising them away. I've tried various things today, but adding:
to the relevant application CMakeLists.txt seems to be the only solution that actually works. |
Some versions of GCC have --as-needed turned on by default. The binding of libmmal_vc_client is such that the constructor registers the supported components with the MMAL core, and nothing calls into it directly. The linker can't tell this, decides it is unused, and promptly drops it as a dependency - cue no VideoCore components. Adding --no-as-needed means that the linker leaves it alone. It's not nice, but there doesn't appear to be a better solution. See raspberrypi#178.
Looking at the docs for the --as-needed ld flag, it says that this switches off the DT_NEEDED flag on the library concerned. |
(i.e. rather than modifying every executable, just change the library). |
Or, as a compromise, add the flag to all library builds. |
Thanks guys. I'd been trying to find a suitable flag to set on the library (because that is the nicer thing to do), but had failed. I'm still not convinced that there is a suitable flag on the library. From
As I read that, it is solely at the link stage of the application that it is making up the list of libraries to include. The DT_NEEDED tag itself doesn't exist outside of the linker until the link is complete and the ELF file written. The DT_NEEDED flags on libmmal_vc_client list just the things it depends on, which is as expected:
On raspistill, it has totally thrown away libmmal_vc_client.so
I guess the other approach is to throw the towel in and make all the components dependencies on mmal_core. mmal_core then needs to be built with --no-as-needed so that ld doesn't throw the dependencies away from that. It bloats sizes though,as we'd have to include all the ARM side components in the list of dependencies too, otherwise the problem still remains for them. Thoughts? |
Some versions of GCC have --as-needed turned on by default. The binding of libmmal_vc_client is such that the constructor registers the supported components with the MMAL core, and nothing calls into it directly. The linker can't tell this, decides it is unused, and promptly drops it as a dependency - cue no VideoCore components. Adding --no-as-needed means that the linker leaves it alone. It's not nice, but there doesn't appear to be a better solution. See raspberrypi#178.
Some versions of GCC have --as-needed turned on by default. The binding of libmmal_vc_client is such that the constructor registers the supported components with the MMAL core, and nothing calls into it directly. The linker can't tell this, decides it is unused, and promptly drops it as a dependency - cue no VideoCore components. Adding --no-as-needed means that the linker leaves it alone. It's not nice, but there doesn't appear to be a better solution. See #178.
It would be nice to close this over 4 year old issue before it reaches its next birthday - is there anything that can/should be done? |
This issue will be closed within 30 days unless further interactions are posted. If you wish this issue to remain open, please add a comment. A closed issue may be reopened if requested. |
…l.camera" Fixes the following error (on Ubuntu 18.04 aarch64 using Raspbian kernel8.img (4.19.97-v8+ #1294)): mmal: mmal_component_create_core: could not find component 'vc.ril.camera' mmal: Failed to create camera component For details refer to raspberrypi/userland#178
Closing as should be fixed by #714 due to Bullseye changing the default compiler options. |
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 needed components are not registered.
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
The text was updated successfully, but these errors were encountered: