Update gdb to 15.1 (by compiling from sources)

Right now there are couple of gdb bugs that makes CI unstable:
- https://sourceware.org/bugzilla/show_bug.cgi?id=29185
- https://bugzilla.redhat.com/show_bug.cgi?id=1492496

But ubuntu 22.04 does not have 14+ anywhere, the
~ubuntu-toolchain-r/test contains only gdb 13, so there is no other
options except for compiling it from sources.

But there also other reasons to update it - optimizations, looks like
older gdb versions does not use index fully - 5.6sec vs 56sec:

    # 15.1
    $ time command gdb -batch -ex 'disas main' clickhouse
    ...
    real    0m5.692s
    user    0m29.948s
    sys     0m1.190s

    # 12.1 (from ubuntu 22.04)
    real    0m56.709s
    user    0m59.307s
    sys     0m0.585s

Also note, that we cannot compile gdb in the fasttest (that contains
compiler) since some images does not includes full toolchain, for
instance gdb is added in the following images:
- test-util -> test-base -> lots of other images (no toolchain)
- performance-comparison (no toolchain)
- integration-test (no toolchain)
- integration-tests-runner (no toolchain)

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2024-07-14 15:30:38 +02:00
parent 77fd21555f
commit 99b18d31db
3 changed files with 39 additions and 0 deletions

View File

@ -7,6 +7,10 @@
"name": "clickhouse/cctools",
"dependent": []
},
"docker/packager/gdb": {
"name": "clickhouse/gdb",
"dependent": []
},
"docker/test/compatibility/centos": {
"name": "clickhouse/test-old-centos",
"dependent": []

View File

@ -6,6 +6,11 @@ ENV CXX=clang++-${LLVM_VERSION}
# If the cctools is updated, then first build it in the CI, then update here in a different commit
COPY --from=clickhouse/cctools:d9e3596e706b /cctools /cctools
# TODO: same for gdb and in other places as well
#
# NOTE: here it will add circular dependency but it will be fixed after [1]
#
# [1]: https://github.com/ClickHouse/ClickHouse/issues/66493
# Rust toolchain and libraries
ENV RUSTUP_HOME=/rust/rustup

View File

@ -0,0 +1,30 @@
# docker build -t clickhouse/gdb .
ARG FROM_TAG=latest
FROM clickhouse/fasttest:$FROM_TAG
ENV CC=clang-${LLVM_VERSION}
ENV CXX=clang++-${LLVM_VERSION}
# ld from binutils is 2.38, which has the following error:
#
# DWARF error: invalid or unhandled FORM value: 0x23
#
ENV LD=ld.lld-${LLVM_VERSION}
ARG GDB_VERSION=15.1
# gdb dependencies
RUN apt-get update \
&& apt-get install --yes \
libgmp-dev \
libmpfr-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
RUN wget https://sourceware.org/pub/gdb/releases/gdb-$GDB_VERSION.tar.gz \
&& tar -xvf gdb-$GDB_VERSION.tar.gz \
&& cd gdb-$GDB_VERSION \
&& ./configure --prefix=/usr \
&& make -j $(nproc) \
&& make install \
&& rm -fr gdb-$GDB_VERSION gdb-$GDB_VERSION.tar.gz