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)
13532정성태1/17/20242178닷넷: 2205. C# - SuperSimpleTcp 사용 시 주의할 점파일 다운로드1
13531정성태1/16/20242065닷넷: 2204. C# - TCP KeepAlive에 새로 추가된 Retry 옵션파일 다운로드1
13530정성태1/15/20242042닷넷: 2203. C# - Python과의 AES 암호화 연동파일 다운로드1
13529정성태1/15/20241922닷넷: 2202. C# - PublishAot의 glibc에 대한 정적 링킹하는 방법
13528정성태1/14/20242062Linux: 68. busybox 컨테이너에서 실행 가능한 C++, Go 프로그램 빌드
13527정성태1/14/20242012오류 유형: 892. Visual Studio - Failed to launch debug adapter. Additional information may be available in the output window.
13526정성태1/14/20242109닷넷: 2201. C# - Facebook 연동 / 사용자 탈퇴 처리 방법
13525정성태1/13/20242065오류 유형: 891. Visual Studio - Web Application을 실행하지 못하는 IISExpress
13524정성태1/12/20242117오류 유형: 890. 한국투자증권 KIS Developers OpenAPI - GW라우팅 중 오류가 발생했습니다.
13523정성태1/12/20241933오류 유형: 889. Visual Studio - error : A project with that name is already opened in the solution.
13522정성태1/11/20242094닷넷: 2200. C# - HttpClient.PostAsJsonAsync 호출 시 "Transfer-Encoding: chunked" 대신 "Content-Length" 헤더 처리
13521정성태1/11/20242154닷넷: 2199. C# - 한국투자증권 KIS Developers OpenAPI의 WebSocket Ping, Pong 처리
13520정성태1/10/20241892오류 유형: 888. C# - Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`....'
13519정성태1/10/20241985닷넷: 2198. C# - Reflection을 이용한 ClientWebSocket의 Ping 호출파일 다운로드1
13518정성태1/9/20242255닷넷: 2197. C# - ClientWebSocket의 Ping, Pong 처리
13517정성태1/8/20242101스크립트: 63. Python - 공개 패키지를 이용한 위성 이미지 생성 (pystac_client, odc.stac)
13516정성태1/7/20242194닷넷: 2196. IIS - AppPool의 "Disable Overlapped Recycle" 옵션의 부작용
13515정성태1/6/20242473닷넷: 2195. async 메서드 내에서 C# 7의 discard 구문 활용 사례 [1]
13514정성태1/5/20242115개발 환경 구성: 702. IIS - AppPool의 "Disable Overlapped Recycle" 옵션
13513정성태1/5/20242038닷넷: 2194. C# - WebActivatorEx / System.Web의 PreApplicationStartMethod 특성
13512정성태1/4/20241999개발 환경 구성: 701. IIS - w3wp.exe 프로세스의 ASP.NET 런타임을 항상 Warmup 모드로 유지하는 preload Enabled 설정
13511정성태1/4/20242020닷넷: 2193. C# - ASP.NET Web Application + OpenAPI(Swashbuckle) 스펙 제공
13510정성태1/3/20241956닷넷: 2192. C# - 특정 실행 파일이 있는지 확인하는 방법 (Linux)
13509정성태1/3/20241979오류 유형: 887. .NET Core 2 이하의 프로젝트에서 System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp2.0.
13508정성태1/3/20242029오류 유형: 886. ORA-28000: the account is locked
13507정성태1/2/20242718닷넷: 2191. C# - IPGlobalProperties를 이용해 netstat처럼 사용 중인 Socket 목록 구하는 방법파일 다운로드1
1  2  3  [4]  5  6  7  8  9  10  11  12  13  14  15  ...