Skip to content

Commit 8ab3d73

Browse files
switch to llvm-12 (from llvm-10) and to gcc-10 (from gcc-8)
this allows to build with stock toolchains on Ubuntu 22.04 and 20.04
1 parent b3a6bc2 commit 8ab3d73

File tree

8 files changed

+43
-43
lines changed

8 files changed

+43
-43
lines changed

.devcontainer/Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ RUN apt-get update \
6060
RUN apt-get -y install git build-essential pkg-config autoconf automake libtool bison flex libpq-dev parallel libunwind-dev curl
6161

6262
# Update compiler tools
63-
RUN apt-get -y install libstdc++-8-dev clang-format-10 ccache
63+
RUN apt-get -y install libstdc++-10-dev clang-format-12 ccache
6464

6565
# gcc
66-
RUN apt-get -y install cpp-8 gcc-8 g++-8
66+
RUN apt-get -y install cpp-10 gcc-10 g++-10
6767
# clang
68-
RUN apt-get -y install clang-10 llvm-10
68+
RUN apt-get -y install clang-12 llvm-12
6969
# rust
7070
RUN ./install-rust.sh
7171
ENV PATH "/root/.cargo/bin:$PATH"
7272

7373
# clang by default
74-
ENV CC=clang-10
75-
ENV CXX=clang++-10
74+
ENV CC=clang-12
75+
ENV CXX=clang++-12
7676

7777
# Install postgresql to enable tests under make check
7878
RUN apt-get -y install postgresql

.github/workflows/build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ jobs:
4646
sudo apt-get -y install --no-install-recommends apt-utils dialog git iproute2 procps lsb-release
4747
- name: install tool chain
4848
run: |
49-
sudo apt-get -y install libstdc++-8-dev clang-format-10 ccache
49+
sudo apt-get -y install libstdc++-10-dev clang-format-12 ccache
5050
if test "${{ matrix.toolchain }}" = "gcc" ; then
51-
sudo apt-get -y install cpp-8 gcc-8 g++-8
51+
sudo apt-get -y install cpp-10 gcc-10 g++-10
5252
else
53-
sudo apt-get -y install clang-10 llvm-10
53+
sudo apt-get -y install clang-12 llvm-12
5454
fi
5555
- name: install dependencies
5656
run: sudo apt-get -y install postgresql git build-essential pkg-config autoconf automake libtool bison flex libpq-dev parallel libunwind-dev

INSTALL-Windows.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ If you do not have cURL installed
9494
## clang-format
9595

9696
For making changes to the code, you should install the clang-format tool and Visual Studio extension, you can find both at http://llvm.org/builds/
97-
* note that the version of clang-format used currently is 10.0 (other versions may not format the same way).
98-
* we recommend downloading 10.0 from http://releases.llvm.org/download.html
97+
* note that the version of clang-format used currently is 12.0 (other versions may not format the same way).
98+
* we recommend downloading 12.0 from http://releases.llvm.org/download.html
9999

100100
# Build on Windows using the Windows Subsystem for Linux
101101
To setup the subsystem, go to https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

INSTALL.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,27 @@ To install Postgresql, follow instructions from the [Postgresql download page](h
5858
## Build Dependencies
5959

6060
- c++ toolchain and headers that supports c++17
61-
- `clang` >= 10.0
62-
- `g++` >= 8.0
61+
- `clang` >= 12.0
62+
- `g++` >= 10.0
6363
- `pkg-config`
6464
- `bison` and `flex`
6565
- `libpq-dev` unless you `./configure --disable-postgres` in the build step below.
6666
- 64-bit system
67-
- `clang-format-10` (for `make format` to work)
67+
- `clang-format-12` (for `make format` to work)
6868
- `perl`
6969
- `libunwind-dev`
7070

7171
### Ubuntu
7272

73-
#### Ubuntu 18.04
73+
#### Ubuntu 20.04
7474
You can install the [test toolchain](#adding-the-test-toolchain) to build and run stellar-core with the latest version of the llvm toolchain.
7575

7676
Alternatively, if you want to just depend on stock Ubuntu, you will have to build with clang *and* have use `libc++` instead of `libstdc++` when compiling.
7777

78-
Ubuntu 18.04 has clang-10 available, that you can install with
78+
Ubuntu 20.04 has clang-12 available, that you can install with
7979

80-
# install clang-10 toolchain
81-
sudo apt-get install clang-10
80+
# install clang-12 toolchain
81+
sudo apt-get install clang-12
8282

8383
After installing packages, head to [building with clang and libc++](#building-with-clang-and-libc).
8484

@@ -95,17 +95,17 @@ After installing packages, head to [building with clang and libc++](#building-wi
9595
# common packages
9696
sudo apt-get install git build-essential pkg-config autoconf automake libtool bison flex libpq-dev libunwind-dev parallel
9797
# if using clang
98-
sudo apt-get install clang-10
98+
sudo apt-get install clang-12
9999
# clang with libstdc++
100-
sudo apt-get install gcc-8
100+
sudo apt-get install gcc-10
101101
# if using g++ or building with libstdc++
102-
# sudo apt-get install gcc-8 g++-8 cpp-8
102+
# sudo apt-get install gcc-10 g++-10 cpp-10
103103

104104
In order to make changes, you'll need to install the proper version of clang-format.
105105

106106
In order to install the llvm (clang) toolchain, you may have to follow instructions on https://apt.llvm.org/
107107

108-
sudo apt-get install clang-format-10
108+
sudo apt-get install clang-format-12
109109

110110
### OS X
111111
When building on OSX, here's some dependencies you'll need:
@@ -130,7 +130,7 @@ See [INSTALL-Windows.md](INSTALL-Windows.md)
130130
- `git submodule init`
131131
- `git submodule update`
132132
- Type `./autogen.sh`.
133-
- Type `./configure` *(If configure complains about compiler versions, try `CXX=clang-10 ./configure` or `CXX=g++-8 ./configure` or similar, depending on your compiler.)*
133+
- Type `./configure` *(If configure complains about compiler versions, try `CXX=clang-12 ./configure` or `CXX=g++-10 ./configure` or similar, depending on your compiler.)*
134134
- Type `make` or `make -j<N>` (where `<N>` is the number of parallel builds, a number less than the number of CPU cores available, e.g. `make -j3`)
135135
- Type `make check` to run tests.
136136
- Type `make install` to install.
@@ -141,15 +141,15 @@ On some systems, building with `libc++`, [LLVM's version of the standard library
141141

142142
NB: there are newer versions available of both clang and libc++, you will have to use the versions suited for your system.
143143

144-
You may need to install additional packages for this, for example, on Linux Ubuntu 18.04 LTS with clang-10:
144+
You may need to install additional packages for this, for example, on Linux Ubuntu 20.04 LTS with clang-12:
145145

146146
# install libc++ headers
147-
sudo apt-get install libc++-10-dev libc++abi-10-dev
147+
sudo apt-get install libc++-12-dev libc++abi-12-dev
148148

149149
Here are sample steps to achieve this:
150150

151-
export CC=clang-10
152-
export CXX=clang++-10
151+
export CC=clang-12
152+
export CXX=clang++-12
153153
export CFLAGS="-O3 -g1 -fno-omit-frame-pointer"
154154
export CXXFLAGS="$CFLAGS -stdlib=libc++"
155155
git clone https://github.com/stellar/stellar-core.git

ci-build.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ hash -r
8989

9090
if test $CXX = 'clang++'; then
9191
RUN_PARTITIONS=$(seq 0 $((NPROCS-1)))
92-
which clang-10
93-
ln -s `which clang-10` bin/clang
94-
which clang++-10
95-
ln -s `which clang++-10` bin/clang++
96-
which llvm-symbolizer-10
97-
ln -s `which llvm-symbolizer-10` bin/llvm-symbolizer
92+
which clang-12
93+
ln -s `which clang-12` bin/clang
94+
which clang++-12
95+
ln -s `which clang++-12` bin/clang++
96+
which llvm-symbolizer-12
97+
ln -s `which llvm-symbolizer-12` bin/llvm-symbolizer
9898
clang -v
9999
llvm-symbolizer --version || true
100100
elif test $CXX = 'g++'; then
101101
RUN_PARTITIONS=$(seq $NPROCS $((2*NPROCS-1)))
102-
which gcc-8
103-
ln -s `which gcc-8` bin/gcc
104-
which g++-8
105-
ln -s `which g++-8` bin/g++
102+
which gcc-10
103+
ln -s `which gcc-10` bin/gcc
104+
which g++-10
105+
ln -s `which g++-10` bin/g++
106106
which g++
107107
g++ -v
108108
fi

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ if test "$FS_WORKS" = "no"; then
250250
fi
251251

252252
# prefer 10 as it's the one we use
253-
AC_CHECK_PROGS(CLANG_FORMAT, [clang-format-10 clang-format])
253+
AC_CHECK_PROGS(CLANG_FORMAT, [clang-format-12 clang-format])
254254
AM_CONDITIONAL([USE_CLANG_FORMAT], [test "x$CLANG_FORMAT" != "x"])
255255

256256
AX_VALGRIND_CHECK

docker/Dockerfile.testing

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ RUN apt-get update && \
55
apt-get -y install iproute2 procps lsb-release \
66
git build-essential pkg-config autoconf automake libtool \
77
bison flex libpq-dev parallel libunwind-dev \
8-
clang-10 libc++abi-10-dev libc++-10-dev \
8+
clang-12 libc++abi-12-dev libc++-12-dev \
99
postgresql curl
1010

1111
COPY . stellar-core/
1212
WORKDIR stellar-core
1313
RUN git clean -dXf
1414
RUN git submodule foreach --recursive git clean -dXf
1515

16-
ARG CC=clang-10
17-
ARG CXX=clang++-10
16+
ARG CC=clang-12
17+
ARG CXX=clang++-12
1818
ARG CFLAGS='-O3 -g1 -fno-omit-frame-pointer'
1919
ARG CXXFLAGS='-O3 -g1 -fno-omit-frame-pointer -stdlib=libc++'
2020
ARG CONFIGURE_FLAGS='--enable-tracy --enable-sdfprefs --enable-next-protocol-version-unsafe-for-production'
@@ -30,7 +30,7 @@ RUN make install
3030
FROM ubuntu:focal
3131
ENV DEBIAN_FRONTEND=noninteractive
3232
RUN apt-get update && \
33-
apt-get -y install libunwind8 postgresql curl sqlite iproute2 libc++abi1-10 libc++1-10
33+
apt-get -y install libunwind8 postgresql curl sqlite iproute2 libc++abi1-12 libc++1-12
3434

3535
COPY --from=buildstage /usr/local/bin/stellar-core /usr/local/bin/stellar-core
3636
EXPOSE 11625

docs/fuzzing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ improvements described above).
6363

6464
note: you may have to provide a default clang/clang++, this can be done in many ways.
6565

66-
For example, this makes clang-10 the default:
66+
For example, this makes clang-12 the default:
6767

6868
```
69-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 81 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-10 --slave /usr/share/man/man1/clang.1.gz clang.1.gz /usr/share/man/man1/clang-10.1.gz --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-10 --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-10 --slave /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-10
69+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 81 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-12 --slave /usr/share/man/man1/clang.1.gz clang.1.gz /usr/share/man/man1/clang-12.1.gz --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-12 --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-12 --slave /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-12
7070
```
7171

7272
## Building an instrumented stellar-core

0 commit comments

Comments
 (0)