【Hadoop实战】Windows环境下编译Hadoop2(2.10.2-R0)

news2024/9/25 11:14:56

Windows环境下编译Hadoop2(2.10.2-R0)IDE

前提

根据Hadoop源码包解压之后编译帮助文件BUILDING.txt中关于windows的要求来准备环境

----------------------------------------------------------------------------------

Building on Windows

----------------------------------------------------------------------------------
Requirements:

* Windows System
* JDK 1.7 or 1.8
* Maven 3.0 or later
* Findbugs 1.3.9 (if running findbugs)
* ProtocolBuffer 2.5.0
* CMake 2.6 or newer
* Windows SDK 7.1 or Visual Studio 2010 Professional
* Windows SDK 8.1 (if building CPU rate control for the container executor)
* zlib headers (if building native code bindings for zlib)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
* Unix command-line tools from GnuWin32: sh, mkdir, rm, cp, tar, gzip. These
  tools must be present on your PATH.
* Python ( for generation of docs using 'mvn site')

Unix command-line tools are also included with the Windows Git package which
can be downloaded from http://git-scm.com/downloads

If using Visual Studio, it must be Visual Studio 2010 Professional (not 2012).
Do not use Visual Studio Express.  It does not support compiling for 64-bit,
which is problematic if running a 64-bit system.  The Windows SDK 7.1 is free to
download here:

http://www.microsoft.com/en-us/download/details.aspx?id=8279

The Windows SDK 8.1 is available to download at:

http://msdn.microsoft.com/en-us/windows/bg162891.aspx

Cygwin is neither required nor supported.

本机环境

  • JDK1.8
  • Windows 10 64位专业版
  • maven 3.9.2
  • git 2.41.0
  • ProtocolBuffer 2.5.0 这个要求要满足不然有报错(Github地址)
  • cmake 2.36.4
  • Visual Studio 2022 Professional
  • cygwin 安装包
  • IDEA 2022.2.5

编译方式

使用VS2022的x86 Native Tools Command Prompt for VS 2022命令窗口进行编译,窗口位置C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2022\Visual Studio Tools\VC

mvn clean package -Pdist -DskipTests

22

问题小结

安装Visual Studio之后,所有问题几乎全部解决。

问题1

hadoop-annotations: Compilation failure: Compilation failure:
[ERROR] /F:/open-source-code/hadoop/hadoop-release-2.10.2-RC0/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/RootDocProcessor.java:[20,23] ▒▒▒▒▒com.sun.javadoc▒▒▒▒▒▒

确定好JDK的版本

问题2

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.1:exec (compile-ms-winutils) on project hadoop-common: Command execution failed.: Cannot run program "msbuild" (in directory "F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-common"): CreateProcess error=2, ϵͳ▒Ҳ▒▒▒ָ▒▒▒▒▒ļ▒▒▒ -> [Help 1]

msbuild是微软的一个编译工具,这里提示找不到msbuild,因此可能是没有安装msbuild或没有配置到环境变量中。下面这样是不行的,还会报其他的错,正确的方式是需要下载Visual Studio,并将msbuild的路径(如,C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin)加入到系统环境变量Path中。

# 因为这个目录下有msbuild.exe文件
C:\Windows\Microsoft.NET\Framework\v4.0.30319

问题3

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.1:exec (compile-ms-winutils) on project hadoop-common: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

方式一

通过VS2022打开,并重定向F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-common\src\main\winutils\winutils.slnF:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-common\src\main\native\native.sln
33
方式二

通过注释的内容来跳过,在hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-common项目下的pom.xml

          <!--<plugin>
             <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>compile-ms-winutils</id>
                <phase>compile</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>msbuild</executable>
                  <arguments>
                    <argument>${basedir}/src/main/winutils/winutils.sln</argument>
                    <argument>/nologo</argument>
                    <argument>/p:Configuration=Release</argument>
                    <argument>/p:OutDir=${project.build.directory}/bin/</argument>
                    <argument>/p:IntermediateOutputPath=${project.build.directory}/winutils/</argument>
                    <argument>/p:WsceConfigDir=${wsce.config.dir}</argument>
                    <argument>/p:WsceConfigFile=${wsce.config.file}</argument>
                  </arguments>
                </configuration>
              </execution>
              <execution>
                <id>compile-ms-native-dll</id>
                <phase>compile</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>msbuild</executable>
                  <arguments>
                    <argument>${basedir}/src/main/native/native.sln</argument>
                    <argument>/nologo</argument>
                    <argument>/p:Configuration=Release</argument>
                    <argument>/p:OutDir=${project.build.directory}/bin/</argument>
                    <argument>/p:CustomSnappyPrefix=${snappy.prefix}</argument>
                    <argument>/p:CustomSnappyLib=${snappy.lib}</argument>
                    <argument>/p:CustomSnappyInclude=${snappy.include}</argument>
                    <argument>/p:RequireSnappy=${require.snappy}</argument>
                    <argument>/p:CustomZstdPrefix=${zstd.prefix}</argument>
                    <argument>/p:CustomZstdLib=${zstd.lib}</argument>
                    <argument>/p:CustomZstdInclude=${zstd.include}</argument>
                    <argument>/p:RequireZstd=${require.zstd}</argument>
                    <argument>/p:CustomOpensslPrefix=${openssl.prefix}</argument>
                    <argument>/p:CustomOpensslLib=${openssl.lib}</argument>
                    <argument>/p:CustomOpensslInclude=${openssl.include}</argument>
                    <argument>/p:RequireOpenssl=${require.openssl}</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin> -->

问题4

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured: java.net.ConnectException: Connection timed out: connect
[ERROR] around Ant part ...<get skipexisting="true" src="https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.75/bin/apache-tomcat-8.5.75.tar.gz" dest="downloads/apache-tomcat-8.5.75.tar.gz" verbose="true"/>... @ 5:183 in F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-kms\target\antrun\build-main.xml
[ERROR] -> [Help 1]

(有点挫,不知道为啥下不下来,单独从浏览器是可以下载的)

手动下载,放到对应的目录上,然后在注释的内容,在hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-kms项目下的pom.xml

 <!-- <get
      src="${tomcat.download.url}"
      dest="downloads/apache-tomcat-${tomcat.version}.tar.gz"
      verbose="true" skipexisting="true"/> -->

Apache Hadoop HttpFS模块同样的问题,同样的处理。

问题5

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-hdfs-native-client: An Ant BuildException has occured: exec returned: 1
[ERROR] around Ant part ...<exec failonerror="true" dir="F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-hdfs-project\hadoop-hdfs-native-client\target/native" executable="cmake">... @ 8:166 in F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-hdfs-project\hadoop-hdfs-native-client\target\antrun\build-main.xml
[ERROR] -> [Help 1]

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-hdfs-native-client: An Ant BuildException has occured: F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-hdfs-project\hadoop-hdfs-native-client\target\native\bin\RelWithDebInfo does not exist.
[ERROR] around Ant part ...<copy todir="F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-hdfs-project\hadoop-hdfs-native-client\target/bin">... @ 14:127 in F:\open-source-code\hadoop\hadoop-release-2.10.2-RC0\hadoop-hdfs-project\hadoop-hdfs-native-client\target\antrun\build-main.xml
[ERROR] -> [Help 1]

应该还是跟native的环境要求有关,这里选择了跳过,在hadoop-release-2.10.2-RC0\hadoop-common-project\hadoop-kms项目下的pom.xml中,failonerror的值改为false,增加新建文件夹RelWithDebInfo的方法。

<configuration>
                  <target>
                    <mkdir dir="native/bin/RelWithDebInfo"/>
                    <condition property="generator" value="Visual Studio 10" else="Visual Studio 10 Win64">
                      <equals arg1="Win32" arg2="${env.PLATFORM}" />
                    </condition>
                    <mkdir dir="${project.build.directory}/native"/>
                    <exec executable="cmake" dir="${project.build.directory}/native"
                          failonerror="false">
                      <arg line="${basedir}/src/ -DGENERATED_JAVAH=${project.build.directory}/native/javah -DJVM_ARCH_DATA_MODEL=${sun.arch.data.model} -DREQUIRE_FUSE=${require.fuse} -G '${generator}'"/>
                    </exec>
                    <exec executable="msbuild" dir="${project.build.directory}/native"
                          failonerror="false">
                      <arg line="ALL_BUILD.vcxproj /nologo /p:Configuration=RelWithDebInfo /p:LinkIncremental=false"/>
                    </exec>
                    <!-- Copy for inclusion in distribution. -->
                    <copy todir="${project.build.directory}/bin">
                      <fileset dir="${project.build.directory}/native/bin/RelWithDebInfo"/>
                    </copy>
                  </target>
                </configuration>

问题6

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.1:exec (pre-dist) on project hadoop-hdfs-native-client: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

以下是互联网上的一种解法,但是在我未安装VS2022时并没有解决。然后是通过安装VS2022之后,使用x86 Native Tools Command Prompt for VS 2022命令窗口执行编译命令成功的。

下载安装Cygwin

配置cygwin64\bin到PATH

F:\software\cygwin64\bin

然后打开cygwin64的terminal窗口,执行命令

 mvn package -Pdist -DskipTests -Dtar -e -X -rf :hadoop-hdfs-native-client

导入IDEA

编译成功后使用IEDA打开源码即可,在打开的时候,会下载一些maven插件,可使用阿里云的maven仓库。
11

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/696353.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

龙蜥白皮书精选:面向芯片研发和验证的操作系统 SiliconFastOS

文/RISC-V ARCH SIG 01 背景介绍 随着 Arm 和 RISC-V 芯片研发的大爆发&#xff0c;越来越多的芯片设计、制造厂商甚至是云厂商都开始参与到芯片领域中来。面对芯片使用者尤其是处理器芯片与日俱增的需求&#xff0c;且芯片研发研发和流片成本高&#xff0c;芯片制造厂商必…

AIGC时代已经到来,如何满足其日益增长的算力需求

2023年是AI人工智能技术全面爆红的一年。以ChatGPT、GPT-4、文心一言为代表的AIGC大模型&#xff0c;集文本撰写、代码开发、诗词创作等功能于一体&#xff0c;展现出了超强的内容生产能力&#xff0c;带给人们极大震撼。 AIGC是什么&#xff1f; AIGC&#xff0c;AI-Generat…

【鲁棒优化、机会约束】不确定风功率接入下电 - 气互联系统的协同经济调度(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

【kubernetes系列】Kubernetes之pod、lable和annotation

本章节将继续分享关于kubernetes中的一些重要概念。 一、Pod Pod 是 Kubernetes 的最小工作单元。每个 Pod 包含一个或多个容器。Pod 中的容器会作为一个整体被 Master 调度到某个 Node 上运行。(可以把pod想象成豌豆荚&#xff0c;里面的豌豆就是容器&#xff0c;可以有一个…

Go编写免杀木马

先看一下效果 微步云沙箱检测 文件目录&#xff0c;运行main.exe cs上线 这里window denfender一直开启 思路&#xff1a; 分为三个文件&#xff1a; main.gox1.bin&#xff08;加密后的exe文件&#xff09;x2.bin&#xff08;加密后的shellcode文件&#xff09; 启动ma…

Linux Mint 21.2 前瞻:触控板手势支持来了

导读Linux Mint 是一款基于 Ubuntu 的流行 Linux 发行版本&#xff0c;其最新版本 21.2 将于 7 月发布。据悉&#xff0c;Linux Mint 的触摸板手势基于开源软件 TouchEgg&#xff0c;该手势功能支持触摸板、触摸屏及平板电脑等终端&#xff0c;用户可以自定义多种手势&#xff…

1751_使用Perl进行目录的创建于删除

全部学习汇总&#xff1a; GreyZhang/perl_basic: some perl basic learning notes. (github.com) 不管是用Perl还是Python&#xff0c;之前写代码的时候遇到需要进行目录的创建或者删除指令的时候我通常会直接调用Windows的相关命令或者使用移植过来的bash shell命令。其实&am…

视频汇聚融合共享EasyCVR平台如何在分享页增加控制台跳转?

EasyCVR可拓展性强、视频能力灵活、部署轻快&#xff0c;可支持的主流标准协议有GB28181、RTSP/Onvif、RTMP等&#xff0c;以及厂家私有协议与SDK接入&#xff0c;包括海康Ehome、海大宇等设备的SDK等&#xff0c;能对外分发RTSP、RTMP、FLV、HLS、WebRTC等格式的视频流。 在Ea…

MKDCNet分割模型搭建

原论文&#xff1a;https://arxiv.org/abs/2206.06264v1源码&#xff1a;https://github.com/nikhilroxtomar/MKDCNet 直接步入正题~~~ 一、基础模块 class Conv2D(nn.Module):def __init__(self, in_c, out_c, kernel_size3, padding1, dilation1, biasFalse, actTrue):sup…

2.8C++继承和组合

C 继承和组合 C中的继承和组合都是面向对象的重要概念&#xff0c;它们可以帮助我们构建更加灵活和可扩展的程序。 继承是一种机制&#xff0c;它允许我们创建一个新的类&#xff0c;该类从现有的类中继承属性和方法。 在C中&#xff0c;我们使用关键字 class 或 struc 来定…

华为云obs桶授权

登录华为云控制台 https://auth.huaweicloud.com/authui/login.html?servicehttps://console.huaweicloud.com/console/#/login 进入并行文件系统页面 进入桶 添加ACL授权,填写被授权账号ID,点击确定即可

IMX6ULL系统移植篇-镜像烧写说明

一. 镜像烧写简介 之前一篇文章学习了 阿尔法开发板烧写镜像的方法。 即将 镜像烧写到 Nand-Flash内部&#xff0c;设备最终从 Nand-Flash启动。说明博文如下&#xff1a; IMX6ULL系统移植篇-镜像烧写方法_凌肖战的博客-CSDN博客 二. 镜像烧写说明 之前文章说明了 使用 mfg…

基于vue+Element Table 表格的封装

项目场景&#xff1a; 项目场景&#xff1a;需要频繁使用列表进行呈现数据&#xff0c;不可能每次都写一个表格&#xff0c;可以将表格封装为一个组件&#xff0c;在需要使用时可以直接调用。 效果展示&#xff1a; 项目结构&#xff1a; 具体实现&#xff1a; Table.vue <…

总结linux防火墙firewall端口开通步骤

之前开通过服务器端口&#xff0c;在这里也记录和分享一下。 Step1:检查白名单&#xff1a; sudo firewall-cmd --list-port step2:添加8080端口到白名单 [user zhangsan ~]$ sudo firewall-cmd --zonepublic --add-port8080/tcp --permanent Success Step3&#xff1a;r…

UR5机器人示教器使用——可视化控制部分(非编程)

感谢董青云师兄教我使用示教器 1.UR5机器人示教器 问师兄 3楼 UR-robotic 的控制 示教器相关内容&#xff08;UR5机器人的控制&#xff0c;有UR机器人的仿真环境&#xff0c;需要在虚拟器上运行&#xff09; 1.示教器上的控制有正逆控制&#xff1a;逆向运动学通常用于计算机…

同态加密的类型,同态加密示例

目录 什么是同态加密 同态加密的类型 同态加密示例 什么是同态加密 同态加密&#xff08;Homomorphic Encryption&#xff09;是指将原始数据经过同态加密后&#xff0c;对得到的密文进行特定的运算&#xff0c;然后将计算结果再进行同态解密后得到的明文等价于原始明文数据…

DJI AIR 2S

一、注意事项 注意&#xff1a; 1、侧飞时需要注意&#xff0c;没有侧向避障 2、返航高度设置&#xff0c;应高于飞行区域高楼高度&#xff08;如269m&#xff09; 3、遥控与飞机之间不能有建筑物遮挡&#xff0c;如果出现信号弱&#xff08;上升高度会改善信息&#xff09; 4、…

doris on k8s 的安装部署

官方文档 1. 按照官网提供地址下载部署文件 2. 修改内核配置 sysctl -w vm.max_map_count20000003. 根据服务器环境&#xff0c;修改doris_be.yml文件。 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the…

深度学习编译器对比:The Deep Learning Compiler A Comprehensive Survey

参考&#xff1a;The Deep Learning Compiler: A Comprehensive Survey 记录几种深度学习编译器的功能和性能的对比&#xff1b; TVM在CPU和GPU的表现最好&#xff1b; MobileNet:TVM在conv、linear、expand表现最好&#xff1b;XLA在dewise的表现最好&#xff1b;

赛效:如何在线做图表

1&#xff1a;打开并登录图表秀&#xff0c;点击“我的模板”菜单里的“新建图表”。 2&#xff1a;根据自己的需要&#xff0c;在右侧的模板里选择一个。图表编辑区域里&#xff0c;会自动出现刚才点击的图表。 3&#xff1a;我们可以直接在右侧区域里编辑图标属性&#xff0c…