Skip to content

Commit 3193856

Browse files
committed
Work around bitwuzla/bitwuzla#96 on Ubuntu 20.04
Sadly, Ubuntu 20.04's version of `glibc` is susceptible to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909. We work around the issue by applying a workaround taken from https://bbs.archlinux.org/viewtopic.php?pid=2022393#p2022393.
1 parent 38ac8f1 commit 3193856

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.github/ci.sh

+7
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ build_abc() {
4444

4545
build_bitwuzla() {
4646
pushd repos/bitwuzla
47+
if [ "$GITHUB_MATRIX_OS" == 'ubuntu-20.04' ] ; then
48+
# Ubuntu 20.04 uses an older version of glibc that is susceptible to
49+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909, so we must apply a
50+
# crude workaround for it. Thankfully, this is not required for the version
51+
# of glibc that ships with Ubuntu 22.04.
52+
patch -p1 -i $PATCHES/bitwuzla-T58909-workaround.patch
53+
fi
4754
./configure.py
4855
cd build
4956
ninja -j4

.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,15 @@ jobs:
8383
- name: build_solver (non-Windows)
8484
shell: bash
8585
run: .github/ci.sh build_${{ matrix.solver }}
86+
env:
87+
GITHUB_MATRIX_OS: ${{ matrix.os }}
8688
if: runner.os != 'Windows'
8789

8890
- name: build_solver (Windows)
8991
shell: msys2 {0}
9092
run: .github/ci.sh build_${{ matrix.solver }}
93+
env:
94+
GITHUB_MATRIX_OS: ${{ matrix.os }}
9195
if: runner.os == 'Windows'
9296

9397
- uses: actions/upload-artifact@v2
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/src/main/time_limit.cpp b/src/main/time_limit.cpp
2+
index 45238be4..f1ee25cb 100644
3+
--- a/src/main/time_limit.cpp
4+
+++ b/src/main/time_limit.cpp
5+
@@ -6,6 +6,7 @@
6+
#include <cstdlib>
7+
#include <iostream>
8+
#include <thread>
9+
+#include <pthread.h>
10+
11+
namespace bzla::main {
12+
13+
@@ -15,6 +16,18 @@ std::condition_variable cv;
14+
std::mutex cv_m;
15+
bool time_limit_set = false;
16+
17+
+// Work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909
18+
+// on old versions of glibc
19+
+void pthread_cond_bug() {
20+
+ pthread_cond_signal((pthread_cond_t *) nullptr);
21+
+ pthread_cond_init((pthread_cond_t *) nullptr,
22+
+ (const pthread_condattr_t *) nullptr);
23+
+ pthread_cond_destroy((pthread_cond_t *) nullptr);
24+
+ pthread_cond_timedwait((pthread_cond_t *) nullptr, (pthread_mutex_t *)
25+
+ nullptr, (const struct timespec *) nullptr);
26+
+ pthread_cond_wait((pthread_cond_t *) nullptr, (pthread_mutex_t *) nullptr);
27+
+}
28+
+
29+
void
30+
timeout_reached()
31+
{

0 commit comments

Comments
 (0)