Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

vcpkg 빌드 오류 - Starting the CLR failed with HRESULT 80040153

vcpkg로 ilmbase 라이브러리를 빌드하는데 다음과 같은 오류가 발생합니다.

E:\git_clone\vcpkg> vcpkg install ilmbase:x86-windows
The following packages will be built and installed:
    ilmbase[core]:x86-windows
Starting package 1/1: ilmbase:x86-windows
Building package ilmbase:x86-windows...
-- CURRENT_INSTALLED_DIR=E:/git_clone/vcpkg/installed/x86-windows
-- DOWNLOADS=E:/git_clone/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=E:/git_clone/vcpkg/packages/ilmbase_x86-windows
-- CURRENT_BUILDTREES_DIR=E:/git_clone/vcpkg/buildtrees/ilmbase
-- CURRENT_PORT_DIR=E:/git_clone/vcpkg/ports/ilmbase/.
-- Using cached E:/git_clone/vcpkg/downloads/ilmbase-2.2.0.tar.gz
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Applying patch E:/git_clone/vcpkg/ports/ilmbase/fix-parallel-build.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Applying patch E:/git_clone/vcpkg/ports/ilmbase/fix-parallel-build.patch done
-- Configuring x86-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:44 (message):
    Command failed: E:/git_clone/vcpkg/downloads/cmake-3.10.0-win32-x86/bin/cmake.exe;E:/git_clone/vcpkg/buildtrees/ilmbase/src/ilmbase-2.2.0;-DBUILD_SHARED_LIBS=ON;-DCMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ;-DCMAKE_C_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ;-DVCPKG_TARGET_TRIPLET=x86-windows;-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON;-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON;-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON;-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE;-DCMAKE_VERBOSE_MAKEFILE=ON;-DVCPKG_APPLOCAL_DEPS=OFF;-DCMAKE_TOOLCHAIN_FILE=E:/git_clone/vcpkg/scripts/buildsystems/vcpkg.cmake;-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON;-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ;-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ;-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ;-DCMAKE_EXE_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ;-G;Ninja;-DCMAKE_BUILD_TYPE=Release;-DCMAKE_INSTALL_PREFIX=E:/git_clone/vcpkg/packages/ilmbase_x86-windows
    Working Directory: E:/git_clone/vcpkg/buildtrees/ilmbase/x86-windows-rel
    See logs for more information:
      E:\git_clone\vcpkg\buildtrees\ilmbase\config-x86-windows-rel-out.log
      E:\git_clone\vcpkg\buildtrees\ilmbase\config-x86-windows-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:205 (vcpkg_execute_required_process)
  ports/ilmbase/portfile.cmake:19 (vcpkg_configure_cmake)
  scripts/ports.cmake:72 (include)


Error: Building package ilmbase:x86-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: ilmbase:x86-windows
  Vcpkg version: 0.0.100-2017-12-15-76096c95f1d3cbb85779ccd78c30513eec32b517

Additionally, attach any relevant sections from the log files above.

오류 로그가 config-x86-windows-rel-err.log 파일에 기록되어 있다고 하는데 이를 열어 보면 다음과 같은 내용이 있습니다.

S t a r t i n g   t h e   C L R   f a i l e d   w i t h   H R E S U L T   8 0 0 4 0 1 5 3 . 

 CMake Error at E:/git_clone/vcpkg/scripts/cmake/vcpkg_get_windows_sdk.cmake:10 (message):
  Could not find Windows SDK
Call Stack (most recent call first):
  E:/git_clone/vcpkg/scripts/buildsystems/vcpkg.cmake:105 (vcpkg_get_windows_sdk)
  E:/git_clone/vcpkg/downloads/cmake-3.10.0-win32-x86/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:94 (include)
  CMakeLists.txt:4 (PROJECT)


CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

추적을 위해 "E:/git_clone/vcpkg/scripts/cmake/vcpkg_get_windows_sdk.cmake" 경로의 파일을 열어 봤습니다.

# Returns Windows SDK number via out variable "ret"
function(vcpkg_get_windows_sdk ret)
    execute_process(
        COMMAND powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& '${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1'}" 2>&1
        INPUT_FILE NUL
        OUTPUT_VARIABLE WINDOWS_SDK
        RESULT_VARIABLE error_code)

    if (error_code)
        message(FATAL_ERROR "Could not find Windows SDK")
    endif()

    # Remove trailing newline and non-numeric characters
    string(REGEX REPLACE "[^0-9.]" "" WINDOWS_SDK " " "${WINDOWS_SDK}")
    set(${ret} ${WINDOWS_SDK} PARENT_SCOPE)
endfunction()

config-x86-windows-rel-err.log 로그 파일의 "Could not find Windows SDK" 메시지로 봐서는 분명히 powershell.exe로 getWindowsSDK.ps1 스크립트 수행 시 오류가 발생한 것입니다. (참고로 error_code 값을 출력해 보면 -65536이 나옵니다.) 재미있는 것은, 해당 명령어를 명령행에서 직접 수행하면 다음과 같이 잘 수행이 됩니다.

C:\> powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "E:\git_clone\vcpkg\scripts\getWindowsSDK.ps1"
10.0.16299.0

그런데 저렇게 cmake 안에서 호출하면 오류가 발생하는 것입니다. 문제를 파악하기 위해 getWindowsSDK.ps1 스크립트의 도입부에 다음과 같이,

[CmdletBinding()]
param(
    [Parameter(Mandatory=$False)]
    [switch]$DisableWin10SDK = $False,

    [Parameter(Mandatory=$False)]
    [switch]$DisableWin81SDK = $False
)

Write-EventLog -EventId 500 -Source ".NET Runtime" -LogName Application -Message "Executing"

if ($DisableWin10SDK -and $DisableWin81SDK)
{
    throw "Both Win10SDK and Win81SDK were disabled."
}

...[생략]...

디버깅 용도로 Write-EventLog 로그를 호출해 봤습니다. 그런 다음, "vcpkg install ilmbase:x86-windows" 명령어를 수행하니 이벤트 로그에 아무 기록도 남아 있지 않습니다. 즉, 해당 스크립트를 수행조차 못한 것입니다. 그럼 다시 문제를 거슬러 올라가 config-x86-windows-rel-err.log 파일에 기록된 다음의 오류 문구가 왠지 단서가 될 듯합니다.

Starting the CLR failed with HRESULT 80040153.

재미있게도 이 오류 코드는 예전에 겪어 본 적이 있습니다.

regsvcs 등록 시 0x80040153 오류
; https://www.sysnet.pe.kr/2/0/1656

설마... 저게 문제일까요? 혹시나 싶어서 machine.config을 메모장으로 열었는데 정말 developmentMode 설정이 있습니다. 밑져야 본전이라는 심정으로 machine.config 파일들의 developmentMode 설정을 제거했더니 다음의 경로에 있는 파일을 편집했을 때 정상적으로 vcpkg가 실행되었습니다.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\machine.config

나중에 또 귀찮을 수 있으니 다음의 경로에 있는 machine.config 모두 편집해서 developmentMode 설정을 모두 제거하는 것이 좋습니다.

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
C:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\machine.config

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.config

(즉, 이 오류는 .NET Reflector를 설치한 개발자들의 PC에서 발생할 수 있습니다.)




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 1/5/2018]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  [37]  38  39  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
12700정성태7/8/20218695.NET Framework: 1074. RuntimeType의 메모리 누수? [1]
12699정성태7/8/20217501VS.NET IDE: 167. Visual Studio 디버깅 중 GC Heap 상태를 보여주는 "Show Diagnostic Tools" 메뉴 사용법
12698정성태7/7/202111476오류 유형: 732. Windows 11 업데이트 시 3% 또는 0%에서 다운로드가 멈춘 경우
12697정성태7/7/20217362개발 환경 구성: 574. Windows 11 (Insider Preview) 설치하는 방법
12696정성태7/6/20217924VC++: 146. 운영체제의 스레드 문맥 교환(Context Switch)을 유사하게 구현하는 방법파일 다운로드2
12695정성태7/3/20218001VC++: 145. C 언어의 setjmp/longjmp 기능을 Thread Context를 이용해 유사하게 구현하는 방법파일 다운로드1
12694정성태7/2/20219911Java: 24. Azure - Spring Boot 앱을 Java SE(Embedded Web Server)로 호스팅 시 로그 파일 남기는 방법 [1]
12693정성태6/30/20217679오류 유형: 731. Azure Web App Site Extension - Failed to install web app extension [...]. {1}
12692정성태6/30/20217552디버깅 기술: 180. Azure - Web App의 비정상 종료 시 남겨지는 로그 확인
12691정성태6/30/20218416개발 환경 구성: 573. 테스트 용도이지만 테스트에 적합하지 않은 Azure D1 공유(shared) 요금제
12690정성태6/28/20219208Java: 23. Azure - 자바(Java)로 만드는 Web App Service - Tomcat 호스팅
12689정성태6/25/20219760오류 유형: 730. Windows Forms 디자이너 - The class Form1 can be designed, but is not the first class in the file. [1]
12688정성태6/24/20219462.NET Framework: 1073. C# - JSON 역/직렬화 시 리플렉션 손실을 없애는 JsonSrcGen [2]파일 다운로드1
12687정성태6/22/20217487오류 유형: 729. Invalid data: Invalid artifact, java se app service only supports .jar artifact
12686정성태6/21/20219890Java: 22. Azure - 자바(Java)로 만드는 Web App Service - Java SE (Embedded Web Server) 호스팅
12685정성태6/21/202110117Java: 21. Azure Web App Service에 배포된 Java 프로세스의 메모리 및 힙(Heap) 덤프 뜨는 방법
12684정성태6/19/20218567오류 유형: 728. Visual Studio 2022부터 DTE.get_Properties 속성 접근 시 System.MissingMethodException 예외 발생
12683정성태6/18/202110051VS.NET IDE: 166. Visual Studio 2022 - Windows Forms 프로젝트의 x86 DLL 컨트롤이 Designer에서 오류가 발생하는 문제 [1]파일 다운로드1
12682정성태6/18/20217773VS.NET IDE: 165. Visual Studio 2022를 위한 Extension 마이그레이션
12681정성태6/18/20217091오류 유형: 727. .NET 2.0 ~ 3.5 + x64 환경에서 System.EnterpriseServices 참조 시 CS8012 경고
12680정성태6/18/20218185오류 유형: 726. python2.7.exe 실행 시 0xc000007b 오류
12679정성태6/18/20218792COM 개체 관련: 23. CoInitializeSecurity의 전역 설정을 재정의하는 CoSetProxyBlanket 함수 사용법파일 다운로드1
12678정성태6/17/20218039.NET Framework: 1072. C# - CoCreateInstance 관련 Inteop 오류 정리파일 다운로드1
12677정성태6/17/20219497VC++: 144. 역공학을 통한 lxssmanager.dll의 ILxssSession 사용법 분석파일 다운로드1
12676정성태6/16/20219564VC++: 143. ionescu007/lxss github repo에 공개된 lxssmanager.dll의 CLSID_LxssUserSession/IID_ILxssSession 사용법파일 다운로드1
12675정성태6/16/20217585Java: 20. maven package 명령어 결과물로 (war가 아닌) jar 생성 방법
... 31  32  33  34  35  36  [37]  38  39  40  41  42  43  44  45  ...