dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.19k stars 4.72k forks source link

[ARM32|Windows] VS2017 arm target build is broken - unmatched pushd popd commands #8612

Closed 4creators closed 4 years ago

4creators commented 7 years ago

coreclr repo does not build correctly with command build all arm Debug|Checked|Release on Windows.

With reinstalled Windows Kit 15063 (see issue dotnet/runtime#8582) build succeeds up to a point which is indicated below:

Build commnd: e:\src\ms\dotnet\coreclrarm>build all arm Debug skiptests

  -- Install configuration: "Debug"
  -- Installing: e:/src/ms/dotnet/coreclrarm/bin/Product/Windows_NT.arm.Debug/inc/corerror.h
.....
  -- Installing: e:/src/ms/dotnet/coreclrarm/bin/Product/Windows_NT.arm.Debug/PDB/ilasm.pdb

Build succeeded.

LINK : warning LNK4266: missing load config symbol for image built with /GUARD [E:\src\ms\dotnet\coreclrarm\bin\obj\Windows_NT.arm.Debug\src\dlls\clretwrc\clretwrc.vcxproj]
LINK : warning LNK4266: missing load config symbol for image built with /GUARD [E:\src\ms\dotnet\coreclrarm\bin\obj\Windows_NT.arm.Debug\src\dlls\mscorrc\small\mscorrc.vcxproj]
LINK : warning LNK4266: missing load config symbol for image built with /GUARD [E:\src\ms\dotnet\coreclrarm\bin\obj\Windows_NT.arm.Debug\src\dlls\mscorrc\full\mscorrc.debug.vcxproj]
    3 Warning(s)
    0 Error(s)

Time Elapsed 00:12:23.62
Command execution succeeded.
BUILD: Commencing build of cross architecture native components for Windows_NT.arm.Debug
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26711.1
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
The input line is too long.
The syntax of the command is incorrect.
C:\Users\developer\Source>

Building directly from e:\coreclr fails as well.

After setting environment variable _echo=1 one can see the following problematic output:

Build succeeded.

LINK : warning LNK4266: missing load config symbol for image built with /GUARD [E:\coreclr\bin\obj\Windows_NT.arm.Debug\src\dlls\clretwrc\clretwrc.vcxproj]
LINK : warning LNK4266: missing load config symbol for image built with /GUARD [E:\coreclr\bin\obj\Windows_NT.arm.Debug\src\dlls\mscorrc\small\mscorrc.vcxproj]
LINK : warning LNK4266: missing load config symbol for image built with /GUARD [E:\coreclr\bin\obj\Windows_NT.arm.Debug\src\dlls\mscorrc\full\mscorrc.debug.vcxproj]
    3 Warning(s)
    0 Error(s)

Time Elapsed 00:11:20.52
Command execution succeeded.

e:\coreclr>popd

C:\Users\developer\Source>if NOT [0] == [0] (exit /b 1 )

C:\Users\developer\Source>exit /b 0

Earlier during build directly after CMAKE run current build directory is changed to C:\Users\developer\Source>

BUILD: Commencing build of native components for Windows_NT.arm.Debug
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86_arm
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26711.1
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_arm'
BUILD: Regenerating the Visual Studio solution
-- The C compiler identification is MSVC 19.11.25505.0
-- The CXX compiler identification is MSVC 19.11.25505.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/arm/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/arm/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/arm/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/arm/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- VS_PLATFORM_TOOLSET is v141
-- VS_PLATFORM_NAME is ARM
Using Windows SDK version 10.0.15063.0
CMAKE_ASM_MASM_COMPILER explicitly set to: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.11.25503//bin/HostX86/arm/armasm.exe
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.11.25503//bin/HostX86/arm/armasm.exe
-- Warning: Did not find file Compiler/MSVC-ASM
Generated  - E:/coreclr/bin/obj/Windows_NT.arm.Debug/src/vm/wks/runasm_asmhelpers_.cmd
Generated  - E:/coreclr/bin/obj/Windows_NT.arm.Debug/src/vm/wks/runasm_CrtHelpers_.cmd
Generated  - E:/coreclr/bin/obj/Windows_NT.arm.Debug/src/vm/wks/runasm_ehhelpers_.cmd
Generated  - E:/coreclr/bin/obj/Windows_NT.arm.Debug/src/vm/wks/runasm_memcpy_.cmd
Generated  - E:/coreclr/bin/obj/Windows_NT.arm.Debug/src/vm/wks/runasm_patchedcode_.cmd
Generated  - E:/coreclr/bin/obj/Windows_NT.arm.Debug/src/vm/wks/runasm_PInvokeStubs_.cmd
-- Configuring done
-- Generating done
-- Build files have been written to: E:/coreclr/bin/obj/Windows_NT.arm.Debug

C:\Users\developer\Source>setlocal

C:\Users\developer\Source>if not defined VisualStudioVersion (
if defined VS150COMNTOOLS (
if not exist "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\Tools\\..\IDE\devenv.exe" goto NoVS
 if not exist "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall.bat" goto NoVS
 if not exist "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\Tools\\VsDevCmd.bat" goto NoVS
 call "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\Tools\\VsDevCmd.bat"
 goto :Run
)  else if defined VS140COMNTOOLS (
if not exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\..\IDE\devenv.exe" goto NoVS
 if not exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\..\..\VC\vcvarsall.bat" goto NoVS
 if not exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\VsDevCmd.bat" goto NoVS
 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\VsDevCmd.bat"
 goto :Run
)
 echo Error: Visual Studio 2015 or 2017 required.
 echo        https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions.
 exit /b 1
)

C:\Users\developer\Source>set Platform=

C:\Users\developer\Source>call e:\coreclr\init-tools.cmd

Later the pushd command is executed storing wrong directory C:\Users\developer\Source> instead of e:\coreclr\ on command directory stack.

C:\Users\developer\Source>pushd e:\coreclr\

e:\coreclr>echo Running: e:\coreclr\Tools\dotnetcli\dotnet.exe e:\coreclr\Tools\run.exe e:\coreclr\config.json build -Project=e:\coreclr\bin\obj\Windows_NT.arm.Debug\install.vcxproj -MsBuildLog=/flp:Verbosity=normal;LogFile="e:\coreclr\bin\Logs\CoreCLR_Windows_NT__arm__Debug.log" -MsBuildWrn=/flp1:WarningsOnly;LogFile="e:\coreclr\bin\Logs\CoreCLR_Windows_NT__arm__Debug.wrn" -MsBuildErr=/flp2:ErrorsOnly;LogFile="e:\coreclr\bin\Logs\CoreCLR_Windows_NT__arm__Debug.err" -configuration=Debug  -BuildOS=Windows_NT -BuildType=Debug -BuildArch=arm
Running: e:\coreclr\Tools\dotnetcli\dotnet.exe e:\coreclr\Tools\run.exe e:\coreclr\config.json build -Project=e:\coreclr\bin\obj\Windows_NT.arm.Debug\install.vcxproj -MsBuildLog=/flp:Verbosity=normal;LogFile="e:\coreclr\bin\Logs\CoreCLR_Windows_NT__arm__Debug.log" -MsBuildWrn=/flp1:WarningsOnly;LogFile="e:\coreclr\bin\Logs\CoreCLR_Windows_NT__arm__Debug.wrn" -MsBuildErr=/flp2:ErrorsOnly;LogFile="e:\coreclr\bin\Logs\CoreCLR_Windows_NT__arm__Debug.err" -configuration=Debug  -BuildOS=Windows_NT -BuildType=Debug -BuildArch=arm

Manifestation of this error can be easily fixed by enforcing correct directory after CMAKE exit but as this will fix only bug manifestation and not the bug source it is better to fix CMAKE code generation script to set correct current directory at exit.

This error arises only for VS2017 command prompt builds for arm target.

System: Windows 10 Pro v1703, base lang pl_PL, using en-US Installed VS2015, VS2017 and preview 4 VS2017 v15.3 Installed Windows Kits: 10150, 10240, 10586, 14393, 15063 CMAKE v 3.9.0 build done on master branch commit 0c9e9e09b8ad79f1027aa098339b4096c4032650

RussKeldorph commented 7 years ago

@wtgodbe Would you mind taking a look?

4creators commented 6 years ago

Fixed with dotnet/coreclr#14578.