• 如何在Mac OS X上构建ClickHouse


    官网地址:https://clickhouse.com/docs/en/development/build-osx/

    构建应该适用于基于x86_64(Intel)和arm64(Apple Silicon)的macOS 10.15(Catalina)及更高版本,并使用Homebrew的Clang。
    始终建议使用 Clang 编译器。

    可以使用 Xcode 的 AppleClanggcc,但强烈建议不要这样做。

    安装 Homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    安装 Xcode and Command Line Tools

    安装最新的Xcode来自应用商店。
    至少打开一次以接受最终用户许可协议并自动安装所需组件。
    然后,确保在系统中安装并选择了最新的命令行工具:

    sudo rm -rf /Library/Developer/CommandLineTools
    sudo xcode-select --install
    

    重新启动

    安装 所需的编译器、工具和库

    brew update
    brew install cmake ninja libtool gettext llvm gcc binutils
    

    拉取 ClickHouse 源码

    git clone --recursive https://github.com/ClickHouse/ClickHouse.git
    

    或者使用代理

    git clone --recursive https://hub.fastgit.org/ClickHouse/ClickHouse.git
    

    构建 ClickHouse

    要使用Homebrew的Clang编译器构建:

    cd ClickHouse
    rm -rf build
    mkdir build
    cd build
    cmake -DCMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
    cmake --build . --config RelWithDebInfo
    cd ..
    

    要使用Xcode的本机AppleClang编译器生成(强烈建议不要使用此选项;请使用上面的选项):

    cd ClickHouse
    rm -rf build
    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
    cmake --build . --config RelWithDebInfo
    cd ..
    

    使用Homebrew的GCC编译器构建(绝对不推荐使用此选项,我想知道我们为什么会有此选项):

    cd ClickHouse
    rm -rf build
    mkdir build
    cd build
    cmake -DCMAKE_C_COMPILER=$(brew --prefix gcc)/bin/gcc-11 -DCMAKE_CXX_COMPILER=$(brew --prefix gcc)/bin/g++-11 -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
    cmake --build . --config RelWithDebInfo
    cd ..
    

    警告

    如果要运行clickhouse server,请确保增加系统的maxfiles变量。

    注意, 可能需要用 sudo

    为此,请使用以下内容创建/Library/LaunchDaemons/limit.maxfiles.plist文件:

    sudo vim /Library/LaunchDaemons/limit.maxfiles.plistk
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
            "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>limit.maxfiles</string>
        <key>ProgramArguments</key>
        <array>
          <string>launchctl</string>
          <string>limit</string>
          <string>maxfiles</string>
          <string>524288</string>
          <string>524288</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>ServiceIPC</key>
        <false/>
      </dict>
    </plist>
    

    为文件授予正确的权限:

    sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
    

    验证文件是否正确:

    plutil /Library/LaunchDaemons/limit.maxfiles.plist
    

    加载文件(或重新启动):

    sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
    

    要检查它是否工作,请使用 ulimit-nlaunchctl limit maxfiles命令。

    运行 ClickHouse Server

    cd ClickHouse
    ./build/programs/clickhouse-server --config-file ./programs/server/config.xml
    
  • 相关阅读:
    在线压缩与解压
    批处理删除文件del dos cmd
    git教程
    网页图标下载
    vs2010使用git
    配置 authorization deny allow
    mvc4下载
    nuget自动发布脚本
    OAuth2.0
    使用 HttpModel与现有基于共享登录信息( Cookie )的网站进行集成
  • 原文地址:https://www.cnblogs.com/lwc1st/p/15606350.html
Copyright © 2020-2023  润新知