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

비밀번호

댓글 작성자
 




[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13602정성태4/20/2024220닷넷: 2244. C# - PCM 오디오 데이터를 연속(Streaming) 재생 (Windows Multimedia)파일 다운로드1
13601정성태4/19/2024257닷넷: 2243. C# - PCM 사운드 재생(NAudio)파일 다운로드1
13600정성태4/18/2024298닷넷: 2242. C# - 관리 스레드와 비관리 스레드
13599정성태4/17/2024441닷넷: 2241. C# - WAV 파일의 PCM 사운드 재생(Windows Multimedia)파일 다운로드1
13598정성태4/16/2024436닷넷: 2240. C# - WAV 파일 포맷 + LIST 헤더파일 다운로드2
13597정성태4/15/2024503닷넷: 2239. C# - WAV 파일의 PCM 데이터 생성 및 출력파일 다운로드1
13596정성태4/14/2024854닷넷: 2238. C# - WAV 기본 파일 포맷파일 다운로드1
13595정성태4/13/2024985닷넷: 2237. C# - Audio 장치 열기 (Windows Multimedia, NAudio)파일 다운로드1
13594정성태4/12/20241033닷넷: 2236. C# - Audio 장치 열람 (Windows Multimedia, NAudio)파일 다운로드1
13593정성태4/8/20241052닷넷: 2235. MSBuild - AccelerateBuildsInVisualStudio 옵션
13592정성태4/2/20241209C/C++: 165. CLion으로 만든 Rust Win32 DLL을 C#과 연동
13591정성태4/2/20241169닷넷: 2234. C# - WPF 응용 프로그램에 Blazor App 통합파일 다운로드1
13590정성태3/31/20241073Linux: 70. Python - uwsgi 응용 프로그램이 k8s 환경에서 OOM 발생하는 문제
13589정성태3/29/20241143닷넷: 2233. C# - 프로세스 CPU 사용량을 나타내는 성능 카운터와 Win32 API파일 다운로드1
13588정성태3/28/20241197닷넷: 2232. C# - Unity + 닷넷 App(WinForms/WPF) 간의 Named Pipe 통신파일 다운로드1
13587정성태3/27/20241157오류 유형: 900. Windows Update 오류 - 8024402C, 80070643
13586정성태3/27/20241304Windows: 263. Windows - 복구 파티션(Recovery Partition) 용량을 늘리는 방법
13585정성태3/26/20241096Windows: 262. PerformanceCounter의 InstanceName에 pid를 추가한 "Process V2"
13584정성태3/26/20241050개발 환경 구성: 708. Unity3D - C# Windows Forms / WPF Application에 통합하는 방법파일 다운로드1
13583정성태3/25/20241158Windows: 261. CPU Utilization이 100% 넘는 경우를 성능 카운터로 확인하는 방법
13582정성태3/19/20241421Windows: 260. CPU 사용률을 나타내는 2가지 수치 - 사용량(Usage)과 활용률(Utilization)파일 다운로드1
13581정성태3/18/20241589개발 환경 구성: 707. 빌드한 Unity3D 프로그램을 C++ Windows Application에 통합하는 방법
13580정성태3/15/20241138닷넷: 2231. C# - ReceiveTimeout, SendTimeout이 적용되지 않는 Socket await 비동기 호출파일 다운로드1
13579정성태3/13/20241494오류 유형: 899. HTTP Error 500.32 - ANCM Failed to Load dll
13578정성태3/11/20241631닷넷: 2230. C# - 덮어쓰기 가능한 환형 큐 (Circular queue)파일 다운로드1
[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...