Imagine, I want to build cv library for a linux ubuntu guest virtualbox machine and my host (where i'm running the build for the guest target) is also a linux ubuntu machine. Of course I've created a sysroot folder in the host (via rsync with target /usr/share, lib... images) but... It's seem there is a problem with pkg_config. If a .pc file contains a reference to something like/usr/lib/x86_64-linux-gnu cmake uses directly the host folder and don't substitute /sysroot/usr/lib/x86_64-linux-gnu.
How adapt the option -D CMAKE_TOOLCHAIN_FILE=../platforms/linux/gnu.toolchain.cmake ../ or modify a "gnu" toolchain to obtain a cross compile mode targeted on the good libraries of my sysroot folder?
Example my host runs virtualbox, eclipse cdt remote debug and so on. But the host don't have ffmpeg, libavutil-dev (of course these libraries are in the guest sysroot image).
If host & guest have the same OS and a .pc file contains a exotic folder as "/xxx" the substitution "/sysroot/xxx" is well done.
This problem don't appears if host & guest are differents, for example windows & linux.
Cordially your's.
Ubuntu 18.04 opencv 4.0
@@@@ Setting up exported variables ===================================== SYSROOT ='/media/DEV/KAM_000/targets/ubu1804/amd64/importedFiles' PKG_CONFIG_SYSROOT_DIR='/media/DEV/KAM_000/targets/ubu1804/amd64/importedFiles' LD_LIBRARY_PATH ='/media/DEV/KAM_000/targets/ubu1804/amd64/importedFiles/usr/lib/x86_64-linux-gnu' PKG_CONFIG_LIBDIR ='/media/DEV/KAM_000/targets/ubu1804/amd64/importedFiles/usr/lib/x86_64-linux-gnu' PKG_CONFIG_PATH ='/media/DEV/KAM_000/targets/ubu1804/amd64/importedFiles/usr/lib/x86_64-linux-gnu/pkgconfig:/media/DEV/KAM_000/targets/ubu1804/amd64/importedFiles/usr/share/pkgconfig' @@@@ cmake ============================================================= time cmake -D CMAKE_BUILD_TYPE=$DEF_OPCV4_CMAKE_BUILD_TYPE \ -D CMAKE_INSTALL_PREFIX=installation \ -D CMAKE_CROSSCOMPILING:BOOLEAN=TRUE \ -D CMAKE_TOOLCHAIN_FILE=../platforms/linux/$DEF_OPCV4_TOOLCHAIN.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 \ ..
=> CMakeSystem.cmake:
set(CMAKE_HOST_SYSTEM "Linux-4.15.0-54-generic") set(CMAKE_HOST_SYSTEM_NAME "Linux") set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-54-generic") set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") include("/media/DEV/KAM_000/targets/ubu1804/amd64/opencv40/opencv/platforms/linux/gnu.toolchain.cmake") set(CMAKE_SYSTEM "Linux-4.15.0-54-generic") set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_VERSION "4.15.0-54-generic") set(CMAKE_SYSTEM_PROCESSOR "x86_64") set(CMAKE_CROSSCOMPILING "FALSE") ===== set(CMAKE_SYSTEM_LOADED 1)