From b27a43de2ca354e67841ed10a031e41f1ecbf9a0 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Sat, 20 Aug 2022 11:17:08 +0200 Subject: [PATCH] Migrate to modern TBB version --- CMakeLists.txt | 2 +- docker/Dockerfile | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66d59c91e..6f093ddcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -488,7 +488,7 @@ if(ENABLE_CONAN) KEEP_RPATHS NO_OUTPUT_DIRS OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake - tbb:shared=${TBB_SHARED} + onetbb:shared=${TBB_SHARED} BUILD missing ) # explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141) diff --git a/docker/Dockerfile b/docker/Dockerfile index 210d5eb66..4f2e77838 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,13 +8,14 @@ RUN apt-get update && \ libzip-dev libboost1.74-all-dev lua5.2 liblua5.2-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ + ldconfig /usr/local/lib && \ git clone --branch v2021.3.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \ cd oneTBB && \ mkdir build && \ cd build && \ - cmake .. && \ - make -j${NPROC} && \ - make install + cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \ + cmake --build . && \ + cmake --install . COPY . /src WORKDIR /src @@ -38,18 +39,23 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ strip /usr/local/bin/* && \ rm -rf /src /usr/local/lib/libosrm* + # Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds # Only the content below ends up in the image, this helps remove /src from the image (which is large) FROM debian:bullseye-slim as runstage -RUN mkdir -p /src && mkdir -p /opt + +COPY --from=builder /usr/local /usr/local +COPY --from=builder /opt /opt + RUN apt-get update && \ apt-get install -y --no-install-recommends libboost-program-options1.74.0 libboost-regex1.74.0 \ libboost-date-time1.74.0 libboost-chrono1.74.0 libboost-filesystem1.74.0 \ libboost-iostreams1.74.0 libboost-system1.74.0 libboost-thread1.74.0 \ - expat liblua5.2-0 &&\ - rm -rf /var/lib/apt/lists/* -COPY --from=builder /usr/local /usr/local -COPY --from=builder /opt /opt + expat liblua5.2-0 && \ + rm -rf /var/lib/apt/lists/* && \ +# add /usr/local/lib to ldconfig to allow loading libraries from there + ldconfig /usr/local/lib + RUN /usr/local/bin/osrm-extract --help && \ /usr/local/bin/osrm-routed --help && \ /usr/local/bin/osrm-contract --help && \