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)
12670정성태6/13/20218851.NET Framework: 1071. DLL Surrogate를 이용한 Out-of-process COM 개체에서의 CoInitializeSecurity 문제파일 다운로드1
12669정성태6/11/20218848.NET Framework: 1070. 사용자 정의 GetHashCode 메서드 구현은 C# 9.0의 record 또는 리팩터링에 맡기세요.
12668정성태6/11/202110540.NET Framework: 1069. C# - DLL Surrogate를 이용한 Out-of-process COM 개체 제작파일 다운로드2
12667정성태6/10/20219167.NET Framework: 1068. COM+ 서버 응용 프로그램을 이용해 CoInitializeSecurity 제약 해결파일 다운로드1
12666정성태6/10/20217850.NET Framework: 1067. 별도 DLL에 포함된 타입을 STAThread Main 메서드에서 사용하는 경우 CoInitializeSecurity 자동 호출파일 다운로드1
12665정성태6/9/20219176.NET Framework: 1066. Wslhub.Sdk 사용으로 알아보는 CoInitializeSecurity 사용 제약파일 다운로드1
12664정성태6/9/20217486오류 유형: 723. COM+ PIA 참조 시 "This operation failed because the QueryInterface call on the COM component" 오류
12663정성태6/9/20218927.NET Framework: 1065. Windows Forms - 속성 창의 디자인 설정 지원: 문자열 목록 내에서 항목을 선택하는 TypeConverter 제작파일 다운로드1
12662정성태6/8/20218147.NET Framework: 1064. C# COM 개체를 PIA(Primary Interop Assembly)로써 "Embed Interop Types" 참조하는 방법파일 다운로드1
12661정성태6/4/202118711.NET Framework: 1063. C# - MQTT를 이용한 클라이언트/서버(Broker) 통신 예제 [4]파일 다운로드1
12660정성태6/3/20219798.NET Framework: 1062. Windows Forms - 폼 내에서 발생하는 마우스 이벤트를 자식 컨트롤 영역에 상관없이 수신하는 방법 [1]파일 다운로드1
12659정성태6/2/202111082Linux: 40. 우분투 설치 후 MBR 디스크 드라이브 여유 공간이 인식되지 않은 경우 - Logical Volume Management
12658정성태6/2/20218513Windows: 194. Microsoft Store에 있는 구글의 공식 Youtube App
12657정성태6/2/20219797Windows: 193. 윈도우 패키지 관리자 - winget 설치
12656정성태6/1/20218039.NET Framework: 1061. 서버 유형의 COM+에 적용할 수 없는 Server GC
12655정성태6/1/20217609오류 유형: 722. windbg/sos - savemodule - Fail to read memory
12654정성태5/31/20217585오류 유형: 721. Hyper-V - Saved 상태의 VM을 시작 시 오류 발생
12653정성태5/31/202110217.NET Framework: 1060. 닷넷 GC에 새롭게 구현되는 DPAD(Dynamic Promotion And Demotion for GC)
12652정성태5/31/20218345VS.NET IDE: 164. Visual Studio - Web Deploy로 Publish 시 암호창이 매번 뜨는 문제
12651정성태5/31/20218600오류 유형: 720. PostgreSQL - ERROR: 22P02: malformed array literal: "..."
12650정성태5/17/20217919기타: 82. OpenTabletDriver의 버튼에 더블 클릭을 매핑 및 게임에서의 지원 방법
12649정성태5/16/20219256.NET Framework: 1059. 세대 별 GC(Garbage Collection) 방식에서 Card table의 사용 의미 [1]
12648정성태5/16/20217875사물인터넷: 66. PC -> FTDI -> NodeMCU v1 ESP8266 기기를 UART 핀을 연결해 직렬 통신하는 방법파일 다운로드1
12647정성태5/15/20219109.NET Framework: 1058. C# - C++과의 연동을 위한 구조체의 fixed 배열 필드 사용파일 다운로드1
12646정성태5/15/20218246사물인터넷: 65. C# - Arduino IDE의 Serial Monitor 기능 구현파일 다운로드1
12645정성태5/14/20217950사물인터넷: 64. NodeMCU v1 ESP8266 - LittleFS를 이용한 와이파이 접속 정보 업데이트파일 다운로드1
... 31  32  33  34  35  36  37  [38]  39  40  41  42  43  44  45  ...