建立图书馆

时间:2021-06-09 04:13:34

标签: c++ open-source libraries clickhouse

谁能解释一下不依赖包管理器的情况下构建库的过程。我是一名新的开发人员,我发现每次完成这项任务都非常困难。我目前正在尝试构建 https://github.com/ClickHouse/ClickHouse 库,以便我可以为它做出贡献并获得现实世界的经验。

我设法按照 https://clickhouse.tech/docs/en/development/developer-instruction/ 进行操作,但我现在很困惑在哪里可以找到 .Sln 文件以开始编码。

顺便说一句:我在虚拟机上使用 Ubuntu 20.04.2.0。

我的问题:有人能给我一个关于如何构建库的详细或简单的概述吗?以 Clickhouse 库为例也会有所帮助。build directory

我添加了我的构建目录的图片,如果这也有助于显示我哪里出错了。

1 个答案:

答案 0 :(得分:1)

ClickHouse 是用 C++ 编写的(不是 C#,所以没有 sln-file)。

C++ 没有其他世界中的标准包管理器 - .net (nuget)、nodejs (npm) 等而是使用了 git submodules

您参考的文章应该明确说明如何编译所需的软件 - 只需按照它 (https://clickhouse.tech/docs/en/development/developer-instruction/#creating-a-repository-on-github)。

我可以重复这篇文章:

# configure git (call just ONCE)
git clone https://github.com/your_git/ClickHouse.git
git remote add upstream git@github.com:ClickHouse/ClickHouse.git

# get the latest version (https://stackoverflow.com/a/7244456/303298)
git fetch upstream
git checkout master
git rebase upstream/master
git push -f origin master

# get packages files
git submodule sync --recursive
git submodule update --init --recursive -f


# build
mkdir build
cd build

export CC=clang-10 CXX=clang++-10
cmake -D CMAKE_BUILD_TYPE=Debug ..
ninja -j 2 clickhouse-server clickhouse-client

# run compiled code
cd {your_repo_location}/ClickHouse/programs/server

../../build/programs/clickhouse-server
../../build/programs/clickhouse-client

# run tests
cd {your_repo_location}/ClickHouse/tests

./clickhouse-test -b ../build/programs/clickhouse --print-time --no-stateful 00189 00921

ps 所有这些步骤在官方文档中都有详细描述 - 我会遵循这些文档,如果你发现一些错误,请不要犹豫,修复它

ps2 考虑到第一次编译需要几个小时

相关问题