wangyoucao577 / go-release-action

Automatically publish Go binaries to Github Release Assets through Github Action.
https://github.com/marketplace/actions/go-release-binaries
MIT License
498 stars 77 forks source link

cross-compilations to mac failed because clang not found #142

Open sech1p opened 11 months ago

sech1p commented 11 months ago

Hello, i could not compile my program to mac because (as above): cgo: C compiler "clang" not found: exec: "clang": executable file not found in $PATH

Can this somehow be resolved? Thank you for any help and best regards

https://github.com/sech1p/AppleMusic_Discord_RPC/actions/runs/6959620053/job/18937261755

wangyoucao577 commented 11 months ago

It seems that your code requires clang for cgo features, but this action doesn't have clang installed at the moment. Could you please try out to install clang use something like pre_command: apt update && apt install clang, alternatively you can have a try to switch C compiler to gcc by env: CC=gcc?

sech1p commented 11 months ago

Thanks it works! But in result i got an weird error like clang: error: argument unused during compilation: '-arch x86_64' [-Werror,-Wunused-command-line-argument] and no ideas how to fix it

wangyoucao577 commented 11 months ago

Actually it's cross compilation that runs on x86_64 but target to mac arm. Do you know which libs you're cross compiling on? I.e., that you enables CGO for. You may need to follow its instructions for some settings. This example may helpful for reference: https://stackoverflow.com/questions/69643927/cross-compiling-for-linux-arm-7-clang-error-argument-unused-during-compilation