recipe for target '3rdparty/zlib/CMakeFiles/zlib.dir/all' failed

asked 2017-06-20 00:44:33 -0600

bot1131357 gravatar image

updated 2017-06-20 08:23:20 -0600

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

This post is 3 years old, but no one seemed to have answered it. Even Jesus (OP) gave up.

I'm using Xubuntu 16.04, and used crosstool-ng to build my toolchain (ct-ng armv8-rpi3-linux-gnueabihf)

Help, anyone?

Update: I decided to build zlib separately, and guess what? The same error happened for libtiff. When I build libtiff, I get error for libjpeg. Here's the dump:

[  5%] Linking C static library ../lib/liblibjpeg.a
Error running link command: No such file or directory
3rdparty/libjpeg/CMakeFiles/libjpeg.dir/build.make:1264: recipe for target '3rdparty/lib/liblibjpeg.a' failed
make[2]: *** [3rdparty/lib/liblibjpeg.a] Error 2
CMakeFiles/Makefile2:254: recipe for target '3rdparty/libjpeg/CMakeFiles/libjpeg.dir/all' failed
make[1]: *** [3rdparty/libjpeg/CMakeFiles/libjpeg.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

It's obvious something very fundamental is failing here.

edit retag flag offensive close merge delete