Skip to content

Commit

Permalink
Ensure at least glibc 2.28
Browse files Browse the repository at this point in the history
  • Loading branch information
rollbear committed Jul 10, 2024
1 parent 28c4f9d commit 1b9a0d9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
12 changes: 9 additions & 3 deletions clang/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ COPY test/test.cpp ./

RUN touch /etc/dockerinit

ARG LIBCXX
ARG BUILD_LIBCXX
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
binutils-dev \
ca-certificates \
gdb \
git \
${LIBCXX} \
libcurl4-openssl-dev \
libdw-dev \
libiberty-dev \
Expand All @@ -28,6 +25,15 @@ RUN apt-get update -qq && \
xz-utils \
zlib1g-dev \
wget

COPY common/install-glibc.sh .
RUN stat ./install-glibc.sh
RUN ./install-glibc.sh
RUN rm install-glibc.sh

ARG LIBCXX
RUN [ -z "${LIBCXX}" ] || apt-get install -y --no-install-recommends ${LIBCXX}

RUN apt-get install -y --no-install-recommends gpg gpg-agent || true

COPY clang/install-clang.sh ./
Expand Down
1 change: 0 additions & 1 deletion clang/install-libcxx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ if [[ $VERSION == "3."* ]]; then
cp -r llvm-build/lib/* /usr/lib/x86_64-linux-gnu
cp -r ${SOURCE}/projects/libcxx/include/* /usr/lib/llvm-$1/include/c++/v1
else
ln -s /usr/include/locale.h /usr/include/xlocale.h
cmake -DCMAKE_C_COMPILER=clang-$1 -DCMAKE_CXX_COMPILER=clang++-$1 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
Expand Down
26 changes: 26 additions & 0 deletions common/install-glibc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -eou pipefail

export CURRENT_VERSION="$(ldd --version | head -n 1 | sed 's/^.* \([0-9].*\)$/\1/')"
MIN_VERSION=2.28

function greater_version() {
echo -e "$1\n$2" | sort -Vr | head -n 1
}
if [ "$(greater_version $MIN_VERSION $CURRENT_VERSION)" == "${CURRENT_VERSION}" ]
then
exit 0
fi
apt install -y --no-install-recommends gawk bison texinfo gcc
git clone -b glibc-${MIN_VERSION} --depth=1 git://sourceware.org/git/glibc
mkdir glibc/build
pushd glibc/build
../configure --disable-sanity-checks
make
make install
popd
rm /usr/include/xlocale.h
ln -s /usr/include/locale.h /usr/include/xlocale.h
apt remove -y gawk bison texinfo gcc
apt autoremove -y
rm -rf glibc
10 changes: 8 additions & 2 deletions gcc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,31 @@ COPY test/test.cpp ./

RUN touch /etc/dockerinit

ARG GCC_VERSION
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
binutils-dev \
ca-certificates \
g++-${GCC_VERSION} \
gdb \
git \
libcurl4-openssl-dev \
libdw-dev \
libiberty-dev \
libssl-dev \
make \
ninja-build \
parallel \
python3 \
valgrind \
xz-utils \
zlib1g-dev \
wget

COPY common/install-glibc.sh .
RUN ./install-glibc.sh; rm install-glibc.sh

ARG GCC_VERSION
RUN apt-get install -y --no-install-recommends g++-${GCC_VERSION}

RUN apt-get install -y --no-install-recommends gpg gpg-agent || true

ARG GCC_VERSION
Expand Down

0 comments on commit 1b9a0d9

Please sign in to comment.