hadoop-common: CMake failed with error code 1

问题

在编译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中操作

  • 选择execute maven goal
  • 选择择命令 第一次直接输入即可 后续都可以从recent里找到历史执行的命令

hadoop-common: CMake failed with error code 1_第1张图片

  • 执行命令,然后在控制台中 查看错误信息
    hadoop-common: CMake failed with error code 1_第2张图片

然后在错误的日志找到对应的错误信息

-- 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”)

3. 解决

安装 zlib即可

brew install zlib 

4. 说明

其他错误 也可以参考如上方式 增加入参 -X -e 后续在观察报错日志 ,根据日志中的错误 对应的处理

你可能感兴趣的:(大数据搭建问题,hadoop,hadoop,源码编译)