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

비밀번호

댓글 작성자
 




... [31]  32  33  34  35  36  37  38  39  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
12851정성태11/1/20217489스크립트: 34. 파이썬 - MySQLdb 기본 예제 코드
12850정성태10/27/20218662오류 유형: 765. 우분투에서 pip install mysqlclient 실행 시 "OSError: mysql_config not found" 오류
12849정성태10/17/20217767스크립트: 33. JavaScript와 C#의 시간 변환 [1]
12848정성태10/17/20218745스크립트: 32. 파이썬 - sqlite3 기본 예제 코드 [1]
12847정성태10/14/20218604스크립트: 31. 파이썬 gunicorn - WORKER TIMEOUT 오류 발생
12846정성태10/7/20218356스크립트: 30. 파이썬 __debug__ 플래그 변수에 따른 코드 실행 제어
12845정성태10/6/20218191.NET Framework: 1120. C# - BufferBlock<T> 사용 예제 [5]파일 다운로드1
12844정성태10/3/20216192오류 유형: 764. MSI 설치 시 "... is accessible and not read-only." 오류 메시지
12843정성태10/3/20216650스크립트: 29. 파이썬 - fork 시 기존 클라이언트 소켓 및 스레드의 동작파일 다운로드1
12842정성태10/1/202124980오류 유형: 763. 파이썬 오류 - AttributeError: type object '...' has no attribute '...'
12841정성태10/1/20218482스크립트: 28. 모든 파이썬 프로세스에 올라오는 특별한 파일 - sitecustomize.py
12840정성태9/30/20218577.NET Framework: 1119. Entity Framework의 Join 사용 시 다중 칼럼에 대한 OR 조건 쿼리파일 다운로드1
12839정성태9/15/20219626.NET Framework: 1118. C# 11 - 제네릭 타입의 특성 적용파일 다운로드1
12838정성태9/13/20219287.NET Framework: 1117. C# - Task에 전달한 Action, Func 유형에 따라 달라지는 async/await 비동기 처리 [2]파일 다운로드1
12837정성태9/11/20218197VC++: 151. Golang - fmt.Errorf, errors.Is, errors.As 설명
12836정성태9/10/20217800Linux: 45. 리눅스 - 실행 중인 다른 프로그램의 출력을 확인하는 방법
12835정성태9/7/20219052.NET Framework: 1116. C# 10 - (15) CallerArgumentExpression 특성 추가 [2]파일 다운로드1
12834정성태9/7/20217417오류 유형: 762. Visual Studio 2019 Build Tools - 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
12833정성태9/6/20216890VC++: 150. Golang - TCP client/server echo 예제 코드파일 다운로드1
12832정성태9/6/20217743VC++: 149. Golang - 인터페이스 포인터가 의미 있을까요?
12831정성태9/6/20216278VC++: 148. Golang - 채널에 따른 다중 작업 처리파일 다운로드1
12830정성태9/6/20218523오류 유형: 761. Internet Explorer에서 파일 다운로드 시 "Your current security settings do not allow this file to be downloaded." 오류
12829정성태9/5/202110169.NET Framework: 1115. C# 10 - (14) 구조체 타입에 기본 생성자 정의 가능파일 다운로드1
12828정성태9/4/20218295.NET Framework: 1114. C# 10 - (13) 단일 파일 내에 적용되는 namespace 선언파일 다운로드1
12827정성태9/4/20218244스크립트: 27. 파이썬 - 웹 페이지 데이터 수집을 위한 scrapy Crawler 사용법 요약
12826정성태9/3/202110463.NET Framework: 1113. C# 10 - (12) 문자열 보간 성능 개선 [1]파일 다운로드1
... [31]  32  33  34  35  36  37  38  39  40  41  42  43  44  45  ...