From 3d170573b2d09a8847d1b02d03620ec2f3649407 Mon Sep 17 00:00:00 2001 From: Alexander Bigerl Date: Mon, 1 Feb 2021 12:59:11 +0100 Subject: [PATCH] reverted serd version bump and corrected linking in Dockerfile --- CMakeLists.txt | 15 ++++++++++++++- Dockerfile | 33 ++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 947bbd79..19c94b82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,21 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") else () set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer") endif () + +if (TENTRIS_STATIC) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) +endif () + if (TENTRIS_BUILD_WITH_TCMALLOC) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Ltcmalloc-minimal") + find_library(TCMALLOCMINIMAL tcmalloc_minimal) + if (NOT TCMALLOCMINIMAL) + find_library(TCMALLOCMINIMAL tcmalloc-minimal) + endif() + if (NOT TCMALLOCMINIMAL) + message(FATAL_ERROR "Neither tcmalloc-minimal nor tcmalloc_minimal was found") + endif() + message("tcmalloc minimal ${TCMALLOCMINIMAL}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TCMALLOCMINIMAL}") if(TENTRIS_STATIC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--eh-frame-hdr") endif() diff --git a/Dockerfile b/Dockerfile index 1448ab5a..74b56b29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,31 @@ FROM ubuntu:groovy AS builder ARG DEBIAN_FRONTEND=noninteractive -ARG CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld-11" ARG TENTRIS_MARCH="x86-64" RUN apt-get -qq update && \ - apt-get -qq install -y make cmake uuid-dev git openjdk-11-jdk python3-pip python3-setuptools python3-wheel libstdc++-10-dev clang-11 g++-10 pkg-config - + apt-get -qq install -y make cmake uuid-dev git openjdk-11-jdk python3-pip python3-setuptools python3-wheel libstdc++-10-dev clang-11 g++-10 pkg-config lld autoconf libtool +RUN rm /usr/bin/ld && ln -s /usr/bin/lld-11 /usr/bin/ld ARG CXX="clang++-11" ARG CC="clang-11" ENV CXXFLAGS="${CXXFLAGS} -march=${TENTRIS_MARCH}" +ENV CMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib" # Compile more recent tcmalloc-minimal with clang-11 + -march RUN git clone --quiet --branch gperftools-2.8.1 https://github.com/gperftools/gperftools -WORKDIR /gperftools/build -RUN cmake \ - -Dgperftools_build_minimal=ON \ - -DGPERFTOOLS_BUILD_DEBUGALLOC=OFF \ - -Dgperftools_build_benchmark=OFF \ - -Dgperftools_enable_libunwind=ON \ - -gperftools_dynamic_sized_delete_support=ON \ - -gperftools_sized_delete=ON \ - .. && \ +WORKDIR /gperftools +RUN ./autogen.sh +RUN export LDFLAGS="${CMAKE_EXE_LINKER_FLAGS}" && ./configure \ + --enable-minimal \ + --disable-debugalloc \ + --enable-sized-delete \ + --enable-dynamic-sized-delete-support && \ make -j && \ make install WORKDIR / # we need serd as static library. Not available from ubuntu repos RUN ln -s /usr/bin/python3 /usr/bin/python -RUN git clone --quiet --branch v0.30.8 https://gitlab.com/drobilla/serd.git +RUN git clone --quiet --branch v0.30.2 https://gitlab.com/drobilla/serd.git WORKDIR serd RUN git submodule update --quiet --init --recursive && \ ./waf configure --static && \ @@ -67,9 +65,14 @@ COPY conanfile.txt conanfile.txt ##build WORKDIR /tentris/build RUN conan install .. --build=missing -RUN cmake -DCMAKE_BUILD_TYPE=Release -DTENTRIS_BUILD_WITH_TCMALLOC=true -DTENTRIS_STATIC=true .. +# todo: should be replaced with toolchain file like https://github.com/ruslo/polly/blob/master/clang-libcxx17-static.cmake +RUN cmake \ + -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DTENTRIS_BUILD_WITH_TCMALLOC=true \ + -DTENTRIS_STATIC=true \ + .. RUN make -j $(nproc) - FROM scratch COPY --from=builder /tentris/build/tentris_server /tentris_server COPY --from=builder /tentris/build/tentris_terminal /tentris_terminal