Skip to content

cmd/go: ld: building for macOS, but linking in object file built for iOS #57397

@bradfitz

Description

@bradfitz

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Darwin

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions