mac系统编译3.2.1版本hadoop

本文详细记录了在mac系统上编译Hadoop 3.2.1的过程,包括下载源码、安装必要依赖如maven、openssl、protobuf、cmake等,解决在编译过程中遇到的如'constexpr'和'literal'的C++11错误,以及编译完成后如何进行checknative检查。文章旨在帮助读者理解如何在mac系统上手动编译Hadoop以解决NativeCodeLoader警告。
摘要由CSDN通过智能技术生成

缘由

编译hadoop主要是为了解决安装hadoop缺少lib/native,发生的“WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform using builtin-java classes where applicable”警告,这个警告虽然不影响hadoop的正常运行
中间想过放弃编译直接下载安装包,用其中的lib/native,发现mac下不能用.so的包。

中间走的弯路,没有效果,是进到hadoop-hdfs-native-client中的src目录下运行的
cmake -DJVM_ARCH_DATA_MODEL=64 -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl@1.1/1.1.1g  -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl@1.1/1.1.1g/lib -DOPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl@1.1/1.1.1g/include -DPROTOBUF_INCLUDE_DIR=/usr/local/Cellar/protobuf/include -DPROTOBUF_LIBRARY=/usr/local/Cellar/protobuf/lib/libprotoc.dylib

步骤

下载hadoop源码

从官网上下载:下载地址
解压后注意阅读BUILDING.txt文件
Requirements:

  • Unix System
  • JDK 1.8
  • Maven 3.3 or later
  • ProtocolBuffer 2.5.0
  • CMake 3.1 or newer (if compiling native code)
  • Zlib devel (if compiling native code)
  • Cyrus SASL devel (if compiling native code)
  • One of the compilers that support thread_local storage: GCC 4.8.1 or later, Visual Studio,
    Clang (community version), Clang (version for iOS 9 and later) (if compiling native code)
  • openssl devel (if compiling native hadoop-pipes and to get the best HDFS encryption performance)
  • Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
  • Doxygen ( if compiling libhdfspp and generating the documents )
  • Internet connection for first build (to fetch all Maven and Hadoop dependencies)
  • python (for releasedocs)
  • bats (for shell code testing)
  • Node.js / bower / Ember-cli (for YARN UI v2 building)

安装maven

brew install maven

#或者下载maven的包解压到/usr/local/maven,在bash_profile中配置

export MAVEN_HOME=/usr/local/maven
export PATH=$PATH:$MAVEN_HOME/bin


#配置settings
<mirrors>
      <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>        
      </mirror>
      <mirror>
        <id>repo1</id>
        <mirrorOf>central</mirrorOf>
        <name>repo1 maven</name>
        <url>http://repo1.maven.org/maven2/</url>
      </mirror>
     <mirror>
         <id>repo2</id>
         <mirrorOf>central</mirrorOf>
         <name>repo2 maven</name>
         <url>http://repo2.maven.org/maven2/</url>
    </mirror>
</mirrors>

安装openssl


                
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值