Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: pass -arch to GOOS=darwin host compiler, linker #43692

Closed
rsc opened this issue Jan 14, 2021 · 4 comments
Closed

cmd/go: pass -arch to GOOS=darwin host compiler, linker #43692

rsc opened this issue Jan 14, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jan 14, 2021

See golang/vscode-go#1087.
The root cause is confusion about the Mac toolchain expecting x86 vs arm binaries.
We should be able to fix the confusion by forcing when GOOS=darwin the use of -arch arm64 or -arch x86_64 (not sure the second is spelled correctly), to match GOARCH.

This would mean adding the flags in the C compiler invocation and also adding them to the -extld passed to the Go linker.

@rsc rsc added this to the Go1.16 milestone Jan 14, 2021
@bcmills
Copy link
Contributor

bcmills commented Jan 14, 2021

I think this is a duplicate of #43476, or at least very closely related.

@bcmills
Copy link
Contributor

bcmills commented Jan 14, 2021

If I understand https://clang.llvm.org/docs/CrossCompilation.html correctly, we might want to pass the -arch and/or -target flags to clang on all GOOSes (at least when cross-compiling), not just darwin.

I suppose darwin is somewhat unique in that apparently we can't easily determine whether clang thinks it is cross-compiling.

@rsc
Copy link
Contributor Author

rsc commented Jan 14, 2021

At this point in the release cycle I'd be much more comfortable only doing it for darwin.
This may be a duplicate of #43476 but I think this bug states the problem more clearly if nothing else.

@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 14, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/283812 mentions this issue: cmd/dist, cmd/go: pass -arch for C compilation on Darwin by default

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants