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

Cross compile OpenCV installed from apt repository #19

Open
EntnyJill opened this issue Mar 22, 2022 · 1 comment
Open

Cross compile OpenCV installed from apt repository #19

EntnyJill opened this issue Mar 22, 2022 · 1 comment

Comments

@EntnyJill
Copy link

Hello. I've installed OpenCV 4.5.1 to Raspberry Pi 3b from apt repository. Now I'm trying to cross compile OpenCV test from your guide. I've succesffuly synced XCS with RPI using script sync-xcs-rpi.sh but now I cannot compile test example.
CMake command executes successfully

cmake \
    -D CMAKE_TOOLCHAIN_FILE=$XC_RPI_BASE/rpicross_notes/rpi-generic-toolchain.cmake \
    $XC_RPI_BASE/rpicross_notes/hello/ocv

But make command gives a bunch of errors :

/home/pi/rpi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libblas.so.3, needed by /home/pi/rpi/rootfs/lib/libarmadillo.so.10, not found (try using -rpath or -rpath-link)
/home/pi/rpi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: warning: liblapack.so.3, needed by /home/pi/rpi/rootfs/lib/libarmadillo.so.10, not found (try using -rpath or -rpath-link)
CMakeFiles/hellocv.dir/hello.cpp.o: In function `main':
hello.cpp:(.text+0x94): undefined reference to `cv::imread(std::string const&, int)'
hello.cpp:(.text+0x13c): undefined reference to `cv::namedWindow(std::string const&, int)'
hello.cpp:(.text+0x1a0): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
/home/pi/rpi/rootfs/usr/lib/arm-linux-gnueabihf/libopencv_surface_matching.so.4.5.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned int) const@GLIBCXX_3.4.21'
/home/pi/rpi/rootfs/lib/libarmadillo.so.10: undefined reference to `zgemm_'
/home/pi/rpi/rootfs/usr/lib/arm-linux-gnueabihf/libarpack.so.2: undefined reference to `clahqr_'

and so on.
I can build test file without errors on Raspberry Pi.
How can I deal with it? Thank you.

@HesselM
Copy link
Owner

HesselM commented Apr 29, 2022

The error is a linking-error: some files are not in the rootfs.

If you downloaded and install OpenCV directly on your rasberrpy pi (instead of crosscompiling) it is likely the case that the sync-script does not import all (required) files back from the pi to rootfs. You might need to search on the raspberry pi for the directory of the .c files holding the referred implementation and add those directories to the sync-script.

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