Cross compile OpenCV but failed to find 3rd party library
Hi,
I want to cross compile customized OpenCV for arm board in my Linux x86 host machine. I followed tutorial here http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8
But set( CMAKE_FIND_ROOT_PATH "YOUR_LIB_PATH_LIST" ) can't find all my library listed in "YOUR_LIB_PATH_LIST".
I googled CMAKE about CMAKE_FIND_ROOT_PATH in (http://www.vtk.org/Wiki/CMake_Cross_Compiling). It says it will find "YOUR_LIB_PATH_LIST"/lib, "YOUR_LIB_PATH_LIST"/usr/lib, /lib and /usr/lib. The statement in cmake doc also implies that you can add additional path. But I tried. The additional path doesn't work.
I use NFS to mount library folder to my host machine. I can managed to make target machine /lib and /usr/lib accessible in CMAKE_FIND_ROOT_PATH by some tricks. But I can't make /usr/local/lib works.
Any comments will be appreciated.
I chased the macro CHECK_MODULE. It used pkg-config to look up library. It turns out that it ran target machine pkg-config binary in host machine.
I came up a quick solution:
Modify cmake/OpenCVFindPkgConfig.cmake ... find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/bin DOC "pkg-config executable" NO_CMAKE_FIND_ROOT_PATH)
Point host machine pkg-config path to target machine.
export PKG_CONFIG_PATH=/opt/Hackberryfs/usr/lib/pkgconfig:/opt/Hackberryfs/usr/local/lib/pkgconfig:/opt/Hackberryfs/usr/lib/arm-linux-gnueabihf/pkgconfig
However, I ran pkg-config. It is not smart enough to deal with cross compile env. I tried pkg-config gstreamer-0.10 in host machine. It return absolute path in target machine.
Anyway, the problem is not resolved.