Skip to content

ld: warning: object file (...) was built for newer macOS version (12.0) than being linked (11.3) #1055

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

Closed
Plorenzo opened this issue May 28, 2022 · 2 comments

Comments

@Plorenzo
Copy link

I'm getting the following errors when building my go program.

# command-line-arguments
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000012.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000013.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000014.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000015.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000016.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000017.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000018.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000019.o) was built for newer macOS version (12.0) than being linked (11.3)
ld: warning: object file (/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-link-1414785648/000020.o) was built for newer macOS version (12.0) than being linked (11.3)

macOS version

$ sw_vers
ProductName:	macOS
ProductVersion:	12.5
BuildVersion:	21G5027d
Go env
$ go env                                                                                                                                                                                                                                                                 
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/plorenzo/dev/gorkspace/bin"
GOCACHE="/Users/plorenzo/Library/Caches/go-build"
GOENV="/Users/plorenzo/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/plorenzo/dev/gorkspace/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/plorenzo/dev/gorkspace"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.18.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18.2/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/plorenzo/dev/gorkspace/scr/gitlab.com/plorenzo/test/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/yy/16g_7s717l358cwmrh87jc4w0000gn/T/go-build3374803040=/tmp/go-build -gno-record-gcc-switches -fno-common"

Minimun reproducible example

package main

import (
	"database/sql"

	_ "github.com/mattn/go-sqlite3"
)

func main() {
	sql.Open("sqlite3", "db")
}

@rittneje
Copy link
Collaborator

It looks like you installed Go via Homebrew. As per this, you may need to update CommandLineTools (i.e., XCode).

@Plorenzo
Copy link
Author

Thank you for the pointer. Indeed reinstalling command line tools did the trick.

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants