Closed FuckingToasters closed 5 months ago
A Qucik fix i found is following (basically disables CGO for darwin):
# Setup the proper C compiler based on target OS
if GOOS == "darwin":
#os.environ["CC"] = "clang"
os.environ["CGO_ENABLED"] = "0"
else:
os.environ["CC"] = "gcc"
os.environ["CGO_ENABLED"] = "1"
But it's not an permanent solution
Thanks, here's a simple reproducer:
$ GOOS=linux GOARCH=amd64 CGO_ENABLED=1 garble build runtime/cgo
$ echo $?
0
$ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 garble build runtime/cgo
# runtime/cgo
clang: error: argument unused during compilation: '-arch x86_64' [-Werror,-Wunused-command-line-argument]
exit status 2
exit status 1
I don't think this issue is at all related to garble, as I see it with plain Go 1.22.1 as well:
$ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build runtime/cgo
# runtime/cgo
clang: error: argument unused during compilation: '-arch x86_64' [-Werror,-Wunused-command-line-argument]
Closing as unrelated to garble.
What version of Garble and Go are you using?
What environment are you running Garble on?
go env
OutputWhat did you do?
I ran a little build.py script which performs the build process for different systems using garble, everythign except macos worked as expected.
What did you expect to see?
I expected that the compilation for macos worked the same way it did for the other systems.
What did you see instead?
First i got an error that clang is not found in PATH so i got rid of this error by simply installing it, after installing it and trying to run it again, i got following error:
The garble command used by the build.py script were
garble -literals -tiny -seed=random build -ldflags="-w -s" -o cache/
I also tried to run it without the -ldflags which caused the same issue.