Skip to content

Commit dadd503

Browse files
committed
Set compilers in Conan, using buildx
1 parent eba08a9 commit dadd503

File tree

9 files changed

+64
-26
lines changed

9 files changed

+64
-26
lines changed

.github/workflows/debian.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
CONTAINER_REGISTRY: ghcr.io
11-
DOCKER_BUILDKIT: 1
1211
BUILDKIT_PROGRESS: plain
1312
CONAN_VERSION: 2.17.0
1413
NONROOT_USER: ci

.github/workflows/rhel.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
env:
1010
CONTAINER_REGISTRY: ghcr.io
1111
REDHAT_REGISTRY: registry.redhat.io
12-
DOCKER_BUILDKIT: 1
1312
BUILDKIT_PROGRESS: plain
1413
CONAN_VERSION: 2.17.0
1514
NONROOT_USER: ci

.github/workflows/ubuntu.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
CONTAINER_REGISTRY: ghcr.io
11-
DOCKER_BUILDKIT: 1
1211
BUILDKIT_PROGRESS: plain
1312
CONAN_VERSION: 2.17.0
1413
NONROOT_USER: ci

docker/debian/Dockerfile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ ENTRYPOINT ["/bin/bash"]
2020
# Ensure any packages installed directly or indirectly via dpkg do not require
2121
# manual interaction.
2222
ARG DEBIAN_FRONTEND=noninteractive
23-
RUN apt update && apt upgrade -y
2423
RUN <<EOF
2524
set -ex
2625
ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
26+
apt update
27+
apt upgrade -y
2728
apt install -y tzdata
2829
dpkg-reconfigure --frontend noninteractive tzdata
2930
EOF
@@ -45,7 +46,8 @@ pkgs+=(libc6-dev) # Required build tool.
4546
pkgs+=(ninja-build) # Required build tool.
4647
pkgs+=(pipx) # Package manager for Python applications.
4748
pkgs+=(wget) # Required build tool.
48-
apt update && apt install -y "${pkgs[@]}"
49+
apt update
50+
apt install -y "${pkgs[@]}"
4951
EOF
5052

5153
# Install Conan.
@@ -86,6 +88,8 @@ update-alternatives --install \
8688
update-alternatives --auto cc
8789
update-alternatives --auto gcc
8890
EOF
91+
ENV CC=/usr/bin/gcc
92+
ENV CXX=/usr/bin/g++
8993

9094
# Clean up unnecessary files to reduce image size.
9195
RUN rm -rf /var/lib/apt/lists/* && apt clean
@@ -98,6 +102,13 @@ WORKDIR /home/${NONROOT_USER}
98102
RUN conan profile detect
99103
# Fix the C++ dialect.
100104
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
105+
# Explicitly set the compiler flags.
106+
RUN <<EOF
107+
cat >>~/.conan2/profiles/default <<EOT
108+
[conf]
109+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
110+
EOT
111+
EOF
101112
# Print the Conan profile to verify the configuration.
102113
RUN conan profile show
103114

@@ -132,17 +143,21 @@ WORKDIR /home/${NONROOT_USER}
132143
RUN conan profile detect
133144
# Fix the C++ dialect.
134145
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
135-
# To ensure compatibility with a range of Clang compilers, we must add extra
136-
# flags that apply to certain versions of Clang.
137-
# TODO: Move this into the rippled repository as a custom Conan profile.
146+
# Explicitly set the compiler flags. To ensure compatibility with a range of
147+
# Clang compilers, we must also add extra flags that apply to certain versions
148+
# of Clang.
149+
# TODO: Move extra flags into the rippled repository as a custom Conan profile.
138150
RUN <<EOF
151+
cat >>~/.conan2/profiles/default <<EOT
152+
[conf]
153+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
154+
EOT
139155
if [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
140156
cat >>~/.conan2/profiles/default <<EOT
141157
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw', '-Wno-deprecated-declarations']
142158
EOT
143159
elif [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -eq 19 ]]; then
144160
cat >>~/.conan2/profiles/default <<EOT
145-
[conf]
146161
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
147162
EOT
148163
fi

docker/debian/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ GCC_VERSION=12
4343
CONAN_VERSION=2.17.0
4444
CONTAINER_IMAGE=xrplf/ci/debian-${DEBIAN_VERSION}:gcc-${GCC_VERSION}
4545

46-
DOCKER_BUILDKIT=1 docker build . \
46+
docker buildx build . \
4747
--target gcc \
4848
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
4949
--build-arg BUILDKIT_INLINE_CACHE=1 \
@@ -66,7 +66,7 @@ CLANG_VERSION=17
6666
CONAN_VERSION=2.17.0
6767
CONTAINER_IMAGE=xrplf/ci/debian-${DEBIAN_VERSION}:clang-${CLANG_VERSION}
6868

69-
DOCKER_BUILDKIT=1 docker build . \
69+
docker buildx build . \
7070
--target clang \
7171
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
7272
--build-arg BUILDKIT_INLINE_CACHE=1 \

docker/rhel/Dockerfile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ FROM base AS gcc
5151
# Install GCC.
5252
ARG GCC_VERSION
5353
RUN dnf install -y --setopt=tsflags=nodocs gcc-toolset-${GCC_VERSION}-gcc gcc-toolset-${GCC_VERSION}-gcc-c++
54+
ENV CC=/usr/bin/gcc
55+
ENV CXX=/usr/bin/g++
5456

5557
# Clean up unnecessary files to reduce image size.
5658
RUN dnf -y clean all
@@ -67,6 +69,13 @@ ENV CONAN_HOME=/home/${NONROOT_USER}/.conan2
6769
RUN conan profile detect
6870
# Fix the C++ dialect.
6971
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ${CONAN_HOME}/profiles/default
72+
# Explicitly set the compiler flags.
73+
RUN <<EOF
74+
cat >>${CONAN_HOME}/profiles/default <<EOT
75+
[conf]
76+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
77+
EOT
78+
EOF
7079
# Print the Conan profile to verify the configuration.
7180
RUN conan profile show
7281

@@ -94,17 +103,21 @@ ENV CONAN_HOME=/home/${NONROOT_USER}/.conan2
94103
RUN conan profile detect
95104
# Fix the C++ dialect.
96105
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ${CONAN_HOME}/profiles/default
97-
# To ensure compatibility with a range of Clang compilers, we must add extra
98-
# flags that apply to certain versions of Clang.
99-
# TODO: Move this into the rippled repository as a custom Conan profile.
106+
# Explicitly set the compiler flags. To ensure compatibility with a range of
107+
# Clang compilers, we must also add extra flags that apply to certain versions
108+
# of Clang.
109+
# TODO: Move extra flags into the rippled repository as a custom Conan profile.
100110
RUN <<EOF
111+
cat >>${CONAN_HOME}/profiles/default <<EOT
112+
[conf]
113+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
114+
EOT
101115
if [[ $(clang --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
102116
cat >>${CONAN_HOME}/profiles/default <<EOT
103117
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw', '-Wno-deprecated-declarations']
104118
EOT
105119
elif [[ $(clang --version | head -1 | grep -Po 'version \K[0-9]{2}') -eq 19 ]]; then
106120
cat >>${CONAN_HOME}/profiles/default <<EOT
107-
[conf]
108121
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
109122
EOT
110123
fi

docker/rhel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ GCC_VERSION=13
6262
CONAN_VERSION=2.17.0
6363
CONTAINER_IMAGE=xrplf/ci/rhel-${RHEL_VERSION}:gcc-${GCC_VERSION}
6464

65-
DOCKER_BUILDKIT=1 docker build . \
65+
docker buildx build . \
6666
--target gcc \
6767
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
6868
--build-arg BUILDKIT_INLINE_CACHE=1 \
@@ -84,7 +84,7 @@ RHEL_VERSION=9.6
8484
CONAN_VERSION=2.17.0
8585
CONTAINER_IMAGE=xrplf/ci/rhel-${RHEL_VERSION}:clang-${CLANG_VERSION}
8686

87-
DOCKER_BUILDKIT=1 docker build . \
87+
docker buildx build . \
8888
--target clang \
8989
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
9090
--build-arg BUILDKIT_INLINE_CACHE=1 \

docker/ubuntu/Dockerfile

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ ENTRYPOINT ["/bin/bash"]
99
# Ensure any packages installed directly or indirectly via dpkg do not require
1010
# manual interaction.
1111
ARG DEBIAN_FRONTEND=noninteractive
12-
RUN apt update && apt upgrade -y
1312
RUN <<EOF
1413
set -ex
1514
ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
15+
apt update
16+
apt upgrade -y
1617
apt install -y tzdata
1718
dpkg-reconfigure --frontend noninteractive tzdata
1819
EOF
@@ -34,7 +35,8 @@ pkgs+=(libc6-dev) # Required build tool.
3435
pkgs+=(ninja-build) # Required build tool.
3536
pkgs+=(pipx) # Package manager for Python applications.
3637
pkgs+=(wget) # Required build tool.
37-
apt update && apt install -y "${pkgs[@]}"
38+
apt update
39+
apt install -y "${pkgs[@]}"
3840
EOF
3941

4042
# Install Conan.
@@ -55,7 +57,7 @@ FROM base AS gcc
5557
ARG GCC_VERSION
5658
RUN apt install -y gcc-${GCC_VERSION} g++-${GCC_VERSION}
5759
ENV CC=/usr/bin/gcc-${GCC_VERSION}
58-
ENV CXX=/usr/bin/gcc-${GCC_VERSION}
60+
ENV CXX=/usr/bin/g++-${GCC_VERSION}
5961

6062
# Clean up unnecessary files to reduce image size.
6163
RUN rm -rf /var/lib/apt/lists/* && apt clean
@@ -68,6 +70,13 @@ WORKDIR /home/${NONROOT_USER}
6870
RUN conan profile detect
6971
# Fix the C++ dialect.
7072
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
73+
# Explicitly set the compiler flags.
74+
RUN <<EOF
75+
cat >>~/.conan2/profiles/default <<EOT
76+
[conf]
77+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
78+
EOT
79+
EOF
7180
# Print the Conan profile to verify the configuration.
7281
RUN conan profile show
7382

@@ -91,17 +100,21 @@ WORKDIR /home/${NONROOT_USER}
91100
RUN conan profile detect
92101
# Fix the C++ dialect.
93102
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
94-
# To ensure compatibility with a range of Clang compilers, we must add extra
95-
# flags that apply to certain versions of Clang.
96-
# TODO: Move this into the rippled repository as a custom Conan profile.
103+
# Explicitly set the compiler flags. To ensure compatibility with a range of
104+
# Clang compilers, we must also add extra flags that apply to certain versions
105+
# of Clang.
106+
# TODO: Move extra flags into the rippled repository as a custom Conan profile.
97107
RUN <<EOF
108+
cat >>~/.conan2/profiles/default <<EOT
109+
[conf]
110+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
111+
EOT
98112
if [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
99113
cat >>~/.conan2/profiles/default <<EOT
100114
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw', '-Wno-deprecated-declarations']
101115
EOT
102116
elif [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -eq 19 ]]; then
103117
cat >>~/.conan2/profiles/default <<EOT
104-
[conf]
105118
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
106119
EOT
107120
fi

docker/ubuntu/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ GCC_VERSION=14
4343
CONAN_VERSION=2.17.0
4444
CONTAINER_IMAGE=xrplf/ci/ubuntu-${UBUNTU_VERSION}:gcc-${GCC_VERSION}
4545

46-
DOCKER_BUILDKIT=1 docker build . \
46+
docker buildx build . \
4747
--target gcc \
4848
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
4949
--build-arg BUILDKIT_INLINE_CACHE=1 \
@@ -66,7 +66,7 @@ CLANG_VERSION=18
6666
CONAN_VERSION=2.17.0
6767
CONTAINER_IMAGE=xrplf/ci/ubuntu-${UBUNTU_VERSION}:clang-${CLANG_VERSION}
6868

69-
DOCKER_BUILDKIT=1 docker build . \
69+
docker buildx build . \
7070
--target clang \
7171
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
7272
--build-arg BUILDKIT_INLINE_CACHE=1 \

0 commit comments

Comments
 (0)