在windows win32与amd64上构建hadoop

vs91vp4v  于 2021-05-30  发布在  Hadoop
关注(0)|答案(1)|浏览(600)

我尝试在windows上构建hadoop2.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]

基本上是说我要切换到32位构建环境。但当我现在这么做的时候

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.

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

fumotvh3

fumotvh31#

您还必须正确设置平台。
将生成环境设置为x64的完整命令包括:

setenv /x64
set TARGET_CPU=x64
set platform=x64

相关问题