-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
206 lines (187 loc) · 6.8 KB
/
Dockerfile
File metadata and controls
206 lines (187 loc) · 6.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#
# https://github.com/devcontainers/images/tree/main/src/base-debian/README.md
#
ARG VARIANT=trixie
FROM mcr.microsoft.com/devcontainers/base:${VARIANT}
#
# Debian: update, git, some packages needed for boost
#
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && \
apt-get -y upgrade && \
apt-get -y install git bzip2 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#
# Latest LLVM (beyond version 7 already installed using apt-get)
#
# https://pspdfkit.com/blog/2020/visual-studio-code-cpp-docker/
#
ARG VARIANT
ARG LLVM_VERSION=22
ARG LLVM_GPG_FINGERPRINT=6084F3CF814B57C1CF12EFD515CF4D18AF4F7421
RUN wget -q -O - https://apt.llvm.org/llvm-snapshot.gpg.key | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg && \
echo "deb http://apt.llvm.org/${VARIANT}/ llvm-toolchain-${VARIANT}-${LLVM_VERSION} main" \
>> /etc/apt/sources.list.d/llvm-snapshot.list && \
sed -i 's/^\(sha1.second_preimage_resistance\).*=.*/\1 = 2026-12-31/' \
/usr/share/apt/default-sequoia.config && \
apt-get update && \
apt-get -y install --no-install-recommends \
llvm-${LLVM_VERSION} \
clang-${LLVM_VERSION} \
lldb-${LLVM_VERSION} \
libc++-${LLVM_VERSION}-dev \
libc++abi-${LLVM_VERSION}-dev \
clang-format-${LLVM_VERSION} \
clang-tidy-${LLVM_VERSION} \
clangd-${LLVM_VERSION} \
lldb-${LLVM_VERSION} \
libunwind-${LLVM_VERSION}-dev \
libclang-rt-${LLVM_VERSION}-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ADD llvm-alternatives.sh .
ARG LLVM_VERSION
RUN bash -c "./llvm-alternatives.sh ${LLVM_VERSION}"
#
# other development libraries and network utilities
#
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && \
apt-get -y install --no-install-recommends \
ninja-build gdb \
libxml2-dev libcunit1-dev libev-dev libssl-dev libc-ares-dev libevent-dev liburing-dev \
libpcap-dev socat netcat-openbsd tcpdump tcpflow \
make binutils autoconf automake autotools-dev libtool pkg-config \
zlib1g-dev libjansson-dev libjemalloc-dev libsystemd-dev bison libelf-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#
# TEST: add libstdc++-15-dev from testing
#
# RUN echo >>/etc/apt/sources.list "deb http://deb.debian.org/debian forky main" && \
# apt-get update && export DEBIAN_FRONTEND=noninteractive && \
# apt-get -y remove gcc-12 libstdc++-12-dev && \
# apt-get -y install g++-15 libstdc++-15-dev && \
# apt-get -y autoremove && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/*
# RUN apt-get -y remove gcc-12 libstdc++-12-dev
#
# build recent boost with clang
#
# b2 toolset=clang cxxflags="-std=c++23 -stdlib=libc++" linkflags="-stdlib=libc++"
#
# https://stackoverflow.com/questions/8486077/how-to-compile-link-boost-with-clang-libc
#
ARG BV=1.90.0
RUN wget https://github.com/boostorg/boost/releases/download/boost-${BV}/boost-${BV}-b2-nodocs.tar.xz && \
tar xJf boost-${BV}-b2-nodocs.tar.xz && \
rm boost-${BV}-b2-nodocs.tar.xz && \
cd boost-${BV}* && \
./bootstrap.sh --with-toolset=clang && \
./b2 toolset=clang cxxflags="-std=c++23 -stdlib=libc++" linkflags="-stdlib=libc++" -j 20 \
--with-system --with-thread --with-date_time --with-regex --with-serialization \
--with-filesystem --with-coroutine --with-url --with-cobalt --with-program_options \
--with-process \
install && \
cd .. && \
rm -rf boost-${BV}*
#
# recent CMake
#
ARG CMAKE_VERSION=3.31.7
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh -q -O /tmp/cmake-install.sh && \
chmod u+x /tmp/cmake-install.sh && \
mkdir /opt/cmake-${CMAKE_VERSION} && \
/tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VERSION} && \
rm /tmp/cmake-install.sh && \
ln -s /opt/cmake-${CMAKE_VERSION}/bin/* /usr/local/bin
ENV CC="/usr/bin/clang-${LLVM_VERSION}" \
CXX="/usr/bin/clang++-${LLVM_VERSION}" \
COV="/usr/bin/llvm-cov-${LLVM_VERSION}" \
LLDB="/usr/bin/lldb-${LLVM_VERSION}"
#
# libc++, needed for cppcoro
# be aware of https://stackoverflow.com/questions/56738708/c-stdbad-alloc-on-stdfilesystempath-append
#
ENV CXXFLAGS="-stdlib=libc++"
# ENV CXXFLAGS="-stdlib=libc++ -fsanitize=thread -fno-omit-frame-pointer"
# ENV LDFLAGS="-stdlib=libc++"
# ENV LDFLAGS="--fsanitize=thread"
# -------------------------------------------------------------------------------------------------
#
# fmt
#
# FIXME: With LLVM, there are warnings about specializing in namespace std.
# Added -DFMT_TEST=no to skip building the tests.
#
# FIXME: Drop support for this and use std::format instead.
#
# ARG FMT_VERSION=11.1.4
# ARG FMT_VERSION=10.2.1
ARG FMT_VERSION=12.1.0
RUN wget https://github.com/fmtlib/fmt/releases/download/${FMT_VERSION}/fmt-${FMT_VERSION}.zip && \
unzip fmt-${FMT_VERSION}.zip && \
cd fmt-${FMT_VERSION} && \
mkdir build && \
cd build && \
cmake -DFMT_TEST=no .. && \
make -j 20 install && \
cd ../.. && rm -rf fmt-${FMT_VERSION}.zip fmt-${FMT_VERSION}
#
# fmtlog
#
# ARG FMTLOG_VERSION=2.2.1
# RUN git clone https://github.com/MengRao/fmtlog.git && \
# cd fmtlog && \
# git submodule init && \
# git submodule update && \
# ./build.sh && \
# cp fmtlog.h /usr/include && \
# cp .build/libfmtlog-* /usr/lib && \
# cd .. && rm -rf fmtlog
#
# cppcoro
#
# RUN git clone https://github.com/andreasbuhr/cppcoro && \
# cd cppcoro && \
# mkdir build && \
# cd build && \
# cmake -GNinja .. && \
# ninja install && \
# cd ../.. && rm -rf cppcoro
#
# range-v3
#
RUN git clone https://github.com/ericniebler/range-v3.git && \
cp -ar range-v3/include /usr/local/include/range-v3 && \
rm -rf range-v3
#
# googletest
#
RUN git clone https://github.com/google/googletest.git && \
cd googletest && \
mkdir build && \
cd build && \
cmake .. && \
make install && \
rm -rf googletest
#
# gtest-parallel
#
RUN cd /opt && \
git clone https://github.com/google/gtest-parallel.git && \
cd /usr/local/bin && \
ln -s /opt/gtest-parallel/gtest-parallel
# -------------------------------------------------------------------------------------------------
#
# GDB pretty printers for libc++
#
ARG USERNAME=vscode
RUN GDB=/usr/local/lib/gdb && \
mkdir -p $GDB && cd $GDB && \
wget https://raw.githubusercontent.com/llvm/llvm-project/9a30ada53d5ef8d651c75795af2f6e9c48a1eecb/libcxx/utils/gdb/libcxx/printers.py && \
cd /home/${USERNAME} && \
echo >>.gdbinit "python\nimport sys\nsys.path.insert(0, '$GDB')\nfrom printers import register_libcxx_printer_loader\nregister_libcxx_printer_loader()\nend" && \
chown ${USERNAME} .gdbinit
# -------------------------------------------------------------------------------------------------