gen2brain / go-fitz

Golang wrapper for the MuPDF Fitz library
GNU Affero General Public License v3.0
429 stars 97 forks source link

Getting error compiling an statically linked binary using Zig #114

Closed danvergara closed 2 months ago

danvergara commented 2 months ago

I was trying to compile a static linked binary to distribute a tool easily, but I ran into an issue trying to compile this library. I'm using Zig to compile the binary and leverage its build system.

The command I ran:

CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC="zig cc -target x86_64-linux-musl" CXX="zig c++ -target x86_64-linux-musl" go build -o amd64-build

The output (truncated):

ld.lld: error: undefined symbol: __fprintf_chk
>>> referenced by context.c
output.o:(file_truncate) in archive .../.gvm/pkgsets/go1.21.3/global/pkg/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64.a
gen2brain commented 2 months ago

You are trying to compile using musl but you are not using the musl build tag.