1212 ARTIFACT_PIKA_NAME : artifact-pika
1313
1414jobs :
15+
1516 build_on_ubuntu :
1617 # The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
1718 # You can convert this to a matrix build if you need cross-platform coverage.
@@ -41,12 +42,32 @@ jobs:
4142 - name : Install Deps
4243 run : |
4344 sudo apt-get update
44- sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler clang-tidy
45+ sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler clang-tidy gcc-11 g++-11 zlib1g-dev
46+
47+ - name : Patch glibc headers for GCC compatibility
48+ run : |
49+ # Workaround for __has_attribute compatibility issue between newer glibc and GCC
50+ # Create a compatibility header that will be included before system headers
51+ cat > /tmp/glibc_compat_patch.h << 'EOF'
52+ /* Workaround for GCC __has_attribute compatibility */
53+ #if defined(__GNUC__) && __GNUC__ >= 11 && !defined(__clang__)
54+ #ifdef __glibc_has_attribute
55+ #undef __glibc_has_attribute
56+ #endif
57+ #define __glibc_has_attribute(attr) __has_attribute(attr)
58+ #endif
59+ EOF
60+ # Prepend the workaround to sys/cdefs.h
61+ if [ -f /usr/include/sys/cdefs.h ]; then
62+ sudo cp /usr/include/sys/cdefs.h /tmp/cdefs.h.backup
63+ cat /tmp/glibc_compat_patch.h /tmp/cdefs.h.backup | sudo tee /usr/include/sys/cdefs.h > /dev/null
64+ elif [ -f /usr/include/x86_64-linux-gnu/sys/cdefs.h ]; then
65+ sudo cp /usr/include/x86_64-linux-gnu/sys/cdefs.h /tmp/cdefs.h.backup
66+ cat /tmp/glibc_compat_patch.h /tmp/cdefs.h.backup | sudo tee /usr/include/x86_64-linux-gnu/sys/cdefs.h > /dev/null
67+ fi
4568
4669 - name : Configure CMake
47- # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
48- # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
49- run : cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
70+ run : cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
5071
5172 - name : Build
5273 # Build your program with the given configuration
@@ -166,7 +187,7 @@ jobs:
166187 - name : Install deps
167188 run : |
168189 dnf update -y
169- dnf install -y bash cmake wget git autoconf gcc perl-Digest-SHA tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel gcc-toolset-13 binutils
190+ dnf install -y bash cmake wget git autoconf gcc perl-Digest-SHA tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel gcc-toolset-12 binutils openssl openssl-devel zlib-devel
170191 dnf clean all
171192 rm -rf /var/cache/dnf
172193
@@ -180,9 +201,28 @@ jobs:
180201 with :
181202 fetch-depth : 1
182203
204+ - name : Patch glibc headers for GCC compatibility
205+ run : |
206+ # Workaround for __has_attribute compatibility issue between newer glibc and GCC
207+ # Create a compatibility header that will be included before system headers
208+ cat > /tmp/glibc_compat_patch.h << 'EOF'
209+ /* Workaround for GCC __has_attribute compatibility */
210+ #if defined(__GNUC__) && __GNUC__ >= 11 && !defined(__clang__)
211+ #ifdef __glibc_has_attribute
212+ #undef __glibc_has_attribute
213+ #endif
214+ #define __glibc_has_attribute(attr) __has_attribute(attr)
215+ #endif
216+ EOF
217+ # Prepend the workaround to sys/cdefs.h
218+ if [ -f /usr/include/sys/cdefs.h ]; then
219+ cp /usr/include/sys/cdefs.h /tmp/cdefs.h.backup
220+ cat /tmp/glibc_compat_patch.h /tmp/cdefs.h.backup > /usr/include/sys/cdefs.h
221+ fi
222+
183223 - name : Configure CMake
184224 run : |
185- source /opt/rh/gcc-toolset-13 /enable
225+ source /opt/rh/gcc-toolset-12 /enable
186226 cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address .
187227
188228 - uses : actions/cache@v3
@@ -197,7 +237,7 @@ jobs:
197237
198238 - name : Build
199239 run : |
200- source /opt/rh/gcc-toolset-13 /enable
240+ source /opt/rh/gcc-toolset-12 /enable
201241 cmake --build build --config ${{ env.BUILD_TYPE }}
202242
203243 - name : Cleanup
@@ -292,13 +332,14 @@ jobs:
292332 - name : Install Deps
293333 run : |
294334 brew list --versions cmake && brew uninstall --ignore-dependencies --force cmake || true
295- brew install gcc@13 automake cmake make binutils
335+ brew install gcc@11 automake cmake make binutils
296336
297337 - name : Configure CMake
338+ # Use GCC 11 to avoid potential __has_attribute compatibility issues with GCC 13
298339 run : |
299- GCC_PREFIX=$(brew --prefix gcc@13 )
300- export CC=$GCC_PREFIX/bin/gcc-13
301- cmake -B build -DCMAKE_C_COMPILER=$GCC_PREFIX/bin/gcc-13 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
340+ GCC_PREFIX=$(brew --prefix gcc@11 )
341+ export CC=$GCC_PREFIX/bin/gcc-11
342+ cmake -B build -DCMAKE_C_COMPILER=$GCC_PREFIX/bin/gcc-11 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
302343
303344 - name : Build
304345 run : |
0 commit comments