기본 콘텐츠로 건너뛰기

vcpkg - VisualC 용 package manager

 node.js 의 npm 처럼 c는 왜 간편한 패키지 설치 관리자 같은게 없나 늘 의문 이었슴.

c#(.net)을 위한 nuget 이 있기는 했지만, 이건 c++ 용이 아니라 여러가지가 혼재 되어 있어서

사용하기 애매 하단 느낌이었는데, 자료 검색 중 발견 !!!!!!!

이미 많은 분들이 사용하고 있을 듯, 사용법은 기존 pkg manager 와 비슷


https://github.com/microsoft/vcpkg

위 git 웹이지 설명에는 라고 되어 있었슴.

C++ Library Manager for Windows, Linux, and MacOS

해당 페이지에 설치 방법에 대해 설명이 있으니, 가능한 자세히 읽어볼 것.


VisualStudio 2019 community 설치(또는 다른 VisualStudio 버전중 택 1)

git 프로그램을 통해 해당 주소에서 소스 다운로드하고

윈도우 도스명령창(cmd.exe) 창에서 'bootstrap-vcpkg.bat' 입력후 <enter> 하면

vcpkg.exe 가 생생됨.


아래와 같이 명령을 사용할 수 있으며

>vcpkg version    <- 버젼 확인

>vcpkg list          <- 설치된 패키지 목록 조회

>vcpkg search <pkgname> <- 설치하고픈 이름의 패키지 찾기

>vcpkg install <pkgname>  <- 패키지 설치

>vcpkg remove <pkgname> <- 패키지 삭제


ex) mysql 검색시

G:\vcpkg>vcpkg search mysql

gdal[mysql-libmariadb]                Add mysql support using libmariadb

libmariadb           3.1.7#2          MariaDB Connector/C is used to connect C/C++ applications to MariaDB and MySQL...

libmariadb[openssl]                   Enable SSL support

libmariadb[zlib]                      Use internal zlib

libmysql             8.0.20           A MySQL client library for C development.

libodb-mysql         2.4.0-7          MySQL support for the ODB ORM library

poco[mysql]                           Mysql support for POCO

sqlpp11-connector... 0.29-1           A C++ wrapper for MySQL meant to be used in combination with sqlpp11.

sqlpp11-connector-mysql[mariadb]      Use MariaDB connector

sqlpp11-connector-mysql[mysql]        Use MySQL connector

If your library is not listed, please open an issue at and/or consider making a pull request:

    https://github.com/Microsoft/vcpkg/issues



ex>openssl 검색시

G:\vcpkg>vcpkg search openssl

boringssl            2020-04-07       BoringSSl is a fork of OpenSSL developed by Google

boringssl[tools]                      Build bssl executable

curl[openssl]                         SSL support (OpenSSL)

ffmpeg[openssl]                       openssl support in ffmpeg

freetds[openssl]                      OpenSSL support

ixwebsocket[openssl]                  SSL support (OpenSSL)

libarchive[openssl]                   OpenSSL support

libevent[openssl]                     Support for openssl

libevhtp[openssl]                     Support SSL for libevhtp

libmariadb[openssl]                   Enable SSL support

libpq[openssl]                        support for encrypted client connections and random number generation on platf...

librdkafka[ssl]                       Build with OpenSSL

libressl             2.9.1#3          LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, wit...

libressl[tools]                       Build openssl and ocspcheck executables

libssh[openssl]                       Crypto support (OpenSSL)

libzip[openssl]                       AES (encryption) support using OpenSSL

mongoose[ssl]                         Build with openssl

open62541[openssl]                    Enable encryption support (uses OpenSSL)

openssl              1.1.1g           OpenSSL is an open source project that provides a robust, commercial-grade, an...

openssl-unix         1.1.1g#1         OpenSSL is an open source project that provides a robust, commercial-grade, an...

openssl-uwp          1.1.1g           OpenSSL is an open source project that provides a robust, commercial-grade, an...

openssl-windows      1.1.1g           OpenSSL is an open source project that provides a robust, commercial-grade, an...

restbed[openssl]                      Secure over the wire communication allowing you to transmit private data online.

usockets[ssl]                         Build usockets with openssl support


If your library is not listed, please open an issue at and/or consider making a pull request:

    https://github.com/Microsoft/vcpkg/issues


>내용 추가, x64-windows-static 옵션을 주면, static 빌드도 얻을수 있슴.

아래는 지원하는 형식

G:\vcpkg>vcpkg help triplet

Available architecture triplets

VCPKG built-in triplets:

  arm-uwp

  arm64-windows

  x64-linux

  x64-osx

  x64-uwp

  x64-windows-static

  x64-windows

  x86-windows


VCPKG community triplets:

  arm-ios

  arm-mingw-dynamic

  arm-mingw-static

  arm-windows

  arm64-ios

  arm64-mingw-dynamic

  arm64-mingw-static

  arm64-osx

  arm64-uwp

  arm64-windows-static

  s390x-linux

  wasm32-emscripten

  x64-ios

  x64-mingw-dynamic

  x64-mingw-static

  x64-osx-dynamic

  x64-windows-static-md

  x86-ios

  x86-mingw-dynamic

  x86-mingw-static

  x86-uwp

  x86-windows-static-md

  x86-windows-static



주의 또는 참고

1.패키지는 보통 x86-windows, x64-windows, x64-windows-static 버젼이 있었슴.

>vcpkg install libmysql:x64-windows

입력시 64비트 버전 설치 가능 입력하지 않으면, x86버젼 설치

>vcpkg remove libmysql:x64-windows

삭제시에도 구분해서 삭제를 해주어야 함.


2.패키지 설치시에 필요한 파일이 vcpkg 아래 폴더에 다운로드 되고, 설치되고,

컴파일이 되어, vcpkg/installed 폴더 아래에 설치 되었슴

vcpkg/ports 는 로컬에 현재 설치가능한 목록을 로컬에 가지고 있어서, 검색을 용이하게

하는 것.


3.패키지 설치에 Dynamic Library(.dll) 또는 Static Library(.lib) 타입 이미 결정되어 있는 듯

아마도 CMake 툴 기반으로 동작하는 것 같은데, 해당 빌드 속성 변경은 잘모르겠슴.

boost 부터, openssl 까지 왠만한 모듈은 거의 다 있슴. 


4.vcpkg integrate install

-' visualStuio에서 vcpkg에서 설치한 패키지를 사용하고 싶으면 꼭 해줘야 함. (단, 이걸 몇번 해봐야 하는지는 모름.  필요한 것 다 설치하고 한번 해주면 되지 않을까?)


5. vcpkg 생성이 실패하거나 해당 패키지 설치후 빌드시 실패하면

관련 Issue( https://github.com/Microsoft/vcpkg/issues ) 쪽에서 관련 정보를 찾아보면 동일한 문제가 올라와 있으면, 조만간 수정된 내역이 올라오거나, 수정된 내용을 참고 해서 직접 수정하면 됨.



댓글

이 블로그의 인기 게시물

[c#.net] WPF 사용 중 xaml관련 실행시 오류 와 대처 방법

wpf 사용 중 xaml관련 실행시 오류 가 발생해서 자그마치 2일을 소비 했다..--;; 오류 내용은 아래와 같다. ================================== 'System.Windows.Markup.XamlParseException' 형식의 첫째 예외가 PresentationFrameWork.dll에서 발생했습니다. 추가 정보: '지정된 바인딩 제약 조건과 일치하는 'PapaZone.MainWindow' 형식에 대한 생성자 호출에서 예외가 throw 되었습니다.' 줄 번호 '21' 및 줄 위치 '9' 이 예외에 대한 처리기가 있으면 프로그램을 안전하게 계속할 수 있습니다. [] 이 예외 형식이 throw되면 중단 ================================== 위 Xaml 오류 메세지만으로는 내용 추적 불가하여, 도대체 뭔가 했다. 검색해도 뚜렷한 답변은 없었지만, 여러가지 의견을 종합해 보면 아래와 같다. 1. xmlns 관련 파일 과 관련된 파일 로딩 실패 이거나, 2. 신규로 추가된 namespace 에 속한 태그 사용시 오류로 판단되어 태그 하나씩 삽입하며 테스트 해봐야 한다고 함. 해결한 지금에 원인을 보면, xaml 에서 clr-namespace 로 추가된 항목들이 로딩에 실패해서 발생한 것이며, 추가된 항목은 있었으나, 이것과 연결된 파일이 없어서 로딩되지 않는 것이 문제였다. 오늘도 즐거운 하루~~

golang .protobuf go_package 오류 나는 문제.

1.golang용 protocol buffer 관련 모듈은 다운로드 받았음 go get -d -u google.golang.org/protobuf go install github.com/golang/protobuf/protoc-gen-go 2. pitaya 샘플 .proto 파일 생성을 시도 했으나, 아래 오류가 발생하면서 빌드 실패함 D:\pitaya>protoc --proto_path=examples\demo\worker\protos --go_out=plugins=grpc:. examples\demo\worker\protos\*.proto protoc-gen-go: unable to determine Go import path for "arg.proto" Please specify either:         • a "go_package" option in the .proto source file, or         • a "M" argument on the command line. See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information. --go_out: protoc-gen-go: Plugin failed with status code 1. D:\pitaya> stackoverflow 등 참고해도 비슷하지만 다른 내용들 뿐. .proto 파일내에 option go_package = "../protos_gen"; 내용 추가하여 빌드하니 잘됨. 3.기존 소스 -------------------------------- syntax = "proto3"; package protos; message Arg {   string msg = 1; } 4.신규 소스 -------------------------------- syntax ...