Open KiprasR opened 6 months ago
Just to be clear, if we compile without all the excess flags:
RUN g++ main.cpp example.pb.cc -o my_program -lprotobuf
on v3.19 we end up with the following error:
=> ERROR [builder 10/10] RUN g++ main.cpp example.pb.cc -o my_program -lprotobuf 42.3s
------
> [builder 10/10] RUN g++ main.cpp example.pb.cc -o my_program -lprotobuf:
42.28 /usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../aarch64-alpine-linux-musl/bin/ld: /tmp/cckdmgNg.o: undefined reference to symbol '_ZN4absl12lts_2023080212log_internal17MakeCheckOpStringIPKvS4_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc'
42.28 /usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../aarch64-alpine-linux-musl/bin/ld: /usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../lib/libabsl_log_internal_check_op.so.2308.0.0: error adding symbols: DSO missing from command line
42.29 collect2: error: ld returned 1 exit status
------
Dockerfile:23
--------------------
21 | # Build tester
22 | #RUN g++ -std=c++17 -Wall main.cpp example.pb.cc -o my_program -lprotobuf -ldl -Wno-psabi -O3 -static
23 | >>> RUN g++ main.cpp example.pb.cc -o my_program -lprotobuf
24 |
25 | # Use ARMv8 Alpine image
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c g++ main.cpp example.pb.cc -o my_program -lprotobuf" did not complete successfully: exit code: 1
The image builds just fine on 3.18.
Hello.
profobuf-dev fails to run properly on arm64v8/alpine:latest (i.e., 3.19 at the moment). The code works well with the previous version (3.18).
I'm adding a MWE that runs through the same build steps as my server program (which explains the excessive compiler flags).
Dockerfile:
Protocol buffer:
C++ main:
The image is built using
sudo docker buildx build --platform linux/arm64/v8 -t alpine-test . --load
As mentioned earlier, everything builds just fine with
arm64v8/alpine:3.18
Ifarm64v8/alpine:latest
is used, a library linkage error is generated:I'm getting the same
cannot find -lprotobuf: No such file or directory
error when building my server code as well.