My overall goal is to build/compile rpicam_hello.cpp using CMake so I can integrate OpenCV into it and do all sorts of image processing
The following are the steps I've taken towards my goal :
--- Built libcamera and rpicam-apps as instructed here : https://www.raspberrypi.com/documentati ... picam-apps
--- Used 'sudo apt install libcamera-dev' to install the potential header files that I might need down the road
--- Created a 'testing_folder' within the 'rpicam-apps' folder so I can run/test/experiment my own C++ programs there
--- Used the following CMake file from the libcamera dev https://github.com/kbingham/simple-cam/ ... eLists.txt since I was able to build/compile/run the code in that repository successfully
For convenience's sake, here's the mentioned CMake file that I'm currently using
And here are the following errors I've been getting when using the mentioned CMake file
So here are my questions that I have for y'all :
1) In the Raspberry PI documentation, Meson and Ninja were used to build libcamera from source, am I out of luck when it comes to building my own libcamera application with CMake?
2) Are the errors due to me not linking a LibCamera.so file? Or some related Libcamera library?
3) I'm aware of GitHub repos that have already integrated OpenCV with their Libcamera application as stated here : https://github.com/erasta/libcamera-opencv/tree/main
But that repo hasn't been touched in the past two years to which there were numerous changes in the LibCamera API and so it was riddled with errors when I tried building/compiling that program
So my third and final question is are there any other working GitHub repos that use Libcamera that I can fork from to gain a better understanding of how Libcamera works?
The following are the steps I've taken towards my goal :
--- Built libcamera and rpicam-apps as instructed here : https://www.raspberrypi.com/documentati ... picam-apps
--- Used 'sudo apt install libcamera-dev' to install the potential header files that I might need down the road
--- Created a 'testing_folder' within the 'rpicam-apps' folder so I can run/test/experiment my own C++ programs there
--- Used the following CMake file from the libcamera dev https://github.com/kbingham/simple-cam/ ... eLists.txt since I was able to build/compile/run the code in that repository successfully
For convenience's sake, here's the mentioned CMake file that I'm currently using
Code:
cmake_minimum_required(VERSION 3.6)project(SimpleCamDESCRIPTION "A small and documented example application for libcamera"LANGUAGES CXX)set (CMAKE_CXX_STANDARD 17)set (CMAKE_CXX_FLAGS "-Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -Wno-unused-parameter")find_package(PkgConfig)find_package(OpenCV REQUIRED)pkg_check_modules(LIBCAMERA REQUIRED IMPORTED_TARGET libcamera)message(STATUS "libcamera library found:")message(STATUS " version: ${LIBCAMERA_VERSION}")message(STATUS " libraries: ${LIBCAMERA_LINK_LIBRARIES}")message(STATUS " include path: ${LIBCAMERA_INCLUDE_DIRS}")# libevent is used specifically by simple-cam as its event loop.# Applications may use a different event handling implementation.pkg_check_modules(LIBEVENT REQUIRED IMPORTED_TARGET libevent_pthreads)message(STATUS "libevent_pthreads library found:")message(STATUS " version: ${LIBEVENT_VERSION}")message(STATUS " libraries: ${LIBEVENT_LINK_LIBRARIES}")message(STATUS " include path: ${LIBEVENT_INCLUDE_DIRS}")include_directories(${CMAKE_SOURCE_DIR} ${LIBCAMERA_INCLUDE_DIRS} ${LIBEVENT_INCLUDE_DIRS})include_directories("/home/pi/libcamera/include")include_directories("/home/pi/rpicam-apps")add_executable(simple-cam rpicam_hello.cpp)target_link_libraries(simple-cam ${OpenCV_LIBS})target_link_libraries(simple-cam PkgConfig::LIBEVENT)target_link_libraries(simple-cam PkgConfig::LIBCAMERA)
Code:
/usr/bin/ld: CMakeFiles/simple-cam.dir/rpicam_hello.cpp.o: in function `event_loop(RPiCamApp&)':rpicam_hello.cpp:(.text+0x20): undefined reference to `RPiCamApp::OpenCamera()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x28): undefined reference to `RPiCamApp::ConfigureViewfinder()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x30): undefined reference to `RPiCamApp::StartCamera()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x4c): undefined reference to `RPiCamApp::Wait()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x80): undefined reference to `RPiCamApp::StopCamera()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x88): undefined reference to `RPiCamApp::StartCamera()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x1a8): undefined reference to `RPiCamApp::ViewfinderStream(StreamInfo*) const'/usr/bin/ld: rpicam_hello.cpp:(.text+0x1b8): undefined reference to `RPiCamApp::ShowPreview(std::shared_ptr<CompletedRequest>&, libcamera::Stream*)'/usr/bin/ld: CMakeFiles/simple-cam.dir/rpicam_hello.cpp.o: in function `main':rpicam_hello.cpp:(.text+0x24c): undefined reference to `RPiCamApp::RPiCamApp(std::unique_ptr<Options, std::default_delete<Options> >)'/usr/bin/ld: rpicam_hello.cpp:(.text+0x2c4): undefined reference to `RPiCamApp::~RPiCamApp()'/usr/bin/ld: rpicam_hello.cpp:(.text+0x2fc): undefined reference to `RPiCamApp::~RPiCamApp()'/usr/bin/ld: CMakeFiles/simple-cam.dir/rpicam_hello.cpp.o: in function `RPiCamApp::GetVerbosity()':rpicam_hello.cpp:(.text._ZN9RPiCamApp12GetVerbosityEv[_ZN9RPiCamApp12GetVerbosityEv]+0x0): undefined reference to `RPiCamApp::verbosity'/usr/bin/ld: rpicam_hello.cpp:(.text._ZN9RPiCamApp12GetVerbosityEv[_ZN9RPiCamApp12GetVerbosityEv]+0x4): undefined reference to `RPiCamApp::verbosity'collect2: error: ld returned 1 exit statusmake[2]: *** [CMakeFiles/simple-cam.dir/build.make:156: simple-cam] Error 1make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/simple-cam.dir/all] Error 2make: *** [Makefile:91: all] Error 2
1) In the Raspberry PI documentation, Meson and Ninja were used to build libcamera from source, am I out of luck when it comes to building my own libcamera application with CMake?
2) Are the errors due to me not linking a LibCamera.so file? Or some related Libcamera library?
3) I'm aware of GitHub repos that have already integrated OpenCV with their Libcamera application as stated here : https://github.com/erasta/libcamera-opencv/tree/main
But that repo hasn't been touched in the past two years to which there were numerous changes in the LibCamera API and so it was riddled with errors when I tried building/compiling that program
So my third and final question is are there any other working GitHub repos that use Libcamera that I can fork from to gain a better understanding of how Libcamera works?
Statistics: Posted by Digital1O1 — Mon Jan 22, 2024 2:05 am — Replies 0 — Views 104