在Windows Win32和amd64上构建hadoop

时间:2014-11-27 13:20:04

标签: windows hadoop cpu-architecture

我尝试在Windows上构建hadoop 2.5.0以在IDEA中使用它。但是,如果我启动VisualStudio控制台并使用

setenv /x64
set TARGET_CPU=x64

我收到此错误消息:

[INFO] --- exec-maven-plugin:1.2:exec (compile-ms-winutils) @ hadoop-common ---
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 27.11.2014 14:11:31.
Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Win32".
Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.sln" (1) is building "C:\Users\bachmann.s\R
CV\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.vcxproj.metaproj" (2) on node 1 (default targets).
Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.vcxproj.metaproj" (2) is building "C:\Users
\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\libwinutils.vcxproj" (3) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\Windows7.1SDK\Microsoft.Cpp.Win32.Windows7.1SDK.targets(20,5): error : You ar
e attempting to build a Win32 application from an x64 environment. If using the Windows 7.1 SDK build environment, type setenv /x86 [C:\Users\user\had
oop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\libwinutils.vcxproj]
Done Building Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\libwinutils.vcxproj" (default targets)
 -- FAILED.
Done Building Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.vcxproj.metaproj" (default ta
rgets) -- FAILED.
Done Building Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.sln" (default targets) -- FAI
LED.

Build FAILED.

"C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.sln" (default target) (1) ->
"C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\winutils.vcxproj.metaproj" (default target) (2) ->
"C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\libwinutils.vcxproj" (default target) (3) ->
(_WindowsSDKPrepareForBuild target) ->
  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\Windows7.1SDK\Microsoft.Cpp.Win32.Windows7.1SDK.targets(20,5): error : You
are attempting to build a Win32 application from an x64 environment. If using the Windows 7.1 SDK build environment, type setenv /x86 [C:\Users\user\h
adoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\winutils\libwinutils.vcxproj]

基本上说我要切换到32bit Build Enviroment。 但是,当我现在做的时候

setenv /x86
set TARGET_CPU=x86

并开始新的构建,maven给了我以下错误:

[INFO] --- exec-maven-plugin:1.2:exec (compile-ms-native-dll) @ hadoop-common ---
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 27.11.2014 14:17:06.
Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\native\native.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Mixed Platforms".
Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\native\native.sln" (1) is building "C:\Users\user\h
adoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj" (2) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Windows7.1SDK\Microsoft.Cpp.x64.Windows7.1SDK.targets(20,5): error : You are at
tempting to build an AMD64 application from an x86 environment. If using the Windows 7.1 SDK, type setenv /x64 [C:\Users\user\hadoop\hadoop-common\had
oop-common-project\hadoop-common\src\main\native\native.vcxproj]
Done Building Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj" (default targets) -- FAI
LED.
Done Building Project "C:\Users\user\hadoop\hadoop-common\hadoop-common-project\hadoop-common\src\main\native\native.sln" (default targets) -- FAILED.


Build FAILED.

为什么所有项目都在不同的架构中,或者我是否需要设置一些其他选项来完全构建一个架构?

1 个答案:

答案 0 :(得分:2)

您还必须正确设置平台。

将构建环境设置为x64的完整命令是:

setenv /x64
set TARGET_CPU=x64
set platform=x64