From 18ac0ecc9c402a472afb057418de50ccf47c7df4 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Tue, 31 Oct 2023 15:00:31 +0800 Subject: [PATCH] [ci][fix]use libc++ when compile with clang (#483) --- .github/workflows/bazel.yml | 10 ++++++++-- .github/workflows/ubuntu_clang.yml | 16 ++++++++++++++-- src/struct_pb/conformance/CMakeLists.txt | 2 +- src/struct_pb/protoc-plugin/CMakeLists.txt | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 26a5efefb..e502b0ac4 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -14,10 +14,16 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + - name: Build working-directory: ${{github.workspace}} - run: bazel build --action_env=CXX=clang++ --action_env=CC=clang ... + run: bazel build --action_env=CXX=clang++-17 --action_env=CC=clang-17 ... - name: Test working-directory: ${{github.workspace}} - run: bazel test --action_env=CXX=clang++ --action_env=CC=clang --test_output=errors ... + run: bazel test --action_env=CXX=clang++-17 --action_env=CC=clang-17 --test_output=errors ... diff --git a/.github/workflows/ubuntu_clang.yml b/.github/workflows/ubuntu_clang.yml index bec55fd17..5cf08d318 100644 --- a/.github/workflows/ubuntu_clang.yml +++ b/.github/workflows/ubuntu_clang.yml @@ -31,6 +31,12 @@ jobs: - name: Install ninja-build tool uses: seanmiddleditch/gha-setup-ninja@master + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: @@ -40,7 +46,7 @@ jobs: run: | cmake -B ${{github.workspace}}/build -G Ninja \ -DCMAKE_BUILD_TYPE=${{matrix.mode}} -DBUILD_WITH_LIBCXX=${{matrix.libcxx}} -DENABLE_SSL=${{matrix.ssl}} \ - -DUSE_CCACHE=${{env.ccache}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + -DUSE_CCACHE=${{env.ccache}} -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17 - name: Build run: cmake --build ${{github.workspace}}/build --config ${{matrix.mode}} @@ -69,6 +75,12 @@ jobs: - name: Install ninja-build tool uses: seanmiddleditch/gha-setup-ninja@v3 + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + - name: Check protoc run: protoc --version @@ -81,7 +93,7 @@ jobs: CXX=clang++ CC=clang cmake -B ${{github.workspace}}/build -G Ninja \ -DCMAKE_BUILD_TYPE=${{matrix.mode}} -DBUILD_WITH_LIBCXX=${{matrix.libcxx}} -DENABLE_SSL=${{matrix.ssl}} \ - -DUSE_CCACHE=${{env.ccache}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++\ + -DUSE_CCACHE=${{env.ccache}} -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17\ -DBUILD_CORO_HTTP=OFF -DBUILD_CORO_IO=OFF -DBUILD_CORO_RPC=OFF -DBUILD_EASYLOG=OFF -DBUILD_STRUCT_JSON=OFF -DBUILD_STRUCT_XML=OFF -DBUILD_STRUCT_YAML=OFF -DBUILD_UTIL=OFF - name: Build run: cmake --build ${{github.workspace}}/build --config ${{matrix.mode}} diff --git a/src/struct_pb/conformance/CMakeLists.txt b/src/struct_pb/conformance/CMakeLists.txt index ebf5c4946..e2fa900bc 100644 --- a/src/struct_pb/conformance/CMakeLists.txt +++ b/src/struct_pb/conformance/CMakeLists.txt @@ -1,7 +1,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/tests/struct_pb) find_package(Protobuf QUIET) if (NOT Protobuf_FOUND) - message(WARNING "to build struct_pb conformance test, you must install libprotoc first!!!") + message(STATUS "to build struct_pb conformance test, you need to install libprotoc first") return() endif () set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/src/struct_pb/protoc-plugin/CMakeLists.txt b/src/struct_pb/protoc-plugin/CMakeLists.txt index fc9c2a21d..b8ac9a070 100644 --- a/src/struct_pb/protoc-plugin/CMakeLists.txt +++ b/src/struct_pb/protoc-plugin/CMakeLists.txt @@ -11,7 +11,7 @@ if (Protobuf_FOUND) RUNTIME DESTINATION bin ) else () - message(WARNING "struct_pb is skipped. To build struct_pb protoc plugin, you must install libprotoc first!!!\n" + message(STATUS "struct_pb is skipped. To build struct_pb protoc plugin, you need to install libprotoc first\n" "see https://alibaba.github.io/yalantinglibs/en/struct_pb/struct_pb_generating_your_struct.html" ) endif ()