Skip to content

Commit

Permalink
reverted serd version bump and corrected linking in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
bigerl authored Feb 1, 2021
1 parent 9d7bb32 commit 3d17057
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
33 changes: 18 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3d17057

Please sign in to comment.