在编译hadoop源码时遇到如下错误 hadoop-common: CMake failed with error code 1
看了这个错误表示一脸懵逼
在mvn 的命令中增加 -X 和 -e
mvn clean package -e -X -Pdist,native -DskipTests -Dmaven.javadoc.skip -Dopenssl.prefix=/usr/local/bin/openssl
在idea中操作
然后在错误的日志找到对应的错误信息
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Java: /usr/local/develop/java/zulu-jdk8.0.382/bin/java (found version "1.8.0.382")
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
-- Found JNI: /usr/local/develop/java/zulu-jdk8.0.382/include found components: AWT JVM
CMake Error at /usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/FindZLIB.cmake:199 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:47 (find_package)
明显的错误 信息 Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version “1.2.11”)
安装 zlib即可
brew install zlib
其他错误 也可以参考如上方式 增加入参 -X -e 后续在观察报错日志 ,根据日志中的错误 对应的处理