fix sanitizer builds by using clang 13 (#1426)

* attempt to fix sanitizer builds by moving away from llvm head

* extra verbosity

* try clang 13 and add extra logging

* get latest clang and try again
This commit is contained in:
Dominic Hamon 2022-07-05 10:41:38 +01:00 committed by GitHub
parent 0a95a422b9
commit 8205547ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 7 deletions

View file

@ -10,8 +10,8 @@ fi
# Build and install libc++ (Use unstable ABI for better sanitizer coverage) # Build and install libc++ (Use unstable ABI for better sanitizer coverage)
cd ./llvm-project cd ./llvm-project
cmake -DCMAKE_C_COMPILER=${C_COMPILER} \ cmake -DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${COMPILER} \ -DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DLIBCXX_ABI_UNSTABLE=OFF \ -DLIBCXX_ABI_UNSTABLE=OFF \

View file

@ -45,11 +45,22 @@ jobs:
echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" >> $GITHUB_ENV echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" >> $GITHUB_ENV
echo "LIBCXX_SANITIZER=Thread" >> $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 - name: configure clang
if: matrix.compiler == 'clang' if: matrix.compiler == 'clang'
run: | run: |
echo "CC=clang" >> $GITHUB_ENV echo "CC=cc" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV echo "CXX=c++" >> $GITHUB_ENV
- name: configure gcc - name: configure gcc
if: matrix.compiler == 'gcc' if: matrix.compiler == 'gcc'
@ -61,6 +72,7 @@ jobs:
- name: install llvm stuff - name: install llvm stuff
if: matrix.compiler == 'clang' if: matrix.compiler == 'clang'
run: | run: |
# sudo apt update && sudo apt -y install libc++-dev libc++abi-dev libc++1 libc++abi1
"${GITHUB_WORKSPACE}/.github/.libcxx-setup.sh" "${GITHUB_WORKSPACE}/.github/.libcxx-setup.sh"
echo "EXTRA_CXX_FLAGS=\"-stdlib=libc++\"" >> $GITHUB_ENV echo "EXTRA_CXX_FLAGS=\"-stdlib=libc++\"" >> $GITHUB_ENV
@ -71,6 +83,7 @@ jobs:
shell: bash shell: bash
working-directory: ${{ runner.workspace }}/_build working-directory: ${{ runner.workspace }}/_build
run: > run: >
VERBOSE=1
cmake $GITHUB_WORKSPACE cmake $GITHUB_WORKSPACE
-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF -DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF
-DBENCHMARK_ENABLE_LIBPFM=OFF -DBENCHMARK_ENABLE_LIBPFM=OFF

View file

@ -38,7 +38,8 @@ function(cxx_feature_check FILE)
try_compile(COMPILE_${FEATURE} try_compile(COMPILE_${FEATURE}
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS} CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES}) LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES}
OUTPUT_VARIABLE COMPILE_OUTPUT_VAR)
if(COMPILE_${FEATURE}) if(COMPILE_${FEATURE})
message(WARNING message(WARNING
"If you see build failures due to cross compilation, try setting HAVE_${VAR} to 0") "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} try_run(RUN_${FEATURE} COMPILE_${FEATURE}
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS} CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES}) LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES}
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR)
endif() endif()
endif() endif()
@ -61,7 +63,7 @@ function(cxx_feature_check FILE)
add_definitions(-DHAVE_${VAR}) add_definitions(-DHAVE_${VAR})
else() else()
if(NOT COMPILE_${FEATURE}) if(NOT COMPILE_${FEATURE})
message(STATUS "Performing Test ${FEATURE} -- failed to compile") message(STATUS "Performing Test ${FEATURE} -- failed to compile: ${COMPILE_OUTPUT_VAR}")
else() else()
message(STATUS "Performing Test ${FEATURE} -- compiled but failed to run") message(STATUS "Performing Test ${FEATURE} -- compiled but failed to run")
endif() endif()