Action: Compile CH version 21.11.4.14 in Ubuntu 22.04 using clang-15
Because for this package for this version was compiled using Ubuntu 20.04 using clang-13 (that one was the best option when this version was released)
Dockerfile:
FROM ubuntu:22.04
#
ARG DEBIAN_FRONTEND=noninteractive
ARG TERM=linux
#
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& mkdir -p /etc/apt/sources.list.d
#
RUN apt update \
&& apt-get install -y --no-install-recommends \
locales \
apt-utils
#
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8
#
RUN apt-get install -y --no-install-recommends \
software-properties-common \
apt-transport-https \
ca-certificates
#
RUN apt-get install -y --no-install-recommends \
cmake \
ccache \
ninja-build \
vim \
wget \
lsb-release \
gpg \
gpg-agent \
git \
&& rm -rf \
/var/lib/apt/lists/* \
/var/cache/debconf \
/tmp/* \
&& apt-get clean
#
WORKDIR /tmp
RUN wget
https://apt.llvm.org/llvm.sh RUN chmod +x /tmp/llvm.sh
RUN /tmp/llvm.sh 15
RUN rm -f /tmp/llvm.sh
#
RUN mkdir -p /external
WORKDIR /external
RUN git clone \
--recursive \
--branch v21.11.4.14-stable \
--single-branch \
https://github.com/ClickHouse/ClickHouse.git#
RUN mkdir -p /external/ClickHouse/build
WORKDIR /external/ClickHouse/build
RUN cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=/usr/bin/clang-15 \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 \
-DENABLE_CCACHE=OFF \
-DENABLE_TESTS=ON
RUN ninja -j 32
Resulted: The compilation breaks with error when try to compile some library from curl.
Looks like the compiler is pointing to some include files added by CH on the contrib folder, but the binary libraries to support those include are missing or are point to the new library version in my environment that does not fit correctly.
This is the error:
[6335/9990] Building C object contrib/curl-cmake/CMakeFiles/curl.dir/__/curl/lib/select.c.o
4369FAILED: contrib/curl-cmake/CMakeFiles/curl.dir/__/curl/lib/select.c.o
4370/usr/bin/clang-15 -DBUILDING_LIBCURL -DCURL_HIDDEN_SYMBOLS -DHAS_RESERVED_IDENTIFIER -DHAVE_CONFIG_H -DOS=\"Linux\" -DSTD_EXCEPTION_HAS_STACK_TRACE=1 -DZ_TLS=__thread -Dlibcurl_EXPORTS -I/external/ClickHouse/contrib/sentry-native/include -I/external/ClickHouse/contrib/curl/include -I/external/ClickHouse/contrib/curl/lib -I/external/ClickHouse/contrib/curl-cmake/. -I/external/ClickHouse/base/glibc-compatibility/memcpy -isystem /external/ClickHouse/contrib/libcxx/include -isystem /external/ClickHouse/contrib/libcxxabi/include -isystem /external/ClickHouse/contrib/libunwind/include -isystem /external/ClickHouse/contrib/boringssl/include -isystem /external/ClickHouse/contrib/libc-headers/x86_64-linux-gnu -isystem /external/ClickHouse/contrib/libc-headers -fdiagnostics-color=always -Xclang -fuse-ctor-homing -include /external/ClickHouse/base/glibc-compatibility/glibc-compat-2.32.h -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -falign-functions=32 -Wall -Wno-unused-command-line-argument -fdiagnostics-absolute-paths -fexperimental-new-pass-manager -Werror -w -O2 -g -DNDEBUG -O3 -fno-pie -D OS_LINUX -g0 -std=gnu11 -MD -MT contrib/curl-cmake/CMakeFiles/curl.dir/__/curl/lib/select.c.o -MF contrib/curl-cmake/CMakeFiles/curl.dir/__/curl/lib/select.c.o.d -o contrib/curl-cmake/CMakeFiles/curl.dir/__/curl/lib/select.c.o -c /external/ClickHouse/contrib/curl/lib/select.c
4371/external/ClickHouse/contrib/curl/lib/select.c:102:9: error: call to undeclared function 'poll'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
4372 r = poll(NULL, 0, pending_ms);
4374/external/ClickHouse/contrib/curl/lib/select.c:217:9: error: call to undeclared function 'poll'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
4375 r = poll(pfd, num, pending_ms);
4377/external/ClickHouse/contrib/curl/lib/select.c:439:9: error: call to undeclared function 'poll'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
4378 r = poll(ufds, nfds, pending_ms);
...
4412ninja: build stopped: subcommand failed.
4413Error: error building at STEP "RUN ninja -j 32: error while running runtime: exit status 1