Skip to content

Commit cfc3182

Browse files
committed
Add build container for thread sanitizer builds.
1 parent 272d51b commit cfc3182

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

build/Dockerfile.tsan

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
FROM ubuntu:20.04
2+
3+
LABEL org.opencontainers.image.source https://github.com/su2code/Docker-Builds
4+
5+
ENV LANG C.UTF-8
6+
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime
7+
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \
8+
apt-utils \
9+
python3 \
10+
pkg-config \
11+
python3-pip \
12+
git \
13+
build-essential \
14+
cmake \
15+
python3-numpy \
16+
python3-scipy \
17+
python3-mpi4py \
18+
swig \
19+
libopenmpi-dev \
20+
libopenblas-dev \
21+
openmpi-bin \
22+
ccache \
23+
petsc-dev \
24+
python3-petsc4py \
25+
python3-rtree \
26+
curl \
27+
flex \
28+
gcc-multilib \
29+
g++-multilib \
30+
&& rm -rf /var/lib/apt/lists/* \
31+
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10
32+
33+
# Build a gcc suitable for thread sanitizer analysis
34+
RUN cd / \
35+
&& git clone git://gcc.gnu.org/git/gcc.git gcc_sources \
36+
&& cd gcc_sources \
37+
&& git checkout releases/gcc-9.4.0 \
38+
&& ./contrib/download_prerequisites \
39+
&& cd / \
40+
&& mkdir gcc_objdir \
41+
&& cd gcc_objdir \
42+
&& /gcc_sources/configure --prefix=/gcc_install --enable-languages=c,c++ --disable-linux-futex \
43+
&& make \
44+
&& make install \
45+
&& cd / \
46+
&& rm -rf gcc_sources \
47+
&& rm -rf gcc_objdir \
48+
&& cd /gcc_install \
49+
&& ln -s gcc cc
50+
51+
# Ensure that ccache uses the built gcc
52+
RUN export PATH=/gcc_install/bin:$PATH \
53+
&& /usr/sbin/update-ccache-symlinks
54+
55+
# Configure environment for the built gcc, also enable thread sanitizer
56+
ENV LD_LIBRARY_PATH=/gcc_install/lib64:$LD_LIBRARY_PATH
57+
ENV CXXFLAGS="-I/gcc_install/include/c++/9.4.0 -I/gcc_install/include/c++/9.4.0/x86_64-pc-linux-gnu -fsanitize=thread"
58+
ENV CFLAGS="-I/gcc_install/include/c++/9.4.0 -I/gcc_install/include/c++/9.4.0/x86_64-pc-linux-gnu -fsanitize=thread"
59+
ENV LDFLAGS="-L/gcc_install/lib64 -fsanitize=thread"
60+
ENV PATH=/usr/lib/ccache:/gcc_install/bin:$PATH
61+
ENV TSAN_OPTIONS="history_size=7 halt_on_error=1"
62+
63+
# Copies your code file from your action repository to the filesystem path `/` of the container
64+
COPY compileSU2.sh /compileSU2.sh
65+
66+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
67+
ENTRYPOINT ["/compileSU2.sh"]

0 commit comments

Comments
 (0)