Skip to content
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

plane.fd.fd() has changed to plane.fd.get() #1

Closed
JuergenSmo opened this issue Dec 13, 2021 · 4 comments
Closed

plane.fd.fd() has changed to plane.fd.get() #1

JuergenSmo opened this issue Dec 13, 2021 · 4 comments

Comments

@JuergenSmo
Copy link

Hi
depending on the version of libcamera you use the usage of plane() has changed.
My libcamera version is:
pi@campi:~/LCCV/build $ cmake ..
-- Platform: armhf
-- libcamera library found:
-- version: 1.0
-- libraries: /usr/local/lib/arm-linux-gnueabihf/libcamera.so;/usr/local/lib/arm-linux-gnueabihf/libcamera-base.so
-- include path: /usr/local/include/libcamera
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/LCCV/build

With this I go a compilation error:

/home/pi/LCCV/src/libcamera_app.cpp: In member function ‘void LibcameraApp::setupCapture()’:
/home/pi/LCCV/src/libcamera_app.cpp:556:54: error: ‘const class libcamera::SharedFD’ has no member named ‘fd’; did you mean ‘std::shared_ptrlibcamera::SharedFD::Descriptor libcamera::SharedFD::fd_’? (not accessible from this context)
556 | if (i == buffer->planes().size() - 1 || plane.fd.fd() != buffer->planes()[i + 1].fd.fd())
| ^~
compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/liblccv.dir/build.make:95: CMakeFiles/liblccv.dir/src/libcamera_app.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/liblccv.dir/all] Fehler 2
make: *** [Makefile:171: all] Fehler 2

So changing following lines in libcamera_apps.cpp from plane().fd.fd() to plane().fd.get() is now working for me:

void LibcameraApp::setupCapture()
...
if (i == buffer->planes().size() - 1 || plane.fd.get() != buffer->planes()[i + 1].fd.get())
{
void *memory = mmap(NULL, buffer_size, PROT_READ | PROT_WRITE, MAP_SHARED, plane.fd.get(), 0);
...

Best Regards and thank's a lot for you work!

@kbarni
Copy link
Owner

kbarni commented Dec 14, 2021

Thanks for reporting!
I confirm this. According to the API, plane.fd is from SharedFD class which has the get() method, in my installation plane.fd is FileDescriptor with fd() method.
My installation also reports libcamera version 1.0.

Do you use libcamera from the repositories or did you build it yourself? If you use the repo version, what is the result of

apt list libcamera0

(I'm using libcamera0 from the Raspbian repo version 0~git20211020+f4070274-3)

@JuergenSmo
Copy link
Author

It report to me the same version as yours: 0~git20211020+f4070274-3
I build it myself using the documentation at [https://www.raspberrypi.com/documentation/accessories/camera.html#building-libcamera-and-libcamera-apps]
But I then would expect that it would work directly. As I also had the version from the repository installed before maybe my system need a fresh setup. But first I will go to rebuild it from the newest sources and came back to you with the result.

@JuergenSmo
Copy link
Author

Same issue as before after download and re-building libcamera:

pi@campi:~/LCCV/build $ cmake ..
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No previous build - default to Release build
-- Platform: armhf
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Found OpenCV: /usr/local (found version "4.5.4")
-- Checking for module 'libcamera'
-- Found libcamera, version 1.0
-- libcamera library found:
-- version: 1.0
-- libraries: /usr/local/lib/arm-linux-gnueabihf/libcamera.so;/usr/local/lib/arm-linux-gnueabihf/libcamera-base.so
-- include path: /usr/local/include/libcamera
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/LCCV/build

pi@campi:/LCCV/build $ make -j4
Scanning dependencies of target liblccv
[ 75%] Building CXX object CMakeFiles/liblccv.dir/src/lccv.cpp.o
[ 75%] Building CXX object CMakeFiles/liblccv.dir/src/libcamera_app.cpp.o
[ 75%] Building CXX object CMakeFiles/liblccv.dir/src/libcamera_app_options.cpp.o
/home/pi/LCCV/src/libcamera_app.cpp: In member function ‘void LibcameraApp::setupCapture()’:
/home/pi/LCCV/src/libcamera_app.cpp:556:54: error: ‘const class libcamera::SharedFD’ has no member named ‘fd’; did you mean ‘std::shared_ptrlibcamera::SharedFD::Descriptor libcamera::SharedFD::fd_’? (not accessible from this context)
556 | if (i == buffer->planes().size() - 1 || plane.fd.fd() != buffer->planes()[i + 1].fd.fd())
| ^

compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/liblccv.dir/build.make:95: CMakeFiles/liblccv.dir/src/libcamera_app.cpp.o] Fehler 1
make[2]: *** Es wird auf noch nicht beendete Prozesse gewartet....
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/liblccv.dir/all] Fehler 2
make: *** [Makefile:171: all] Fehler 2

Same version as before: libcamera0/stable 0~git20211020+f4070274-3 armhf

Do you think that could be related to some old still existing libs on my system?
Many thanks.

@kbarni
Copy link
Owner

kbarni commented Dec 15, 2021

The fd.fd() is the "old" way, and fd.get() the "new" way.
I checked, it was already corrected in libcamera-apps too.
I will correct this in the next release.

kbarni pushed a commit that referenced this issue Jan 30, 2024
Added zoom functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants