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)
12775정성태8/12/202117399스크립트: 22. 파이썬 - 윈도우 환경에서 개발한 Django 앱을 WSL 환경의 gunicorn을 이용해 실행
12774정성태8/11/20218711.NET Framework: 1087. C# - Collection 개체의 다중 스레드 접근 시 "Operations that change non-concurrent collections must have exclusive access" 예외 발생
12773정성태8/11/20217884개발 환경 구성: 595. PyCharm - WSL과 연동해 Django App을 윈도우에서 리눅스 대상으로 개발
12772정성태8/11/20219384스크립트: 21. 파이썬 - 윈도우 환경에서 개발한 Django 앱을 WSL 환경의 uwsgi를 이용해 실행 [1]
12771정성태8/11/20217763Windows: 196. "Microsoft Windows Subsystem for Linux Background Host" / "Vmmem"을 종료하는 방법
12770정성태8/11/20218470.NET Framework: 1086. C# - Windows Forms 응용 프로그램의 자식 컨트롤 부하파일 다운로드1
12769정성태8/11/20216447오류 유형: 752. Python - ImportError: No module named pip._internal.cli.main 두 번째 이야기
12768정성태8/10/20217477.NET Framework: 1085. .NET 6에 포함된 신규 BCL API [1]파일 다운로드1
12767정성태8/10/20218551오류 유형: 752. Python - ImportError: No module named pip._internal.cli.main
12766정성태8/9/20217072Java: 32. closing inbound before receiving peer's close_notify
12765정성태8/9/20216392Java: 31. Cannot load JDBC driver class 'org.mysql.jdbc.Driver'
12764정성태8/9/202144854Java: 30. XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid
12763정성태8/9/20217855Java: 29. java.lang.NullPointerException - com.mysql.jdbc.ConnectionImpl.getServerCharset
12762정성태8/8/202111391Java: 28. IntelliJ - Unable to open debugger port 오류
12761정성태8/8/20218589Java: 27. IntelliJ - java: package javax.inject does not exist [2]
12760정성태8/8/20215997개발 환경 구성: 594. 전용 "Command Prompt for ..." 단축 아이콘 만들기
12759정성태8/8/20219144Java: 26. IntelliJ + Spring Framework + 새로운 Controller 추가 [2]파일 다운로드1
12758정성태8/7/20218489오류 유형: 751. Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
12757정성태8/7/20219165Java: 25. IntelliJ + Spring Framework 프로젝트 생성
12756정성태8/6/20217962.NET Framework: 1084. C# - .NET Core Web API 단위 테스트 방법 [1]파일 다운로드1
12755정성태8/5/20217082개발 환경 구성: 593. MSTest - 단위 테스트에 static/instance 유형의 private 멤버 접근 방법파일 다운로드1
12754정성태8/5/20218007오류 유형: 750. manage.py - Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
12753정성태8/5/20218247오류 유형: 749. PyCharm - Error: Django is not importable in this environment
12752정성태8/4/20216340개발 환경 구성: 592. JetBrains의 IDE(예를 들어, PyCharm)에서 Visual Studio 키보드 매핑 적용
12751정성태8/4/20219383개발 환경 구성: 591. Windows 10 WSL2 환경에서 docker-compose 빌드하는 방법
12750정성태8/3/20216197디버깅 기술: 181. windbg - 콜 스택의 "Call Site" 오프셋 값이 가리키는 위치
... 31  32  33  [34]  35  36  37  38  39  40  41  42  43  44  45  ...