Closed foobarhe closed 10 months ago
You cannot build for musl target and use your system glibc toolchain and gcc, remove -tags musl
.
Or, you can install musl toolchain and use gcc from musl, i.e. add something like this CC=x86_64-pc-linux-musl-gcc
to your build line.
in macos , i use: GOOS=linux GOARCH=amd64 go build -o myTarget have err: undefined: fitz.NewFromMemory
what should i do to solve this problem
When you cross-compile, Go by default disables CGO, enable it with CGO_ENABLED=1
. Then you will probably get different errors from the compiler, you cannot just change GOOS and GOARCH. The rules are the same as when you cross-compile a C project, you must pass CC
and use the appropriate toolchain. That has nothing to do specifically with this but with every CGO project.
To solve this use the appropriate compiler in CC, i.e. zig cc -target x86_64-linux-gnu
, maybe clang --target x86_64-pc-linux-gnu
can be used, etc.
Thank you very much for your reply
I googled sigsetjmp, but failed find anything useful, could you please help?