I want to build opencv for a linux guest VM virtualbox on the host (where I run the opencv building for the target). I have created a VM sysroot folder on the host (using rsync to import VM /usr, share, lib, x86_64-linux-gnu…). But it’s seems there is a problem, probably with pkg_config and .pc files.
If host & VM have similar OS and sysroot contains a .pc file in an exotic folder as “/xxx…”, the substitution with “/sysroot/xxx…” is well done (opencv cmake finds it). But if sysroot contains also a .pc file existing in a regular folder as “/usr/lib/x86_64-linux-gnu…”, cmake uses directly the host .pc file and does not use the sysroot path.
May be I have to adapt the -D CMAKE_TOOLCHAIN_FILE toolchain or to create a specific one. In this case, have I to compile or cross-compile?
I develop with Eclipse cdt and remote debugging. Retired software engineer, I have a good experience and have already cross-compiled & debugged remotely (opencv, qt, websocket & many others …) for different targets.
Needs help… Cordially your’s.
In my case the guest VM & the host are running different versions of ubuntu .
host Ubuntu 20.04 uname -a:
Linux BazUbu 5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon Jan 18 17:52:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
guest Ubuntu 18.04 uname -a
Linux hgf-VirtualBox 4.15.0-135-generic #139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
buiding with opencv 4.0:
-D CMAKE_BUILD_TYPE=$DEF_OPCV4_CMAKE_BUILD_TYPE \
-D CMAKE_INSTALL_PREFIX=installation \
-D CMAKE_CROSSCOMPILING:BOOLEAN=TRUE \ (??? or FALSE ???)
-D CMAKE_TOOLCHAIN_FILE=…/platforms/linux/gnu.toolchain.cmake …/ \ (???)
-D WITH_GTK=ON \ -D ENABLE_PRECOMPILED_HEADERS=ON \
-D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib/modules \
-D OPENCV_ENABLE_NONFREE=ON \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=OFF \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D WITH_EIGEN=OFF \
-D WITH_CUDA=OFF \
-D BUILD_opencv_java=OFF \
-D BUILD_opencv_python=OFF \