笔记笔记
  • Home
  • AI&ML
  • Example
  • Zoo
  • 关于
⌘ K
C++
Oat++
最后更新时间:
Copyright © 2023-2024 | Powered by dumi | GuoDapeng | 冀ICP备20004032号-1 | 冀公网安备 冀公网安备 13024002000293号

TABLE OF CONTENTS

‌
‌
‌
‌

C++

clang-format

brew install clang-format
clang-format --version
# clang-format version 19.1.4
# 格式化代码并且覆盖源文件
clang-format -i src/db/UserDb.hpp

vcpkg

Apple Silicon

# 安装 cmake
brew install cmake
cmake --version
# 安装 ninja
brew install ninja
ninja --version
# ffmpeg 依赖需要安装 nasm
brew install nasm
nasm -v
# 安装 vcpkg
brew install vcpkg
# 在一个喜欢的位置克隆
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh
# 配置环境变量
vi ~/.zshrc
# 添加
export VCPKG_ROOT=$HOME/Documents/env/vcpkg
export PATH=$VCPKG_ROOT:$PATH

Ubuntu 22.04.4 LTS x86_64

# 安装 cmake
apt install cmake
cmake --version
# 安装 ninja;系统里面一般已经有了
apt install ninja-build
ninja --version
# ffmpeg 依赖需要安装 nasm
sudo apt-get install nasm
nasm -v
# 克隆 vcpkg;我喜欢在加目录下面创建一个 env 目录,vcpkg 放在 ~/env/vcpkg 位置
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh
vi ~/.bashrc
# 添加
export VCPKG_ROOT=$HOME/env/vcpkg
export PATH=$VCPKG_ROOT:$PATH
# 刷新
source .bashrc
# 测试
vcpkg help

CMake 集成 vcpkg

Kali Linux - aarch64

apt-get update
# 安装 cmake
apt install cmake
cmake --version
# 安装 ninja;系统里面一般已经有了
apt install ninja-build
ninja --version
# 克隆 vcpkg;我喜欢在加目录下面创建一个 env 目录,vcpkg 放在 ~/env/vcpkg 位置
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh
source ~/.zshrc
# 添加
export VCPKG_FORCE_SYSTEM_BINARIES=1
export VCPKG_ROOT=$HOME/env/vcpkg
export PATH=$VCPKG_ROOT:$PATH
# 刷新
source .bashrc
# 测试
vcpkg help

./bootstrap-vcpkg.sh 可能会出现错误:

Environment variable VCPKG_FORCE_SYSTEM_BINARIES must be set on arm, s390x, ppc64le and riscv platforms.

尝试使用 export VCPKG_FORCE_SYSTEM_BINARIES=1 环境变量。

vcpkg install 可能会出现错误:

CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:166 (message):
Could not find pkg-config. Please install it via your package manager:
sudo apt-get install pkg-config
Call Stack (most recent call first):
scripts/cmake/vcpkg_fixup_pkgconfig.cmake:193 (vcpkg_find_acquire_program)
/home/kali/.cache/vcpkg/registries/git-trees/48788514ae1e84dea9055e603527c91f92c124fb/portfile.cmake:80 (vcpkg_fixup_pkgconfig)
scripts/ports.cmake:192 (include)
error: building cryptopp:arm64-linux failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle cryptopp:arm64-linux: 23 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+cryptopp
You can submit a new issue at:
https://github.com/microsoft/vcpkg/issues/new?title=[cryptopp]+Build+error+on+arm64-linux&body=Copy+issue+body+from+%2Fhome%2Fkali%2FDocuments%2Fgaze%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

安装提示安装 pkg-config。