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: ld: building for macOS, but linking in object file built for iOS #57397

Open
bradfitz opened this issue Dec 19, 2022 · 2 comments
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Milestone

Comments

@bradfitz
Copy link
Contributor

Go 1.19.4

When building our application, a few of us occasionally get the error:

/Users/bradfitz/.cache/tailscale-go/pkg/tool/darwin_arm64/link: running gcc failed: exit status 1
ld: building for macOS, but linking in object file built for iOS, file '/var/folders/0f/7sz95dc94nj46b6yz8p_fqd40000gn/T/go-link-3835913802/000004.o' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

And the only way to recover is to do a go clean -cache and build again.

We haven't figured out more than that, yet. And we don't have an on-demand repro.

Just filing this now in case anybody has any ideas.

Like, maybe piece of the environment is missing from the cache signature? Maybe an empty file is being created that's being interpreted as iOS instead of macOS?

But that error message is not a Go thing at all. I see tons of Google results for other languages. But maybe cmd/go can detect whatever broken state its input is in and ignore that input file and rebuild it instead? Totally guessing.

/cc @ianlancetaylor who likes linkers :)

@spatialbits
Copy link

Ran into this on Friday after upgrading from 1.19.1 to 1.19.4.

@ianlancetaylor
Copy link
Contributor

It sounds like once this problem occurs, it is repeatable. If so, then when it happens again, run with -ldflags=-tmpdir=/my/private/tmpdir and take a look at the failing file.

@seankhliao seankhliao added OS-Darwin NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 26, 2022
@seankhliao seankhliao added this to the Unplanned milestone Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Projects
None yet
Development

No branches or pull requests

4 participants