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

비밀번호

댓글 작성자
 




... 46  47  48  [49]  50  51  52  53  54  55  56  57  58  59  60  ...
NoWriterDateCnt.TitleFile(s)
12418정성태11/19/202011254오류 유형: 683. Visual C++ - error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug'파일 다운로드1
12417정성태11/19/20208656오류 유형: 682. Visual C++ - warning LNK4099: PDB '...pdb' was not found with '...lib(pch.obj)' or at '...pdb'; linking object as if no debug info
12416정성태11/19/20209933오류 유형: 681. Visual C++ - error LNK2001: unresolved external symbol _CrtDbgReport
12415정성태11/18/202010011.NET Framework: 971. UnmanagedCallersOnly 특성과 DNNE 사용파일 다운로드1
12414정성태11/18/202011074VC++: 138. x64 빌드에서 extern "C"가 아닌 경우 ___cdecl name mangling 적용 [4]파일 다운로드1
12413정성태11/17/202010752.NET Framework: 970. .NET 5 / .NET Core - UnmanagedCallersOnly 특성을 사용한 함수 내보내기파일 다운로드1
12412정성태11/16/202013003.NET Framework: 969. .NET Framework 및 .NET 5 - UnmanagedCallersOnly 특성 사용파일 다운로드1
12411정성태11/12/20209988오류 유형: 680. C# 9.0 - Error CS8889 The target runtime doesn't support extensible or runtime-environment default calling conventions.
12410정성태11/12/20209914디버깅 기술: 174. windbg - System.TypeLoadException 예외 분석 사례
12409정성태11/12/202011290.NET Framework: 968. C# 9.0의 Function pointer를 이용한 함수 주소 구하는 방법파일 다운로드1
12408정성태11/9/202022788도서: 시작하세요! C# 9.0 프로그래밍 [8]
12407정성태11/9/202011573.NET Framework: 967. "clr!JIT_DbgIsJustMyCode" 호출이 뭘까요?
12406정성태11/8/202013162.NET Framework: 966. C# 9.0 - (15) 최상위 문(Top-level statements) [5]파일 다운로드1
12405정성태11/8/202010584.NET Framework: 965. C# 9.0 - (14) 부분 메서드에 대한 새로운 기능(New features for partial methods)파일 다운로드1
12404정성태11/7/202011126.NET Framework: 964. C# 9.0 - (13) 모듈 이니셜라이저(Module initializers)파일 다운로드1
12403정성태11/7/202011163.NET Framework: 963. C# 9.0 - (12) foreach 루프에 대한 GetEnumerator 확장 메서드 지원(Extension GetEnumerator)파일 다운로드1
12402정성태11/7/202011763.NET Framework: 962. C# 9.0 - (11) 공변 반환 형식(Covariant return types) [1]파일 다운로드1
12401정성태11/5/202010677VS.NET IDE: 153. 닷넷 응용 프로그램에서의 "My Code" 범위와 "Enable Just My Code"의 역할 [1]
12400정성태11/5/20207656오류 유형: 679. Visual Studio - "Source Not Found" 창에 "Decompile source code" 링크가 없는 경우
12399정성태11/5/202011373.NET Framework: 961. C# 9.0 - (10) 대상으로 형식화된 조건식(Target-typed conditional expressions)파일 다운로드1
12398정성태11/4/20209903오류 유형: 678. Windows Server 2008 R2 환경에서 Powershell을 psexec로 원격 실행할 때 hang이 발생하는 문제
12397정성태11/4/202010055.NET Framework: 960. C# - 조건 연산자(?:)를 사용하는 경우 달라지는 메서드 선택 사례파일 다운로드1
12396정성태11/3/20208382VS.NET IDE: 152. Visual Studio - "Tools" / "External Tools..."에 등록된 외부 명령어에 대한 단축키 설정 방법
12395정성태11/3/20209683오류 유형: 677. SSMS로 DB 접근 시 The server principal "..." is not able to access the database "..." under the current security context.
12394정성태11/3/20208120오류 유형: 676. cacls - The Recycle Bin on ... is corrupted. Do you want to empty the Recycle Bin for this drive?
12393정성태11/3/20208617오류 유형: 675. Visual Studio - 닷넷 응용 프로그램 디버깅 시 Disassembly 창에서 BP 설정할 때 "Error while processing breakpoint." 오류
... 46  47  48  [49]  50  51  52  53  54  55  56  57  58  59  60  ...