I'm trying to cross-compile OpenCV into Raspberry Pi 3, but I got stuck at linking libzlib.a
My CMAKE command is as follows:
cmake -D CMAKE_BUILD_TYPE=RELEASE -DENABLE_NEON=ON -DBUILD_LIB=ON -DBUILD_ZLIB=ON \
-DCMAKE_AR=${AR} \
-DCMAKE_TOOLCHAIN_FILE=/home/ytan/Dev/opencv/platforms/linux/armv8-rpi3-linux-gnueabihf.toolchain.cmake -D CMAKE_INSTALL_PREFIX=~/Dev/build-pi3/opencv ..
And when I run make, I get this error:
[ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inftrees.c.o
[ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inffast.c.o
[ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/trees.c.o
[ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/uncompr.c.o
[ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/zutil.c.o
[ 2%] Linking C static library ../lib/libzlib.a
Error running link command: No such file or directory
3rdparty/zlib/CMakeFiles/zlib.dir/build.make:458: recipe for target '3rdparty/lib/libzlib.a' failed
make[2]: *** [3rdparty/lib/libzlib.a] Error 2
CMakeFiles/Makefile2:254: recipe for target '3rdparty/zlib/CMakeFiles/zlib.dir/all' failed
make[1]: *** [3rdparty/zlib/CMakeFiles/zlib.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I was referring to this post, but no one seemed to have answered it. I'm using Xubuntu 16.04, and used crosstool-ng to build my toolchain (ct-ng armv8-rpi3-linux-gnueabihf)
Help, anyone?