Hi, I am using zig to cross compile a go module (go-fitz) on my Mac. The compiler options used are as below :
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC="zig cc -target x86_64-linux" CXX="zig c++ -target x86_64-linux" go build -o main *.go
But, I am getting the below error on compilation -
/usr/local/Cellar/go/1.18/libexec/pkg/tool/darwin_amd64/link: running zig failed: exit status 1
ld.lld: error: undefined symbol: __fprintf_chk
>>> referenced by context.c
>>> context.o:(fz_new_context_imp) in archive /Users/user1/go/pkg/mod/github.com/gen2brain/go-fitz@v1.18.0/libs/libmupdf_linux_amd64.a
>>> referenced by error.c
>>> error.o:(fz_default_error_callback) in archive /Users/user1/go/pkg/mod/github.com/gen2brain/go-fitz@v1.18.0/libs/libmupdf_linux_amd64.a
>>> referenced by error.c
>>> error.o:(fz_default_warning_callback) in archive /Users/user1/go/pkg/mod/github.com/gen2brain/go-fitz@v1.18.0/libs/libmupdf_linux_amd64.a
>>> referenced 39 more times
On the other hand, if I use the below options, the compilation runs successfully but I get a segmentation fault at runtime :
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC="zig cc -target x86_64-linux-gnu" go build -o main *.go
Can you please help me here? Thank you!
Hi, I am using zig to cross compile a go module (go-fitz) on my Mac. The compiler options used are as below :
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC="zig cc -target x86_64-linux" CXX="zig c++ -target x86_64-linux" go build -o main *.go
But, I am getting the below error on compilation -
On the other hand, if I use the below options, the compilation runs successfully but I get a segmentation fault at runtime :
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC="zig cc -target x86_64-linux-gnu" go build -o main *.go
Can you please help me here? Thank you!