I'm trying to build ORB_SLAM2 on macOS 11.4 with clang 12 and OpenCV4 and have run into this error:
make[2]: *** No rule to make target `/usr/lib/libz.dylib', needed by `../lib/libORB_SLAM2.dylib'. Stop.
This file does not exist on my Mac and I cannot add this symlink due to macOS's SIP. The correct path should be /usr/local/opt/zlib/lib/libz.dylib
How can I fix this /usr/lib/libz.dylib
reference?
Here is my branch with my macOS build changes.
I've tried to fix the problem by:
otool -L
and rebuilt from source where necessary (such as OpenCV) to make sure /usr/lib/libz.dylib
is not referenced (fix suggested here)FindZLIB.cmake
module in the ORB_SLAM2 CMakeLists.txt
to ensure the correct ZLIB is foundBelow is the output showing ZLIB is found but still no luck:
-- Found ZLIB: /usr/local/opt/zlib/lib/libz.dylib (found version "1.2.11")
Solved: I checked the CMakeFiles/Makefile.cmake and it showed me that the Pangolin library I was using was actually one from another project of mine. Building Pangolin in this project solved the issue.