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

비밀번호

댓글 작성자
 




... [91]  92  93  94  95  96  97  98  99  100  101  102  103  104  105  ...
NoWriterDateCnt.TitleFile(s)
11382정성태12/4/201715112오류 유형: 436. System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired 예외 발생 시 "[Pre-Login] initialization=48; handshake=1944;" 값의 의미
11381정성태11/30/201711522.NET Framework: 702. 한글이 포함된 바이트 배열을 나눈 경우 한글이 깨지지 않도록 다시 조합하는 방법(두 번째 이야기)파일 다운로드1
11380정성태11/30/201711690디버깅 기술: 109. windbg - (x64에서의 인자 값 추적을 이용한) Thread.Abort 시 대상이 되는 스레드를 식별하는 방법
11379정성태11/30/201712106오류 유형: 435. System.Web.HttpException - Session state has created a session id, but cannot save it because the response was already flushed by the application.
11378정성태11/29/201713884.NET Framework: 701. 한글이 포함된 바이트 배열을 나눈 경우 한글이 깨지지 않도록 다시 조합하는 방법 [1]파일 다운로드1
11377정성태11/29/201713074.NET Framework: 700. CommonOpenFileDialog 사용 시 사용자가 선택한 파일 목록을 구하는 방법 [3]파일 다운로드1
11376정성태11/28/201716553VS.NET IDE: 123. Visual Studio 편집기의 \r\n (crlf) 개행을 \n으로 폴더 단위로 설정하는 방법
11375정성태11/28/201712898오류 유형: 434. Visual Studio로 ASP.NET 디버깅 중 System.Web.HttpException - Could not load type 오류
11374정성태11/27/201717416사물인터넷: 14. 라즈베리 파이 - (윈도우의 NT 서비스처럼) 부팅 시 시작하는 프로그램 설정 [1]
11373정성태11/27/201716493오류 유형: 433. Raspberry Pi/Windows 다중 플랫폼 지원 컴파일 관련 오류 기록
11372정성태11/25/201719738사물인터넷: 13. 윈도우즈 사용자를 위한 라즈베리 파이 제로 W 모델을 설정하는 방법 [4]
11371정성태11/25/201713693오류 유형: 432. Hyper-V 가상 스위치 생성 시 Failed to connect Ethernet switch port 0x80070002 오류 발생
11370정성태11/25/201713265오류 유형: 431. Hyper-V의 Virtual Switch 생성 시 "External network" 목록에 특정 네트워크 어댑터 항목이 없는 경우
11369정성태11/25/201715577사물인터넷: 12. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 키보드 및 마우스로 쓰는 방법 (절대 좌표, 상대 좌표, 휠) [1]
11368정성태11/25/201720773.NET Framework: 699. UDP 브로드캐스트 주소 255.255.255.255와 192.168.0.255의 차이점과 이를 고려한 C# UDP 서버/클라이언트 예제 [2]파일 다운로드1
11367정성태11/25/201720845개발 환경 구성: 337. 윈도우 운영체제의 route 명령어 사용법
11366정성태11/25/201712652오류 유형: 430. 이벤트 로그 - Cryptographic Services failed while processing the OnIdentity() call in the System Writer Object.
11365정성태11/25/201714925오류 유형: 429. 이벤트 로그 - User Policy could not be updated successfully
11364정성태11/24/201715980사물인터넷: 11. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 마우스로 쓰는 방법 (절대 좌표) [2]
11363정성태11/23/201715705사물인터넷: 10. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 마우스 + 키보드로 쓰는 방법 (두 번째 이야기)
11362정성태11/22/201713303오류 유형: 428. 윈도우 업데이트 KB4048953 - 0x800705b4 [2]
11361정성태11/22/201716041오류 유형: 427. 이벤트 로그 - Filter Manager failed to attach to volume '\Device\HarddiskVolume??' 0xC03A001C
11360정성태11/22/201715748오류 유형: 426. 이벤트 로그 - The kernel power manager has initiated a shutdown transition.
11359정성태11/16/201715117오류 유형: 425. 윈도우 10 Version 1709 (OS Build 16299.64) 업그레이드 시 발생한 문제 2가지
11358정성태11/15/201719445사물인터넷: 9. Visual Studio 2017에서 Raspberry Pi C++ 응용 프로그램 제작 [1]
11357정성태11/15/201720235개발 환경 구성: 336. 윈도우 10 Bash 쉘에서 C++ 컴파일하는 방법
... [91]  92  93  94  95  96  97  98  99  100  101  102  103  104  105  ...