Open azasypkin opened 8 years ago
Sounds like https://github.com/raspberrypi/userland/issues/178 Have you been rebuilding userland with modified build parameters (ie '--no-as-needed')?
Hey @6by9, thanks for the hint. Currently I use master
branch of meta-raspberry
and there is --no-as-needed
[1] in the userland
recipe. With this both raspistill
and raspivid
work fine, but not picamera
python lib. Out of curiosity I was trying to remove --no-as-needed
and obviously nothing worked after that :) Or I should try to modify it in some other way?
Also wondering if it's somehow related to the fact that picamera
is not included into yocto image from the start and I install it via pip install picamera[array]
later on.
I'm afraid this is all rather beyond my knowledge (I've never dealt with the --as-needed
switch or gcc's __attribute__
mechanism), so I doubt I'll be able to shed any light on this. The only thing I would mention is that ctypes
in Python (which picamera uses to access libmmal) will be loading the library with dlopen
whereas I'd assume raspistill / raspivid will be dynamically linked. I've no idea if/how that could make any difference though.
The manner of picamera's installation shouldn't make any difference; the deb on Raspbian is effectively the result of running pip install, and it certainly won't change the manner in which it accesses libmmal.
It seems that picamera uses libmmal.so
while raspivid
and raspistill
links against libmmal_{core,util,vc_client}.so
directly. On Alpine Linux I added the -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed'
to cmake
(as in the Yocto package) and raspivid
/raspistill
worked fine but picamera gave exactly the same "Function not implemented" errors (as libmmal still wasn't properly linked to the relevant libs), so I compiled using LDFLAGS="-Wl,--no-as-needed"
instead (as in the Void Linux package) and it worked correctly.
ldd /opt/vc/lib/libmmal.so
(using -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed'
):
ldd (0xb6ec1000)
libmmal_core.so => /opt/vc/lib/libmmal_core.so (0xb6e8f000)
libmmal_util.so => /opt/vc/lib/libmmal_util.so (0xb6e71000)
libvcos.so => /opt/vc/lib/libvcos.so (0xb6e58000)
libc.musl-armhf.so.1 => ldd (0xb6ec1000)
ldd /opt/vc/lib/libmmal.so
(using LDFLAGS="-Wl,--no-as-needed"
):
ldd (0xb6eb6000)
libmmal_vc_client.so => /opt/vc/lib/libmmal_vc_client.so (0xb6e87000)
libmmal_components.so => /opt/vc/lib/libmmal_components.so (0xb6e6c000)
libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0xb6e56000)
libvcsm.so => /opt/vc/lib/libvcsm.so (0xb6e40000)
libmmal_core.so => /opt/vc/lib/libmmal_core.so (0xb6e22000)
libmmal_util.so => /opt/vc/lib/libmmal_util.so (0xb6e04000)
libcontainers.so => /opt/vc/lib/libcontainers.so (0xb6de1000)
libvcos.so => /opt/vc/lib/libvcos.so (0xb6dc8000)
libc.musl-armhf.so.1 => ldd (0xb6eb6000)
It certainly isn't a bug in picamera
, so it seems the only workaround that could be done here would be to use the libmmal_*.so
directly as raspivid
/raspistill
does (idk if that's feasible/possible though).
NOTE: applying https://github.com/raspberrypi/userland/pull/459 locally still gave me the same results as using -DCMAKE_EXE_LINKER_FLAGS
i.e. no libs linked to libmmal.so
, so maybe this is relevant to you @6by9 :)
The linker flags are needed when compiling picamera, not libmmal.
https://github.com/raspberrypi/userland/pull/459 only changes the dependencies of the standard apps, not the libraries.
libmmal does NOT depend on libmmal_vc_client. If you wish to use the VPU components then your application needs to link against it, and to NOT over optimise and end up removing the constructor. https://github.com/raspberrypi/userland/issues/178 / https://github.com/raspberrypi/userland/issues/303#issuecomment-204394592
That's ... odd; picamera isn't compiled (in any meaningful sense). It's just dynamically loading what it needs from the C libs identified in picamera/mmal.py. I'm not entirely familiar with the guts of CPython's ctypes module but I'd guess ultimately it's just calling dlopen and dlsym to grab what it needs from libmmal and libbcm_host. I'm afraid I can't shed much more light on this!
I am also facing a similar error after building userland. I am using the attached python code for livestreaming.
All working fine till this morning, until I built userland for cec-client. Later I am facing this issue everytime. Could someone share me the libmmal_vc_client.so with vc.camera_info included.
Error:
python /home/pimate/ESWAR/LIVE/live.py
mmal: mmal_component_create_core: could not find component 'vc.camera_info'
Traceback (most recent call last):
File "/home/pimate/ESWAR/LIVE/live.py", line 8, in
I am also facing a similar error while building userland. I am using the attached python code for livestreaming.
All working fine till this morning, until I built userland for cec-client. Later I am facing this issue everytime. Could someone share me the libmmal_vc_client.so with vc.camera_info included.
Error: python /home/pimate/ESWAR/LIVE/live.py mmal: mmal_component_create_core: could not find component 'vc.camera_info' Traceback (most recent call last): File "/home/pimate/ESWAR/LIVE/live.py", line 8, in camera = PiCamera() File "/usr/local/lib/python3.6/dist-packages/picamera/camera.py", line 367, in init with mo.MMALCameraInfo() as camera_info: File "/usr/local/lib/python3.6/dist-packages/picamera/mmalobj.py", line 2346, in init super(MMALCameraInfo, self).init() File "/usr/local/lib/python3.6/dist-packages/picamera/mmalobj.py", line 633, in init prefix="Failed to create MMAL component %s" % self.component_type) File "/usr/local/lib/python3.6/dist-packages/picamera/exc.py", line 184, in mmal_check raise PiCameraMMALError(status, prefix) picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': Function not implemented
Where do i have to put the following to avoid this error? SET( CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed" )
I tried the following and the issue is resolved.
The contents of /opt/vc folder is recreated. This resolves the issue.
I'm also experiencing this issue with a self-compiled version of the raspberry userland repo on the latest Ubuntu Server image for the Raspberry Pi 4. I've added SET( CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed" )
to the CMakeLists.txt
of that repo and ran the buildme
script. However, picamera says:
mmal: mmal_component_create_core: could not find component 'vc.camera_info'
Traceback (most recent call last):
File "picam.py", line 171, in <module>
main()
File "picam.py", line 143, in main
with picamera.PiCamera(
File "/usr/local/lib/python3.8/dist-packages/picamera/camera.py", line 367, in __init__
with mo.MMALCameraInfo() as camera_info:
File "/usr/local/lib/python3.8/dist-packages/picamera/mmalobj.py", line 2346, in __init__
super(MMALCameraInfo, self).__init__()
File "/usr/local/lib/python3.8/dist-packages/picamera/mmalobj.py", line 631, in __init__
mmal_check(
File "/usr/local/lib/python3.8/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': Function not implemented
Does anyone have another hint here? Thanks!
Not a very good fix, but copying libmmal.so from a working version of Raspbian (/opt/vc/lib/libmmal.so) to /usr/lib/arm-linux-gnueabihf/libmmal.so on Ubuntu Mate 20.04 worked for me.
There is a chance that something wrong with the Yocto image itself, but it looks very weird that
raspistill
(IIRC it also useslibmmal
under the hood) works andpicamera
doesn't. Do you have any idea @waveform80? Thanks!python-pip
;Linux raspberrypi2 4.4.23 #1 SMP Tue Oct 4 14:55:18 UTC 2016 armv7l armv7l armv7l GNU/Linux
;ldconfig
:Everything works fine with
raspistill
- no problems whatsoever. But the following code is failing (Python 2.7,picamera 1.12
installed viapip install picamera[array]
):Here is a verbose python output: