Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

vcpkg - CMake Error: Problem with archive_write_header(): Can't create '' 빌드 오류

vcpkg로 빌드하는데, 다음과 같은 오류가 발생합니다.

c:/temp/vcpkg>vcpkg install sfml:x86-windows
The following packages will be built and installed:
    sfml[core]:x86-windows
Starting package 1/1: sfml:x86-windows
Building package sfml[core]:x86-windows...
-- Downloading https://github.com/SFML/SFML/archive/2.5.1.tar.gz...
-- Extracting source c:/temp/vcpkg/downloads/SFML-SFML-2.5.1.tar.gz
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:56 (message):
    Command failed: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe;-E;tar;xjf;c:/temp/vcpkg/downloads/SFML-SFML-2.5.1.tar.gz
    Working Directory: c:/temp/vcpkg/buildtrees/sfml/src/TEMP
    See logs for more information:
      c:/temp/vcpkg\buildtrees\sfml\extract-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_extract_source_archive.cmake:43 (vcpkg_execute_required_process)
  scripts/cmake/vcpkg_extract_source_archive.cmake:97 (vcpkg_extract_source_archive)
  scripts/cmake/vcpkg_from_github.cmake:114 (vcpkg_extract_source_archive_ex)
  ports/sfml/portfile.cmake:3 (vcpkg_from_github)
  scripts/ports.cmake:71 (include)


Error: Building package sfml: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: sfml:x86-windows
  Vcpkg version: 2018.10.20-nohash

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

메시지에 따라 extract-err.log 파일의 내용을 보면,

CMake Error: Problem with archive_write_header(): Can't create ''
CMake Error: Current file: SFML-2.5.1/extlibs/libs-osx/Frameworks/FLAC.framework/FLAC
CMake Error: Problem extracting tar: c:/temp/vcpkg/downloads/SFML-SFML-2.5.1.tar.gz

음... 별로 도움이 안 되는 메시지입니다. ^^ 그런데, 실제로 다운로드한 SFML-SFML-2.5.1.tar.gz 파일에 대해 cmake 명령행으로 직접 실행해 보면 동일한 오류가 발생하는 것을 확인할 수 있습니다.

c:\temp> "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe" -E tar xvzf c:/temp/vcpkg/downloads/SFML-SFML-2.5.1.tar.gz
...[생략]...
x SFML-2.5.1/extlibs/libs-osx/
x SFML-2.5.1/extlibs/libs-osx/Frameworks/
x SFML-2.5.1/extlibs/libs-osx/Frameworks/FLAC.framework/
x SFML-2.5.1/extlibs/libs-osx/Frameworks/FLAC.framework/FLAC
CMake Error: Problem with archive_write_header(): Can't create ''
CMake Error: Current file: SFML-2.5.1/extlibs/libs-osx/Frameworks/FLAC.framework/FLAC
CMake Error: Problem extracting tar: c:/temp/vcpkg/downloads/SFML-SFML-2.5.1.tar.gz

문제는 파일명이 "FLAC"인 압축 파일을 풀어내지 못하는 문제인데, 다른 압축 유틸리티를 이용하면 저 부분을 문제없이 잘 해제하는 것을 알 수 있습니다. (잘은 모르겠지만, 검색해 보면 리눅스에서 symbolic link 등의 항목을 윈도우에서 압축 해제할 때 저런 오류가 발생한다고 합니다.)




그렇다면, 문제 해결 방법은 간단합니다. 저렇게 풀려나오지 못하는 파일을 압축 파일로부터 삭제하거나, 아니면 압축을 잘 푸는 유틸리티를 이용해 일단 해제를 한 다음 다시 tar+gzip 압축을 해서 .\vcpkg\downloads 폴더에 가져다 놓으면 됩니다.

이를 위해 우선 7zip을 이용해 다음과 같이 압축을 해제한 다음,

7za.exe e SFML-SFML-2.5.1.tar.gz | 7za.exe x SFML-SFML-2.5.1.tar

다시 tar+gzip 압축을 했습니다.

7za.exe a -ttar -so SFML-SFML-2.5.1.tar *.* | 7za.exe a -si SFML-SFML-2.5.1.tar.gz

저렇게 생성한 tar.gz 파일을 .\vcpkg\downloads 폴더에 복사한 다음, 아래의 글에 설명한 cmake 파일을 수정해 hash 체크를 하지 않도록 했습니다.

vcpkg - "File does not have expected hash" 오류를 무시하는 방법
; https://www.sysnet.pe.kr/2/0/11796

이후 빌드하면, ^^ 잘 됩니다.




참고로, vcpkg가 압축 파일을 처리하는 cmake 파일은 ".\vcpkg\scripts\cmake\vcpkg_extract_source_archive.cmake"입니다.

...[생략]...
include(vcpkg_execute_required_process)

function(vcpkg_extract_source_archive ARCHIVE)
    if(NOT ARGC EQUAL 2)
        set(WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src")
    else()
        set(WORKING_DIRECTORY ${ARGV1})
    endif()

    get_filename_component(ARCHIVE_FILENAME "${ARCHIVE}" NAME)
    if(NOT EXISTS ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted)
        message(STATUS "Extracting source ${ARCHIVE}")
        file(MAKE_DIRECTORY ${WORKING_DIRECTORY})
        vcpkg_execute_required_process(
            COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE}
            WORKING_DIRECTORY ${WORKING_DIRECTORY}
            LOGNAME extract
        )
        file(WRITE ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted)
    endif()
endfunction()

...[생략]...

로컬에 ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted 파일이 없으면 압축 파일을 해제하는 걸로 나오는데요. 해당 파일의 정확한 경로는 다음과 같이 message 코드를 수정해서 확인할 수 있습니다.

message(STATUS "Extracting source ${ARCHIVE} FILE CHECK ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted")

그럼 vcpkg 출력에 다음과 같은 메시지를 볼 수 있습니다.

-- Extracting source c:/temp/vcpkg/downloads/SFML-SFML-2.5.1.tar.gz FILE CHECK c:/temp/vcpkg/buildtrees/sfml/src/TEMP/SFML-SFML-2.5.1.tar.gz.extracted

이런 식으로 vcpkg의 동작이 기술된 .\vcpkg\scripts\cmake 폴더의 cmake 파일들을 자신의 입맛에 맞게 분석/변경할 수 있습니다. 가령, 이번 글에서처럼 cmake로 압축 해제가 안 되는 경우는, 7za.exe로 압축을 해제하도록 만드는 것도 가능할 것입니다.

설령, cmake로 분리하지 않은 동작이라고 해도 .\vcpkg\toolsrc 폴더의 vcpkg.sln 파일을 Visual Studio에 로드해 소스 코드를 수정 후 빌드해 줄 수 있으니 얼마든지 자유롭게 동작 방식을 수정할 수 있을 것입니다.




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







[최초 등록일: ]
[최종 수정일: 3/7/2020]

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)
13421정성태10/4/20233238닷넷: 2147. C# - 비동기 메서드의 async 예약어 유무에 따른 차이
13420정성태9/26/20235264스크립트: 57. 파이썬 - UnboundLocalError: cannot access local variable '...' where it is not associated with a value
13419정성태9/25/20233088스크립트: 56. 파이썬 - RuntimeError: dictionary changed size during iteration
13418정성태9/25/20233749닷넷: 2146. C# - ConcurrentDictionary 자료 구조의 동기화 방식
13417정성태9/19/20233332닷넷: 2145. C# - 제네릭의 형식 매개변수에 속한 (매개변수를 가진) 생성자를 호출하는 방법
13416정성태9/19/20233150오류 유형: 877. redis-py - MISCONF Redis is configured to save RDB snapshots, ...
13415정성태9/18/20233637닷넷: 2144. C# 12 - 컬렉션 식(Collection Expressions)
13414정성태9/16/20233388디버깅 기술: 193. Windbg - ThreadStatic 필드 값을 조사하는 방법
13413정성태9/14/20233580닷넷: 2143. C# - 시스템 Time Zone 변경 시 이벤트 알림을 받는 방법
13412정성태9/14/20236846닷넷: 2142. C# 12 - 인라인 배열(Inline Arrays) [1]
13411정성태9/12/20233361Windows: 252. 권한 상승 전/후 따로 관리되는 공유 네트워크 드라이브 정보
13410정성태9/11/20234858닷넷: 2141. C# 12 - Interceptor (컴파일 시에 메서드 호출 재작성) [1]
13409정성태9/8/20233718닷넷: 2140. C# - Win32 API를 이용한 모니터 전원 끄기
13408정성태9/5/20233714Windows: 251. 임의로 만든 EXE 파일을 포함한 ZIP 파일의 압축을 해제할 때 Windows Defender에 의해 삭제되는 경우
13407정성태9/4/20233471닷넷: 2139. C# - ParallelEnumerable을 이용한 IEnumerable에 대한 병렬 처리
13406정성태9/4/20233408VS.NET IDE: 186. Visual Studio Community 버전의 라이선스
13405정성태9/3/20233835닷넷: 2138. C# - async 메서드 호출 원칙
13404정성태8/29/20233356오류 유형: 876. Windows - 키보드의 등호(=, Equals sign) 키가 눌리지 않는 경우
13403정성태8/21/20233186오류 유형: 875. The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
13402정성태8/20/20233243닷넷: 2137. ILSpy의 nuget 라이브러리 버전 - ICSharpCode.Decompiler
13401정성태8/19/20233505닷넷: 2136. .NET 5+ 환경에서 P/Invoke의 성능을 높이기 위한 SuppressGCTransition 특성 [1]
13400정성태8/10/20233341오류 유형: 874. 파이썬 - pymssql을 윈도우 환경에서 설치 불가
13399정성태8/9/20233369닷넷: 2135. C# - 지역 변수로 이해하는 메서드 매개변수의 값/참조 전달
13398정성태8/3/20234123스크립트: 55. 파이썬 - pyodbc를 이용한 SQL Server 연결 사용법
13397정성태7/23/20233635닷넷: 2134. C# - 문자열 연결 시 string.Create를 이용한 GC 할당 최소화
13396정성태7/22/20233333스크립트: 54. 파이썬 pystack 소개 - 메모리 덤프로부터 콜 스택 열거
1  2  3  4  5  6  7  [8]  9  10  11  12  13  14  15  ...