Error: undefined reference to `libcamera::Camera::generateConfiguration(... when cross-compiling

Hi, so I only get this error when i try to cross-compile my qt apps for my RPI. If i comment out this line then the cross-compilation works - this means other libcamera methods used dont give this error. I think there has been an update of libcamera from 0.4 to 0.5x cause i didnt have such problem before.

17:03:37: Starting: "/usr/bin/make" -j4
/root/rpi-qt/qt5.15/bin/qmake -o Makefile ../ip-camera/ip-camera.pro -spec devices/linux-rasp-pi4-v3d-g++ CONFIG+=debug CONFIG+=qml_debug
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/root/rpi-qt/sysroot/ -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../ip-camera -I. -I/usr/local/include/libcamera -I/usr/include/event2 -I/root/rpi-qt/qt5.15/include -I/root/rpi-qt/qt5.15/include/QtWidgets -I/root/rpi-qt/qt5.15/include/QtGui -I/root/rpi-qt/qt5.15/include/QtNetwork -I/root/rpi-qt/qt5.15/include/QtCore -I. -I/root/rpi-qt/qt5.15/mkspecs/devices/linux-rasp-pi4-v3d-g++ -o main.o ../ip-camera/main.cpp
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/root/rpi-qt/sysroot/ -Wl,-rpath,/usr/local/qt5.15/lib -Wl,-rpath-link,/root/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/root/rpi-qt/sysroot/lib/arm-linux-gnueabihf -o ipcam main.o LibCamera.o   -lstdc++ -lcamera -levent_pthreads -lcamera-base /root/rpi-qt/qt5.15/lib/libQt5Widgets.so /root/rpi-qt/qt5.15/lib/libQt5Gui.so /root/rpi-qt/qt5.15/lib/libQt5Network.so /root/rpi-qt/qt5.15/lib/libQt5Core.so -L/root/rpi-qt/sysroot//usr/lib/arm-linux-gnueabihf -lGLESv2 -lpthread   
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/10.3.1/../../../../arm-linux-gnueabihf/bin/ld: LibCamera.o: in function `LibCamera::configureStill(int, int, libcamera::PixelFormat, int, int)':
/home/devasus/Desktop/build-ip-camera-PI1-Debug/../ip-camera/LibCamera.cpp:30: undefined reference to `libcamera::Camera::generateConfiguration(std::vector<libcamera::StreamRole, std::allocator<libcamera::StreamRole> > const&)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:267: ipcam] Error 1
17:03:43: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project ip-camera (kit: PI1)
When executing step "Make"

When compile same project directly on my RPI i dont get this error either on that line.

pi@pi1:~/ip-camera/build $ make
g++ -c -pipe -O2 -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../ip-camera -I. -I/usr/local/include/libcamera -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -o main.o ../main.cpp
g++ -c -pipe -O2 -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../ip-camera -I. -I/usr/local/include/libcamera -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -o LibCamera.o ../LibCamera.cpp
g++ -Wl,-O1 -o ip-camera main.o LibCamera.o   -lcamera -lcamera-base /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so /usr/lib/arm-linux-gnueabihf/libQt5Gui.so /usr/lib/arm-linux-gnueabihf/libQt5Network.so /usr/lib/arm-linux-gnueabihf/libQt5Core.so -lGLESv2 -lpthread -latomic   
pi@pi1:~/ip-camera/build $ 

I use this cross-compilation setup:

https://www.interelectronix.com/qt-cross-compile-setup-scripts-raspberry-pi-4.html
https://www.interelectronix.com/configuring-qt-creator-ubuntu-20-lts-cross-compilation.html

Any ideas how to solve this linker error?

@henri

Have you updated libcamera.
Please take a look at the libcamera version

dpkg -l | grep libcamera

devasus@devasus:~/Desktop$ ssh [email protected]
pi@pi1:~ $ dpkg -l | grep libcamera
ii  libcamera-apps                         1.2.1-1                          armhf        libcamera-apps
ii  libcamera-dev:armhf                    0~git20230724+ad9428b4-1         armhf        complex camera support library (development files)
ii  libcamera0:armhf                       0~git20230724+ad9428b4-1         armhf        complex camera support library
ii  python3-libcamera                      0~git20230720+bde9b04f-1         armhf        complex camera support library (Python 3 bindings)

Some more stuff for info

PI:

pi@pi1:/lib/arm-linux-gnueabihf $ ls -la | grep libcamera
drwxr-xr-x  2 root root     4096 Sep  7 15:16 libcamera
lrwxrwxrwx  1 root root       21 Jul 24 08:56 libcamera-base.so -> libcamera-base.so.0.0
lrwxrwxrwx  1 root root       23 Jul 24 08:56 libcamera-base.so.0.0 -> libcamera-base.so.0.0.5
-rw-r--r--  1 root root   124504 Jul 24 08:56 libcamera-base.so.0.0.5
lrwxrwxrwx  1 root root       16 Jul 24 08:56 libcamera.so -> libcamera.so.0.0
lrwxrwxrwx  1 root root       18 Jul 24 08:56 libcamera.so.0.0 -> libcamera.so.0.0.5
-rw-r--r--  1 root root  1281848 Jul 24 08:56 libcamera.so.0.0.5
lrwxrwxrwx  1 root root       22 Jul 17 10:21 libcamera_app.so -> libcamera_app.so.1.2.1
-rw-r--r--  1 root root   632416 Jul 17 10:21 libcamera_app.so.1.2.1
pi@pi1:/usr/lib/arm-linux-gnueabihf $ ls -la | grep libcamera
drwxr-xr-x  2 root root     4096 Sep  7 15:16 libcamera
lrwxrwxrwx  1 root root       21 Jul 24 08:56 libcamera-base.so -> libcamera-base.so.0.0
lrwxrwxrwx  1 root root       23 Jul 24 08:56 libcamera-base.so.0.0 -> libcamera-base.so.0.0.5
-rw-r--r--  1 root root   124504 Jul 24 08:56 libcamera-base.so.0.0.5
lrwxrwxrwx  1 root root       16 Jul 24 08:56 libcamera.so -> libcamera.so.0.0
lrwxrwxrwx  1 root root       18 Jul 24 08:56 libcamera.so.0.0 -> libcamera.so.0.0.5
-rw-r--r--  1 root root  1281848 Jul 24 08:56 libcamera.so.0.0.5
lrwxrwxrwx  1 root root       22 Jul 17 10:21 libcamera_app.so -> libcamera_app.so.1.2.1
-rw-r--r--  1 root root   632416 Jul 17 10:21 libcamera_app.so.1.2.1
pi@pi1:/usr/local/lib/arm-linux-gnueabihf $ ls
gstreamer-1.0  libcamera  libcamera-base.so  libcamera-base.so.0.0  libcamera-base.so.0.0.5  libcamera.so  libcamera.so.0.0  libcamera.so.0.0.5  pkgconfig
pi@pi1:/usr/local/lib/arm-linux-gnueabihf/libcamera $ sudo find / -type f -name "*libcamera.so*"
/usr/local/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstlibcamera.so
/usr/local/lib/arm-linux-gnueabihf/libcamera.so.0.0.5
/usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstlibcamera.so
/usr/lib/arm-linux-gnueabihf/libcamera.so.0.0.5

dev PC for cross compile

root@devasus:~/rpi-qt/sysroot/lib/arm-linux-gnueabihf# ls -la | grep libcamera
drwxr-xr-x  2 root root     4096 sept   7 15:16 libcamera
lrwxrwxrwx  1 root root       22 juuli 17 10:21 libcamera_app.so -> libcamera_app.so.1.2.1
-rw-r--r--  1 root root   632416 juuli 17 10:21 libcamera_app.so.1.2.1
lrwxrwxrwx  1 root root       21 juuli 24 08:56 libcamera-base.so -> libcamera-base.so.0.0
lrwxrwxrwx  1 root root       23 juuli 24 08:56 libcamera-base.so.0.0 -> libcamera-base.so.0.0.5
-rw-r--r--  1 root root   124504 juuli 24 08:56 libcamera-base.so.0.0.5
lrwxrwxrwx  1 root root       16 juuli 24 08:56 libcamera.so -> libcamera.so.0.0
lrwxrwxrwx  1 root root       18 juuli 24 08:56 libcamera.so.0.0 -> libcamera.so.0.0.5
-rw-r--r--  1 root root  1281848 juuli 24 08:56 libcamera.so.0.0.5
root@devasus:~/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf# ls -la | grep libcamera
drwxr-xr-x  2 root root     4096 sept   7 15:16 libcamera
lrwxrwxrwx  1 root root       22 juuli 17 10:21 libcamera_app.so -> libcamera_app.so.1.2.1
-rw-r--r--  1 root root   632416 juuli 17 10:21 libcamera_app.so.1.2.1
lrwxrwxrwx  1 root root       21 juuli 24 08:56 libcamera-base.so -> libcamera-base.so.0.0
lrwxrwxrwx  1 root root       23 juuli 24 08:56 libcamera-base.so.0.0 -> libcamera-base.so.0.0.5
-rw-r--r--  1 root root   124504 juuli 24 08:56 libcamera-base.so.0.0.5
lrwxrwxrwx  1 root root       16 juuli 24 08:56 libcamera.so -> libcamera.so.0.0
lrwxrwxrwx  1 root root       18 juuli 24 08:56 libcamera.so.0.0 -> libcamera.so.0.0.5
-rw-r--r--  1 root root  1281848 juuli 24 08:56 libcamera.so.0.0.5
root@devasus:~/rpi-qt/sysroot/usr/local/lib/arm-linux-gnueabihf# ls
gstreamer-1.0  libcamera  libcamera-base.so  libcamera-base.so.0.0  libcamera-base.so.0.0.5  libcamera.so  libcamera.so.0.0  libcamera.so.0.0.5  pkgconfig

my qmake file:

TEMPLATE = app
CONFIG += c++17
QT += core network gui widgets
CONFIG += no_keywords
TARGET = ipcam

# Point your PKG_CONFIG_PATH environment variable to the
# libcamera install path libcamera.pc file ($prefix/lib/pkgconfig/libcamera.pc)
LIBS += -lstdc++
LIBS += -lcamera
LIBS += -levent_pthreads
LIBS += -lcamera-base

# Define the include directories for the external libraries
INCLUDEPATH += /usr/local/include/libcamera
INCLUDEPATH += /usr/include/event2

SOURCES += main.cpp \
    LibCamera.cpp

HEADERS += \
    LibCamera.h

target.path = /home/pi/
INSTALLS += target

The code itself basically modified version of Edwards libcamera-cpp-demo.

Is it problem that since i have libcamera installed in different locations when i cross compile different libcamera library files are used than when I compile locally on PI?

pi@pi1:/lib/arm-linux-gnueabihf $ nm -D libcamera.so.0.0.5 | grep "generateConfiguration"
001103c8 T _ZN9libcamera18PipelineHandlerUVC21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
00115b70 T _ZN9libcamera19PipelineHandlerVimc21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
001089d4 T _ZN9libcamera21SimplePipelineHandler21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
000f6190 T _ZN9libcamera3RPi19PipelineHandlerBase21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
0007f69c T _ZN9libcamera6Camera21generateConfigurationENS_4SpanIKNS_10StreamRoleELj4294967295EEE
pi@pi1:/lib/arm-linux-gnueabihf $ cd ../../
pi@pi1:/ $ cd usr/lib/arm-linux-gnueabihf/
pi@pi1:/usr/lib/arm-linux-gnueabihf $ nm -D libcamera.so.0.0.5 | grep "generateConfiguration"
001103c8 T _ZN9libcamera18PipelineHandlerUVC21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
00115b70 T _ZN9libcamera19PipelineHandlerVimc21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
001089d4 T _ZN9libcamera21SimplePipelineHandler21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
000f6190 T _ZN9libcamera3RPi19PipelineHandlerBase21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
0007f69c T _ZN9libcamera6Camera21generateConfigurationENS_4SpanIKNS_10StreamRoleELj4294967295EEE
pi@pi1:/usr/lib/arm-linux-gnueabihf $ cd /usr/local/lib/arm-linux-gnueabihf/
pi@pi1:/usr/local/lib/arm-linux-gnueabihf $ nm -D libcamera.so.0.0.5 | grep "generateConfiguration"
0052dbac T _ZN9libcamera10RkISP1Path21generateConfigurationEPKNS_12CameraSensorERKNS_4SizeENS_10StreamRoleE
005071e0 T _ZN9libcamera18PipelineHandlerISI21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
00589760 T _ZN9libcamera18PipelineHandlerUVC21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
0051ade4 T _ZN9libcamera21PipelineHandlerRkISP121generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
00567958 T _ZN9libcamera21SimplePipelineHandler21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
00537bc0 T _ZN9libcamera3RPi19PipelineHandlerBase21generateConfigurationEPNS_6CameraENS_4SpanIKNS_10StreamRoleELj4294967295EEE
003d90a0 T _ZN9libcamera6Camera21generateConfigurationENS_4SpanIKNS_10StreamRoleELj4294967295EEE

Ok so these are the files that are used when i compile locally with either cmake or qmake

pi@pi1:~/libcamera-cpp-demo/build $ cmake ..
-- /usr/local/include/libcamera
-- /usr/local/lib/arm-linux-gnueabihf/libcamera.so
-- /usr/local/lib/arm-linux-gnueabihf/libcamera-base.so
Found OpenCV
Includes:/usr/include/opencv4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/libcamera-cpp-demo/build

i dont know how to make sure which folder is used when i cross compile with qmake

I deleted all the libcamera.so and libcamera-base.so files from ~/rpi-qt/sysroot/lib. All the libcamera files from ~/rpi-qt/sysroot/usr/lib also disappeared with that move so i quess they were just symlinks then. Now i get new error when cross compling:

/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/10.3.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcamera
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/10.3.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcamera-base
tried spicifying the path in qmake pro file but that didnt work

LIBS += -L/usr/local/lib/arm-linux-gnueabihf/ -lcamera
LIBS += -L/usr/local/lib/arm-linux-gnueabihf/ -lcamera-base

It seems that it is still trying to look for the files from the /lib/arm-linux-gnu… or /usr/lib/arm-linux-gnu… folders and is not searching the libraries from the /usr/local/lib/arm-linux-gnu…

/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/root/rpi-qt/sysroot/ -Wl,-rpath,/usr/local/qt5.15/lib -Wl,-rpath-link,/root/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/root/rpi-qt/sysroot/lib/arm-linux-gnueabihf -o ipcam main.o LibCamera.o   -lstdc++ -L/usr/local/lib/arm-linux-gnueabihf/ -lcamera -levent_pthreads -lcamera-base /root/rpi-qt/qt5.15/lib/libQt5Widgets.so /root/rpi-qt/qt5.15/lib/libQt5Gui.so /root/rpi-qt/qt5.15/lib/libQt5Network.so /root/rpi-qt/qt5.15/lib/libQt5Core.so -L/root/rpi-qt/sysroot//usr/lib/arm-linux-gnueabihf -lGLESv2 -lpthread  

How to fix this?

Copied entire text from last post to chatgpt who told me to do the following:

Add the custom library paths to the library search paths

QMAKE_LFLAGS += -Wl,-rpath-link,/usr/local/lib/arm-linux-gnueabihf/

Specify the libraries with their full paths

LIBS += -L/usr/local/lib/arm-linux-gnueabihf/ -lcamera -lcamera-base

I did it but still got the same error.

/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/10.3.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcamera
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/10.3.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcamera-base

Then i changed it to

LIBS += -L/root/rpi-qt/sysroot/usr/local/lib/arm-linux-gnueabihf/ -lcamera -lcamera-base

Rebuilt and got back to the original error:

18:10:14: Running steps for project ip-camera...
18:10:14: Starting: "/usr/bin/make" clean -j4
/root/rpi-qt/qt5.15/bin/qmake -o Makefile ../ip-camera/ip-camera.pro -spec devices/linux-rasp-pi4-v3d-g++ CONFIG+=debug CONFIG+=qml_debug
rm -f moc_predefs.h
rm -f main.o LibCamera.o
rm -f *~ core *.core
18:10:14: The process "/usr/bin/make" exited normally.
18:10:14: Starting: "/root/rpi-qt/qt5.15/bin/qmake" /home/devasus/Desktop/ip-camera/ip-camera.pro -spec devices/linux-rasp-pi4-v3d-g++ CONFIG+=debug CONFIG+=qml_debug
18:10:14: The process "/root/rpi-qt/qt5.15/bin/qmake" exited normally.
18:10:14: Starting: "/usr/bin/make" -f /home/devasus/Desktop/build-ip-camera-PI1-Debug/Makefile qmake_all
make: Nothing to be done for 'qmake_all'.
18:10:14: The process "/usr/bin/make" exited normally.
18:10:14: Starting: "/usr/bin/make" -j4
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/root/rpi-qt/sysroot/ -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../ip-camera -I. -I/usr/local/include/libcamera -I/usr/include/event2 -I/root/rpi-qt/qt5.15/include -I/root/rpi-qt/qt5.15/include/QtWidgets -I/root/rpi-qt/qt5.15/include/QtGui -I/root/rpi-qt/qt5.15/include/QtNetwork -I/root/rpi-qt/qt5.15/include/QtCore -I. -I/root/rpi-qt/qt5.15/mkspecs/devices/linux-rasp-pi4-v3d-g++ -o main.o ../ip-camera/main.cpp
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/root/rpi-qt/sysroot/ -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../ip-camera -I. -I/usr/local/include/libcamera -I/usr/include/event2 -I/root/rpi-qt/qt5.15/include -I/root/rpi-qt/qt5.15/include/QtWidgets -I/root/rpi-qt/qt5.15/include/QtGui -I/root/rpi-qt/qt5.15/include/QtNetwork -I/root/rpi-qt/qt5.15/include/QtCore -I. -I/root/rpi-qt/qt5.15/mkspecs/devices/linux-rasp-pi4-v3d-g++ -o LibCamera.o ../ip-camera/LibCamera.cpp
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/root/rpi-qt/sysroot/ -Wl,-rpath-link,/root/rpi-qt/sysroot/usr/local/lib/arm-linux-gnueabihf/ -Wl,-rpath,/usr/local/qt5.15/lib -Wl,-rpath-link,/root/rpi-qt/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/root/rpi-qt/sysroot/lib/arm-linux-gnueabihf -o ipcam main.o LibCamera.o   -lstdc++ -L/root/rpi-qt/sysroot/usr/local/lib/arm-linux-gnueabihf/ -lcamera -lcamera-base -levent_pthreads /root/rpi-qt/qt5.15/lib/libQt5Widgets.so /root/rpi-qt/qt5.15/lib/libQt5Gui.so /root/rpi-qt/qt5.15/lib/libQt5Network.so /root/rpi-qt/qt5.15/lib/libQt5Core.so -L/root/rpi-qt/sysroot//usr/lib/arm-linux-gnueabihf -lGLESv2 -lpthread   
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/10.3.1/../../../../arm-linux-gnueabihf/bin/ld: LibCamera.o: in function `LibCamera::configureStill(int, int, libcamera::PixelFormat, int, int)':
/home/devasus/Desktop/build-ip-camera-PI1-Debug/../ip-camera/LibCamera.cpp:30: undefined reference to `libcamera::Camera::generateConfiguration(std::vector<libcamera::StreamRole, std::allocator<libcamera::StreamRole> > const&)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:267: ipcam] Error 1
18:10:19: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project ip-camera (kit: PI1)
When executing step "Make"
18:10:19: Elapsed time: 00:05.

Cross-compiler issue maybe?

Makefile when i build locally and i dont get that error not finding “generateConfiguration”:
https://jpst.it/3oi_U

Makefile when i cross compile and get the error
https://jpst.it/3oi_6

or maybe somebody here can point me to some linux dev forum where i could post this question?

I just tried cross compile on another PC where i had older sysroot of the same PI synced and i wasnt getting this error. (libcam was 0.0.4) as soon as i synced the rasperry pi sysroot i started to get the same error on another dev device.

/home/henri/Desktop/ip-camera/LibCamera.cpp:30: error: undefined reference to `libcamera::Camera::generateConfiguration(std::vector<libcamera::StreamRole, std::allocator<libcamera::StreamRole> > const&)'

any ideas how to fix this?

It seems that my QT .pro file was configured so that it would try to use /usr/local/include/libcamera as includepath instead of my cross-compile sysroot /root/rpi-qt/sysroot/usr/include/libcamera. I fixed that. Then also deleted all the libcamera.so* files from my dev pc cause i thought that linker might errounously try to link to libcamera library on my pc instead of cross-compile sysroot lib. Somehow the generateConfiguration error disappeared.

Unfortunately recently few new errors have appeared:

/root/rpi-qt/tools/cross-pi-gcc-10.3.0-64/bin/aarch64-linux-gnu-g++ --sysroot=/root/rpi-qt/sysroot/ -Wl,-rpath-link,/root/rpi-qt/sysroot/usr/lib/aarch64-linux-gnu/ -Wl,-rpath,/usr/local/qt5.15/lib -Wl,-rpath-link,/root/rpi-qt/sysroot/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/root/rpi-qt/sysroot/lib/aarch64-linux-gnu -o ip-camera main.o EchoServer.o LibCamera.o moc_EchoServer.o   -L/root/rpi-qt/sysroot/lib/aarch64-linux-gnu -lcamera -lcamera-base -levent_pthreads /root/rpi-qt/qt5.15/lib/libQt5Widgets.so /root/rpi-qt/qt5.15/lib/libQt5Gui.so /root/rpi-qt/qt5.15/lib/libQt5WebSockets.so /root/rpi-qt/qt5.15/lib/libQt5Network.so /root/rpi-qt/qt5.15/lib/libQt5Core.so -lGLESv2 -lEGL -lpthread   
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-64/bin/../lib/gcc/aarch64-linux-gnu/10.3.1/../../../../aarch64-linux-gnu/bin/ld: /root/rpi-qt/sysroot/usr/lib/aarch64-linux-gnu//libboost_log.so.1.74.0: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-64/bin/../lib/gcc/aarch64-linux-gnu/10.3.1/../../../../aarch64-linux-gnu/bin/ld: /root/rpi-qt/sysroot/lib/aarch64-linux-gnu/libcamera.so: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-64/bin/../lib/gcc/aarch64-linux-gnu/10.3.1/../../../../aarch64-linux-gnu/bin/ld: /root/rpi-qt/sysroot/lib/aarch64-linux-gnu/libcamera.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/root/rpi-qt/tools/cross-pi-gcc-10.3.0-64/bin/../lib/gcc/aarch64-linux-gnu/10.3.1/../../../../aarch64-linux-gnu/bin/ld: /root/rpi-qt/sysroot/usr/lib/aarch64-linux-gnu//libboost_log.so.1.74.0: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
make: *** [Makefile:270: ip-camera] Error 1
16:31:58: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project ip-camera (kit: RaspberryPi5 Qt5.15.8)

`std::condition_variable::wait(std::unique_lockstd::mutex&)@GLIBCXX_3.4.30
for this method i think i have pinned down what the issue is.
It seems that libcamera wants to use wait( GLIBCXX_3.4.30 method from but the cross-compiler im using has older libstc++ version thats GLIBCXX_3.4.11

nm -D /root/rpi-qt/tools/cross-pi-gcc-10.3.0-64/aarch64-linux-gnu/lib64/libstdc++.so.6.0.28 | grep wait
00000000000a4a10 T __atomic_flag_wait_explicit@@GLIBCXX_3.4.11
                 w pthread_cond_wait@GLIBC_2.17
00000000000cba20 T _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@@GLIBCXX_3.4.11
00000000000cf660 T _ZNSt28__atomic_futex_unsigned_base19_M_futex_wait_untilEPjjbNSt6chrono8durationIlSt5ratioILl1ELl1EEEENS2_IlS3_ILl1ELl1000000000EEEE@@GLIBCXX_3.4.21

it think thats the issue because when compiling my QT project directly on my Pi5 i dont get these errors i think because on the device there is

pi@pi5:/usr/lib/pkgconfig $ find / -type f -name '*libstdc++.so*' 2>/dev/null
/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30
/usr/share/gdb/auto-load/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30-gdb.py
pi@pi5:/usr/lib/pkgconfig $ nm -D /usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30 | grep wait
00000000000a0340 T __atomic_flag_wait_explicit@@GLIBCXX_3.4.11
                 U pthread_cond_wait@GLIBC_2.17
00000000000c7fd0 T _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@@GLIBCXX_3.4.30
00000000000a06e0 T _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@GLIBCXX_3.4.11
00000000000cc3a0 T _ZNSt28__atomic_futex_unsigned_base19_M_futex_wait_untilEPjjbNSt6chrono8durationIlSt5ratioILl1ELl1EEEENS2_IlS3_ILl1ELl1000000000EEEE@@GLIBCXX_3.4.21
00000000000cc520 T _ZNSt28__atomic_futex_unsigned_base26_M_futex_wait_until_steadyEPjjbNSt6chrono8durationIlSt5ratioILl1ELl1EEEENS2_IlS3_ILl1ELl1000000000EEEE@@GLIBCXX_3.4.29

the wait( GLIBCXX_3.4.30 method header.

Ill try to fix it by copying this file and the .py with similar name from my Pi5 sysroot to the cross compilers folder and see what happens. I cant just download newer version of the cross-compiler cause 10.3.0 is the latest they have made. Raspberry Pi GCC Toolchains - Browse /Bonus Raspberry Pi GCC 64-Bit Toolchains/Raspberry Pi GCC 64-Bit Cross-Compiler Toolchains/Bullseye at SourceForge.net

If anybody has better ideas how to fix this let me know.

This solution worked! I will be updating the 64-bit raspbery pi cross-compile scripts README.md with this fix and maybe sometime later will also make it automatic.