diff --git a/.github/.libcxx-setup.sh b/.github/.libcxx-setup.sh index 957c86b1..c173111f 100755 --- a/.github/.libcxx-setup.sh +++ b/.github/.libcxx-setup.sh @@ -10,8 +10,8 @@ fi # Build and install libc++ (Use unstable ABI for better sanitizer coverage) cd ./llvm-project -cmake -DCMAKE_C_COMPILER=${C_COMPILER} \ - -DCMAKE_CXX_COMPILER=${COMPILER} \ +cmake -DCMAKE_C_COMPILER=${CC} \ + -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_PREFIX=/usr \ -DLIBCXX_ABI_UNSTABLE=OFF \ diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml index bbfc7822..4f5b7320 100644 --- a/.github/workflows/sanitizer.yml +++ b/.github/workflows/sanitizer.yml @@ -45,11 +45,22 @@ jobs: echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" >> $GITHUB_ENV echo "LIBCXX_SANITIZER=Thread" >> $GITHUB_ENV + - name: setup clang + if: matrix.compiler == 'clang' + uses: egor-tensin/setup-clang@v1 + with: + version: latest + platform: x64 + #run: | + #sudo apt update && sudo apt -y install clang-13 clang++-13 + #echo "CC=clang-13" >> $GITHUB_ENV + #echo "CXX=clang++-13" >> $GITHUB_ENV + - name: configure clang if: matrix.compiler == 'clang' run: | - echo "CC=clang" >> $GITHUB_ENV - echo "CXX=clang++" >> $GITHUB_ENV + echo "CC=cc" >> $GITHUB_ENV + echo "CXX=c++" >> $GITHUB_ENV - name: configure gcc if: matrix.compiler == 'gcc' @@ -61,6 +72,7 @@ jobs: - name: install llvm stuff if: matrix.compiler == 'clang' run: | + # sudo apt update && sudo apt -y install libc++-dev libc++abi-dev libc++1 libc++abi1 "${GITHUB_WORKSPACE}/.github/.libcxx-setup.sh" echo "EXTRA_CXX_FLAGS=\"-stdlib=libc++\"" >> $GITHUB_ENV @@ -71,6 +83,7 @@ jobs: shell: bash working-directory: ${{ runner.workspace }}/_build run: > + VERBOSE=1 cmake $GITHUB_WORKSPACE -DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF -DBENCHMARK_ENABLE_LIBPFM=OFF diff --git a/cmake/CXXFeatureCheck.cmake b/cmake/CXXFeatureCheck.cmake index 62e6741f..aa67f58e 100644 --- a/cmake/CXXFeatureCheck.cmake +++ b/cmake/CXXFeatureCheck.cmake @@ -38,7 +38,8 @@ function(cxx_feature_check FILE) try_compile(COMPILE_${FEATURE} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS} - LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES}) + LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES} + OUTPUT_VARIABLE COMPILE_OUTPUT_VAR) if(COMPILE_${FEATURE}) message(WARNING "If you see build failures due to cross compilation, try setting HAVE_${VAR} to 0") @@ -51,7 +52,8 @@ function(cxx_feature_check FILE) try_run(RUN_${FEATURE} COMPILE_${FEATURE} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS} - LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES}) + LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES} + COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR) endif() endif() @@ -61,7 +63,7 @@ function(cxx_feature_check FILE) add_definitions(-DHAVE_${VAR}) else() if(NOT COMPILE_${FEATURE}) - message(STATUS "Performing Test ${FEATURE} -- failed to compile") + message(STATUS "Performing Test ${FEATURE} -- failed to compile: ${COMPILE_OUTPUT_VAR}") else() message(STATUS "Performing Test ${FEATURE} -- compiled but failed to run") endif()