-
|
Hello! I am trying to cross-compile program which require several dependencies, one of them being ZLIB isn't found for some reason for the target arch. Here is my Dockerfile: # syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM alpine:3.19 AS dev
COPY --from=xx / /
ARG TARGETPLATFORM
RUN apk add --no-cache build-base git cmake clang lld llvm ninja ca-certificates
RUN xx-info env
RUN xx-apk setup
RUN xx-apk add --no-cache build-base curl-dev zlib-dev
RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp && \
cd prometheus-cpp && \
cmake $(xx-clang --print-cmake-defines) -B build \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTING=0 \
-GNinja && \
cmake --build build && \
cmake --install build && \
ls -la /usr/local/lib && \
xx-verify /usr/local/lib/libprometheus-cpp-*The prometheus-cpp library require ZLIB by default, but for some reason it doesn't find the library when cross compiling to arm. It builds if I add Any help welcome ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
So I know this is old, but just in case you haven't figured it out, I'm pretty sure you have to specify the target-arch ZLib path and lib in cmake. I had to do something similar when building Something like: You'll probably have to do that with any other dependency libraries as well. An alternative might be to add your target-arch lib and include paths to your |
Beta Was this translation helpful? Give feedback.
So I know this is old, but just in case you haven't figured it out, I'm pretty sure you have to specify the target-arch ZLib path and lib in cmake. I had to do something similar when building
protobuffrom source.Something like:
You'll probably have to do that with any other dependency libraries as well. An alternative might be to add your target-arch lib and include paths to your
LDFLAGSandCFLAGS/CXXFLAGSvariables. I'm not sure ifxxdoes this by default.