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

비밀번호

댓글 작성자
 




... 61  62  63  64  65  66  67  68  69  [70]  71  72  73  74  75  ...
NoWriterDateCnt.TitleFile(s)
11892정성태5/10/201912534웹: 38. HTTP Cookie의 expires 시간 형식(RFC7231)
11891정성태5/9/201915009.NET Framework: 831. (번역글) .NET Internals Cookbook Part 12 - Memory structure, attributes, handles
11890정성태5/8/201910775개발 환경 구성: 439. "Visual Studio Enterprise is required to execute the test." 메시지와 관련된 코드 기록
11889정성태5/8/201911623개발 환경 구성: 438. mstest, QTAgent의 로그 파일 설정 방법
11888정성태5/8/201926802.NET Framework: 830. C# - 비동기 호출을 취소하는 CancellationToken의 간단한 예제 코드 [1]파일 다운로드1
11887정성태5/8/201913319.NET Framework: 829. C# - yield 문을 사용할 수 있는 메서드의 조건
11886정성태5/7/201912401오류 유형: 534. mstest.exe 실행 시 "Visual Studio Enterprise is required to execute the test." 오류 [2]
11885정성태5/7/20199373오류 유형: 533. mstest.exe 실행 시 "File extension specified '.loadtest' is not a valid test extension." 오류 발생
11884정성태5/5/201913053.NET Framework: 828. C# DLL에서 Win32 C/C++처럼 dllexport 함수를 제공하는 방법 - 두 번째 이야기
11883정성태5/3/201917362.NET Framework: 827. C# - 인터넷 시간 서버로부터 받은 시간을 윈도우에 적용하는 방법파일 다운로드1
11882정성태5/2/201914278.NET Framework: 826. (번역글) .NET Internals Cookbook Part 11 - Various C# riddles파일 다운로드1
11881정성태4/28/201914519오류 유형: 532. .NET Core 프로젝트로 마이그레이션 시 "CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute" 오류 발생
11880정성태4/25/201911219오류 유형: 531. 이벤트 로그 오류 - Task Scheduling Error: m->NextScheduledSPRetry 1547, m->NextScheduledEvent 1547
11879정성태4/24/201916462.NET Framework: 825. (번역글) .NET Internals Cookbook Part 10 - Threads, Tasks, asynchronous code and others파일 다운로드2
11878정성태4/22/201914470.NET Framework: 824. (번역글) .NET Internals Cookbook Part 9 - Finalizers, queues, card tables and other GC stuff파일 다운로드1
11877정성태4/22/201914418.NET Framework: 823. (번역글) .NET Internals Cookbook Part 8 - C# gotchas파일 다운로드1
11876정성태4/21/201914250.NET Framework: 822. (번역글) .NET Internals Cookbook Part 7 - Word tearing, locking and others파일 다운로드1
11875정성태4/21/201914614오류 유형: 530. Visual Studo에서 .NET Core 프로젝트를 열 때 "One or more errors occurred." 오류 발생
11874정성태4/20/201914625.NET Framework: 821. (번역글) .NET Internals Cookbook Part 6 - Object internals파일 다운로드1
11873정성태4/19/201913583.NET Framework: 820. (번역글) .NET Internals Cookbook Part 5 - Methods, parameters, modifiers파일 다운로드1
11872정성태4/17/201914046.NET Framework: 819. (번역글) .NET Internals Cookbook Part 4 - Type members파일 다운로드1
11871정성태4/16/201913904.NET Framework: 818. (번역글) .NET Internals Cookbook Part 3 - Initialization tricks [3]파일 다운로드1
11870정성태4/16/201911573.NET Framework: 817. Process.Start로 실행한 콘솔 프로그램의 출력 결과를 얻는 방법파일 다운로드1
11869정성태4/15/201915419.NET Framework: 816. (번역글) .NET Internals Cookbook Part 2 - GC-related things [2]파일 다운로드2
11868정성태4/15/201913146.NET Framework: 815. CER(Constrained Execution Region)이란?파일 다운로드1
11867정성태4/15/201912175.NET Framework: 814. Critical Finalizer와 SafeHandle의 사용 의미파일 다운로드1
... 61  62  63  64  65  66  67  68  69  [70]  71  72  73  74  75  ...