Skip to content

Commit

Permalink
Use YAML CPP from system packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Jul 9, 2024
1 parent ae532a3 commit 1e9ecb9
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ RUN apt-get update \
binutils-for-host \
binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf \
binutils-powerpc64le-linux-gnu \
ca-certificates \
clang-16 \
git \
golang \
libcurl4 \
libprotobuf-dev \
libtool \
libyaml-cpp-dev \
libz-dev \
lld \
pkg-config \
Expand All @@ -31,7 +31,7 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 \
COPY --from=xx / /
ARG TARGETPLATFORM

RUN xx-apt install -y xx-cxx-essentials zlib1g-dev libcurl4-openssl-dev libc-ares-dev libre2-dev libssl-dev libc-dev libmsgpack-dev
RUN xx-apt install -y xx-cxx-essentials zlib1g-dev libcurl4-openssl-dev libc-ares-dev libre2-dev libssl-dev libc-dev libmsgpack-dev libyaml-cpp-dev


### Build base image for alpine
Expand All @@ -47,13 +47,12 @@ RUN apk add --no-cache \
libcurl \
lld \
protobuf-dev \
yaml-cpp-dev \
zlib-dev

COPY --from=xx / /
ARG TARGETPLATFORM

RUN xx-apk add --no-cache xx-cxx-essentials openssl-dev zlib-dev zlib libgcc curl-dev msgpack-cxx-dev
RUN xx-apk add --no-cache xx-cxx-essentials openssl-dev zlib-dev zlib libgcc curl-dev msgpack-cxx-dev yaml-cpp-dev


### Build image
Expand Down Expand Up @@ -140,25 +139,10 @@ RUN [ "$(xx-info vendor)" = "alpine" ] && export QEMU_LD_PREFIX=/$(xx-info); \
### Build Jaeger cpp-client
FROM opentracing-cpp AS jaeger-cpp-client
ARG JAEGER_CPP_VERSION=v0.9.0
ARG YAML_CPP_VERSION=yaml-cpp-0.7.0
ARG TARGETPLATFORM

# Building yaml-cpp manually because of a bug in jaeger-client-cpp that won't install it
RUN xx-info env && git clone --depth 1 -b $YAML_CPP_VERSION https://github.com/jbeder/yaml-cpp/ && \
cd yaml-cpp && mkdir .build && cd .build && \
cmake $(xx-clang --print-cmake-defines) \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DYAML_CPP_BUILD_TESTS=OFF \
-DYAML_CPP_BUILD_TOOLS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON .. \
&& make -j$(nproc) install \
&& xx-verify /usr/local/lib/libyaml-cpp.so

RUN git clone --depth 1 -b $JAEGER_CPP_VERSION https://github.com/jaegertracing/jaeger-client-cpp \
&& cd jaeger-client-cpp \
&& sed -i 's/hunter_add_package(yaml-cpp)/#hunter_add_package(yaml-cpp)/' CMakeLists.txt \
&& sed -i 's/yaml-cpp::yaml-cpp/yaml-cpp/' CMakeLists.txt \
# Hunter doesn't read CMake variables, so we need to set them manually
&& printf "%s\n" "" "set(CMAKE_C_COMPILER clang)" "set(CMAKE_CXX_COMPILER clang++)" \
"set(CMAKE_ASM_COMPILER clang)" "set(PKG_CONFIG_EXECUTABLE $(xx-clang --print-prog-name=pkg-config))" \
Expand Down

0 comments on commit 1e9ecb9

Please sign in to comment.