目录
1.背景:
vcpkg支持多平台,Windows、Linux以及Mac。自动集成开源第三方C 和 C++ 库,如openssl等。摘自官网:vcpkg未添加到任何环境变量,并且不依赖于Windows注册表或Visual Studio
- 安装使用可参考官方网站
- 有问题可查看github源码的issues
- Mac环境需要Apple clang versions 9 或者以上版本
2.安装命令
# 下载源码
git clone https://github.com/Microsoft/vcpkg
# 转到安装目录
cd vcpkg
# mac下编译,执行脚本
./boostrap-vcpkg.sh
-
安装报错,参考网址来源。具体报错及解决方法如下:
ninja: error: loading 'build.ninja': No such file or directory
- 执行具体报错:
gushuai:vcpkg jl$ ./bootstrap-vcpkg.sh
Downloading cmake...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 621 0 621 0 0 529 0 --:--:-- 0:00:01 --:--:-- 529
100 27.6M 100 27.6M 0 0 1608k 0 0:00:17 0:00:17 --:--:-- 2194k
Downloading cmake... done.
Extracting cmake...
Extracting cmake... done.
Downloading ninja...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 602 0 602 0 0 418 0 --:--:-- 0:00:01 --:--:-- 419
100 77284 100 77284 0 0 25962 0 0:00:02 0:00:02 --:--:-- 58327
Downloading ninja... done.
Extracting ninja...
Extracting ninja... done.
/Users/shandikeji/vcpkg/scripts/bootstrap.sh: line 202: [: Configured with: --prefix=/Applications/Xcode: integer expression expected
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:10 (message):
Building the vcpkg tool requires support for the C++ Filesystem TS.
Apple clang versions 9 and below do not have support for it.
Please install gcc6 or newer from homebrew (brew install gcc6).
If you would like to try anyway, set VCPKG_ALLOW_APPLE_CLANG.
-- Configuring incomplete, errors occurred!
See also "/Users/shandikeji/vcpkg/toolsrc/build.rel/CMakeFiles/CMakeOutput.log".
ninja: error: loading 'build.ninja': No such file or directory
cp: /Users/shandikeji/vcpkg/toolsrc/build.rel/vcpkg: No such file or directory
- 解决方法:执行命令brew install gcc6
gushuai:vcpkg jl$ brew install gcc6
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/cask and homebrew/core).
==> New Formulae
anycable-go dhall istioctl kubeseal react-native-cli ruby@2.5 tass64
atomist-cli ghr jmxterm pass-otp redis@4.0 swagger-codegen@2 termtosvg
==> Updated Formulae
abcm2ps gdb llvm sbt
ammonite-repl gdcm lmdb schismtracker
angle-grinder gegl logstash shellshare
angular-cli get_iplayer logtalk signify-osx
annie git-quick-stats mame sip
antlr gitbucket mariadb-connector-c skaffold
antlr4-cpp-runtime gitlab-gem mas skopeo
apache-flink gitlab-runner maxwell sphinx-doc
arcade-learning-environment glib mdcat spotbugs
autorest global meson sqlcipher
awscli gnu-sed micronaut statik
babel gnutls mikutter subversion
babl go-bindata minio supervisor
ballerina gobject-introspection minio-mc swi-prolog
binaryen goenv mkl-dnn swiftlint
bison gopass mockserver syncthing
bitcoin goreleaser mono sysdig
blackbox gowsdl mysql tbb
blast grakn nasm tcpreplay
caf graphite2 neovim teleport
caffe grep netcdf terragrunt
capstone groff netpbm tgui
cgit gst-plugins-ugly newsboat theharvester
checkstyle gst-python nginx tika
circleci gtk+3 nnn tippecanoe
citus gzip node tmuxinator-completion
cocoapods handbrake node-build tomcat@8
cointop harfbuzz node@10 topgrade
commandbox haste-client node@6 tox
conan http-parser node@8 translate-shell
container-diff hub nodenv travis
cryptopp hugo nsd ucloud
dcd hwloc opencv uhd
dependency-check imagemagick openldap unbound
dfmt jabba openvdb unnethack
diamond jboss-forge orc-tools vala
diceware jhipster osrm-backend verilator
dnscontrol jsonnet paket vice
docfx kibana parallel vim
docker-machine-parallels kibana@5.6 pdfpc vim@7.4
doitlive kitchen-sync percona-server vips
doxygen knot-resolver perl weboob
dpkg kontena pgbadger webpack
dscanner kops pgweb weechat
easyengine kubernetes-helm php-code-sniffer wget
elasticsearch languagetool pilosa whois
embulk laszip postgis wireguard-go
emscripten ldc pre-commit wireguard-tools
erlang leptonica prometheus woboq_codebrowser
eslint libav protobuf wolfssl
exploitdb libbi pulumi wpscan
fb-client libccd pushpin wtf
ffmpeg libcec pygitup wxmaxima
ffmpeg2theora libcerf python x264
ffmpeg@2.8 libcouchbase qmmp xonsh
ffmpegthumbnailer libetpan r xsimd
ffms2 libgsf repo xtensor
firebase-cli libhttpserver rke ydcv
fish libmicrohttpd robot-framework yle-dl
fluxctl libnice rom-tools youtube-dl
fmt librsvg rpm z3
fn libsecret rswift zsh-completions
futhark libssh ruby zstd
gammaray libstfl ruby-build zurl
gauche libvmaf rust
gdal linkerd salt
==> Deleted Formulae
ffmbc gv
==> Downloading https://homebrew.bintray.com/bottles/gcc@6-6.5.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gcc@6-6.5.0.sierra.bottle.tar.gz
? /usr/local/Cellar/gcc@6/6.5.0: 1,438 files, 273.3MB
- 执行成功再次执行
./bootstrap-vcpkg.sh
- 成功结果如下:
gushuai:vcpkg jl$ ./bootstrap-vcpkg.sh
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is GNU 6.5.0
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/g++-6
-- Check for working CXX compiler: /usr/local/bin/g++-6 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/shandikeji/vcpkg/toolsrc/build.rel
[64/64] Linking CXX executable vcpkg
3.常用命令
- 查找库,不加库名可以查看全部
./vcpkg search openssl
- 安装库
./vcpkg install openssl
- 查看支持的架构
./vcpkg help triplet
- 列出已经安装的开源库
./vcpkg list
待补充...