dosubot[bot] commented on issue #7159: URL: https://github.com/apache/incubator-devlake/issues/7159#issuecomment-2168967502
<!-- Greeting --> Hey @Tonkonozhenko! I'm here to assist you with any bugs, questions, or contributions while waiting for a human maintainer. Let's squash this bug together! <!-- Answer --> To resolve the error related to `libz.a` and `-fPIC` when building the backend Docker image on a MacBook M1, you need to ensure that the `zlib1g-dev` package is installed and that the `-fPIC` flag is used when compiling the library. The provided Dockerfile already includes the installation of `zlib1g-dev`, but you may need to add the `-fPIC` flag explicitly. Here is the relevant part of the Dockerfile with the necessary changes: ```dockerfile RUN for arch in aarch64 x86_64 ; do \ mkdir -p /tmp/build/${arch} && cd /tmp/build/${arch} && \ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.3.2.tar.gz -O - | tar -xz && \ cd libgit2-1.3.2 && \ mkdir build && cd build && \ if [ "$arch" = "aarch64" ] ; then \ cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ -DBUILD_SHARED_LIBS=ON -DCMAKE_SYSROOT=/rootfs-arm64 \ -DCMAKE_INSTALL_PREFIX=/usr/local/deps/${arch} \ -DCMAKE_C_FLAGS="-fPIC" ; \ elif [ "$arch" = "x86_64" ] ; then \ cmake .. -DCMAKE_C_COMPILER=x86_64-linux-gnu-gcc \ -DBUILD_SHARED_LIBS=ON -DCMAKE_SYSROOT=/rootfs-amd64 \ -DCMAKE_INSTALL_PREFIX=/usr/local/deps/${arch} \ -DCMAKE_C_FLAGS="-fPIC" ; \ fi && \ make -j install ; \ done ``` This modification ensures that the `-fPIC` flag is used during the compilation of the `libgit2` library, which should resolve the error related to `libz.a` and `-fPIC` <sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/Dockerfile)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org