From ac594e732b9433f40d434c79ac935a95a05a0501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Fri, 12 May 2023 15:06:08 +0200 Subject: [PATCH 1/6] cmake: drop old workaround --- CMakeLists.txt | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 995c653154e..510a2a551ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,25 +148,11 @@ if(cmake_build_type_lower MATCHES "addresssanitizer") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") - if (CMAKE_COMPILER_IS_GNUCXX) - # Work around GCC bug. It should automatically link to asan when - # -fsanitize=address is used, but doesn't. - # - # Linking everything with asan is harmless and simple, so do that. - link_libraries(asan) # Workaround for LP:1413474 - endif() elseif(cmake_build_type_lower MATCHES "threadsanitizer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=thread") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=thread") - if (CMAKE_COMPILER_IS_GNUCXX) - # Work around GCC bug. It should automatically link to tsan when - # -fsanitize=thread is used, but doesn't. - # - # Linking everything with tsan is harmless and simple, so do that. - link_libraries(tsan) # Workaround for LP:1413474 - endif() elseif(cmake_build_type_lower MATCHES "ubsanitizer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer") @@ -174,13 +160,6 @@ elseif(cmake_build_type_lower MATCHES "ubsanitizer") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=undefined") # "Symbol already defined" errors occur with pre-compiled headers SET(MIR_USE_PRECOMPILED_HEADERS OFF CACHE BOOL "Use precompiled headers" FORCE) - if (CMAKE_COMPILER_IS_GNUCXX) - # Work around GCC bug. It should automatically link to asan when - # -fsanitize=undefined is used, but doesn't. - # - # Linking everything with ubsan is harmless and simple, so do that. - link_libraries(ubsan) # Workaround for LP:1413474 - endif() # We have inline classes as interfaces used by .so's and implemented elsewhere. # This results in multiple trivial implementations. So let's not warn about that. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=vptr") From 7d87a8826fa8b8862a5f0ef3362a24165d79a13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Fri, 12 May 2023 15:06:43 +0200 Subject: [PATCH 2/6] spread: simplify build-dep install --- spread/build/ubuntu/task.yaml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/spread/build/ubuntu/task.yaml b/spread/build/ubuntu/task.yaml index 015324d8784..2b1274e1f9e 100644 --- a/spread/build/ubuntu/task.yaml +++ b/spread/build/ubuntu/task.yaml @@ -12,8 +12,6 @@ summary: Build Ubuntu packages execute: | cd $SPREAD_PATH - apt-get install --yes software-properties-common - # Add Mir dev PPA for any out-of-archive packages needed # (Currently: a newer version of WLCS) add-apt-repository ppa:mir-team/dev @@ -21,11 +19,9 @@ execute: | # to get dpkg-architecture and mk-build-deps apt-get install \ --yes \ - --no-install-recommends \ ccache \ devscripts \ - dpkg-dev \ - equivs + dpkg-dev # set host and build environment up source <( dpkg-architecture --print-set --host-arch ${ARCH} ) @@ -59,18 +55,13 @@ execute: | apt-get update apt-get --yes install qemu-user-static binfmt-support - - # Quirk for the eglexternalplatform-dev build dependency - sed -i 's/\(eglexternalplatform-dev\)/\1:all/' debian/control fi # Mark the "release" in the changelog debchange --release "CI release" # install dependencies - mk-build-deps \ - --install \ - --tool "apt-get --yes -o Debug::pkgProblemResolver=yes -o APT::Immediate-Configure=0" + apt-get build-dep --yes ./ # use clang if [ "${CLANG}" -eq 1 ]; then From f1298f906843c34dd34a6d555685b8a2a0157d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Fri, 12 May 2023 16:53:20 +0200 Subject: [PATCH 3/6] sanitizers: use nostrip --- spread.yaml | 5 +++-- spread/build/sbuild/task.yaml | 2 +- spread/build/ubuntu/task.yaml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spread.yaml b/spread.yaml index f30a86a764d..500c6fc570f 100644 --- a/spread.yaml +++ b/spread.yaml @@ -34,8 +34,9 @@ environment: BUILD_TYPE/asan,asan_clang: AddressSanitizer BUILD_TYPE/tsan,tsan_clang: ThreadSanitizer BUILD_TYPE/ubsan,ubsan_clang: UBSanitizer - NOCHECK: "" - NOCHECK/asan,tsan,asan_clang,tsan_clang: nocheck + DEB_BUILD_EXTRA: + DEB_BUILD_EXTRA/ubsan,ubsan_clang: nostrip + DEB_BUILD_EXTRA/asan,asan_clang,tsan,tsan_clang: nostrip nocheck CTEST_OUTPUT_ON_FAILURE: 1 CCACHE_DIR: /root/.ccache # Needed for precompiled headers (https://ccache.dev/manual/latest.html#_precompiled_headers) diff --git a/spread/build/sbuild/task.yaml b/spread/build/sbuild/task.yaml index bfb71939a2b..2acac15463a 100644 --- a/spread/build/sbuild/task.yaml +++ b/spread/build/sbuild/task.yaml @@ -1,5 +1,5 @@ environment: - DEB_BUILD_OPTIONS: "${NOCHECK}" + DEB_BUILD_OPTIONS: "${DEB_BUILD_EXTRA}" NO_PKG_MANGLE: 1 systems: [ubuntu-*] diff --git a/spread/build/ubuntu/task.yaml b/spread/build/ubuntu/task.yaml index 2b1274e1f9e..a585c421f01 100644 --- a/spread/build/ubuntu/task.yaml +++ b/spread/build/ubuntu/task.yaml @@ -1,5 +1,5 @@ environment: - DEB_BUILD_OPTIONS: "parallel=$( nproc ) noopt ${NOCHECK}" + DEB_BUILD_OPTIONS: "parallel=$( nproc ) noopt ${DEB_BUILD_EXTRA}" NO_PKG_MANGLE: 1 systems: [ubuntu-*] From d6b7fff3734a124b9b7d8f4a22c75c3d84ed385a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Fri, 12 May 2023 17:15:56 +0200 Subject: [PATCH 4/6] spread: install wlcs-dbgsym if it's of use --- spread/build/ubuntu/task.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spread/build/ubuntu/task.yaml b/spread/build/ubuntu/task.yaml index a585c421f01..a9f227b3940 100644 --- a/spread/build/ubuntu/task.yaml +++ b/spread/build/ubuntu/task.yaml @@ -12,16 +12,19 @@ summary: Build Ubuntu packages execute: | cd $SPREAD_PATH + NODBG=$( [[ "${DEB_BUILD_OPTIONS}" != *nostrip* ]] && echo true || echo false ) + # Add Mir dev PPA for any out-of-archive packages needed # (Currently: a newer version of WLCS) - add-apt-repository ppa:mir-team/dev + add-apt-repository ppa:mir-team/dev --component "main $( $NODBG || echo main/debug )" # to get dpkg-architecture and mk-build-deps apt-get install \ --yes \ ccache \ devscripts \ - dpkg-dev + dpkg-dev \ + $( $NODBG || echo wlcs-dbgsym ) # set host and build environment up source <( dpkg-architecture --print-set --host-arch ${ARCH} ) From 989ad916c4f8448935bed16a8c5695063789251e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Mon, 28 Aug 2023 17:21:18 +0200 Subject: [PATCH 5/6] sanitizers: use modern CMake commands --- CMakeLists.txt | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 510a2a551ba..eb9a6b40850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,30 +144,22 @@ if(cmake_build_type_lower MATCHES "coverage") endif() if(cmake_build_type_lower MATCHES "addresssanitizer") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") + add_compile_options(-fsanitize=address -fno-omit-frame-pointer) + add_link_options(-fsanitize=address) elseif(cmake_build_type_lower MATCHES "threadsanitizer") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=thread") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=thread") + add_compile_options(-fsanitize=thread -fno-omit-frame-pointer) + add_link_options(-fsanitize=thread) elseif(cmake_build_type_lower MATCHES "ubsanitizer") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=undefined") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=undefined") + add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer) + add_link_options(-fsanitize=undefined) # "Symbol already defined" errors occur with pre-compiled headers SET(MIR_USE_PRECOMPILED_HEADERS OFF CACHE BOOL "Use precompiled headers" FORCE) # We have inline classes as interfaces used by .so's and implemented elsewhere. # This results in multiple trivial implementations. So let's not warn about that. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=vptr") + add_compile_options(-fno-sanitize=vptr) else() # AddressSanitizer builds fail if we disallow undefined symbols - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined") + add_link_options(-Wl,--no-undefined) endif() enable_testing() From 32c2f13489fc6b0ff3191df654f4d709ba89407d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Tue, 29 Aug 2023 14:24:42 +0200 Subject: [PATCH 6/6] spread: add upterm step --- .github/workflows/spread.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spread.yml b/.github/workflows/spread.yml index c0841d070d8..c78de37c6b7 100644 --- a/.github/workflows/spread.yml +++ b/.github/workflows/spread.yml @@ -112,7 +112,13 @@ jobs: echo "max_size = 800M" > ${CCACHE_DIR}/ccache.conf - name: Run Spread task - run: snap run spread-mir-ci.spread -v ${{ matrix.spread-task }} + run: snap run spread-mir-ci.spread -reuse -v ${{ matrix.spread-task }} - name: CCache stats run: cat ${CCACHE_DIR}/ccache.stats + + - if: ${{ failure() && runner.debug }} + name: Setup upterm session + uses: lhotari/action-upterm@v1 + with: + limit-access-to-actor: true