【问题标题】:Building Libraires [closed]建立图书馆[关闭]
【发布时间】:2021-06-09 04:13:34
【问题描述】:

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

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

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

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

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

【问题讨论】:

    标签: c++ libraries clickhouse


    【解决方案1】:

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

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

    您参考的文章应明确说明如何编译所需软件 - 只需遵循它 (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 考虑到第一次编译需要几个小时

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-28
      • 2014-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-28
      • 2011-05-15
      • 2021-11-16
      相关资源
      最近更新 更多