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/link: system linker warnings on macOS 10.14 when using cgo #36025

Closed
tjamet opened this issue Dec 6, 2019 · 58 comments
Closed

cmd/link: system linker warnings on macOS 10.14 when using cgo #36025

tjamet opened this issue Dec 6, 2019 · 58 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Darwin
Milestone

Comments

@tjamet
Copy link

tjamet commented Dec 6, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13.5 darwin/amd64

Does this issue reproduce with the latest release?

yes, in fact, is has been introduced by the latest release

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/thibault/Library/Caches/go-build"
GOENV="/Users/thibault/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="[REDACTED]"
GONOSUMDB="[REDACTED]"
GOOS="darwin"
GOPATH="/Users/thibault/go/"
GOPRIVATE="[REDACTED]"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/thibault/go/src/github.com/tjamet/gotiff/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-build152848555=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Install go 1.13.5 from official release using the installer. This replaced my previously installed version

Then, I ran a program, I had previously run using go 1.13.1 using go run main.go, importing the sqlite package, using CGO

Here is the snippet that reproduces the problem:

package main

import (
	"database/sql"
	"log"

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

func main() {
	db, err := sql.Open("sqlite3", "test.db")
	if err != nil {
		log.Fatalln("could not open database:", err)
	}
	defer db.Close()
}

What did you expect to see?

No output on stdout/stderr.
This output was not shown with my system (10.14.6 (18G95)) using go 1.13.1
I am unsure the issue is linked to go or to go-sqlite3

What did you see instead?

When running the run command, or the go build command, I have the following output:

# command-line-arguments
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000012.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000013.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000014.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000015.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000016.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000017.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000018.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000019.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-937073420/000020.o) was built for newer OSX version (10.15) than being linked (10.14)
@ianlancetaylor ianlancetaylor changed the title CGO: ld warnings on OSX 1.14 cmd/link: system linker warnings on OSX 1.14 when using cgo Dec 6, 2019
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin labels Dec 6, 2019
@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Dec 6, 2019
@ianlancetaylor
Copy link
Member

CC @andybons @dmitshur

Is anybody else seeing this? Did we build the 1.13.5 release on macOS 10.15?

@tjamet Do you see this problem with other Go programs?

@andybons
Copy link
Member

andybons commented Dec 6, 2019

@ianlancetaylor the release is built on 10.15, yes. It may be that we need to explicitly set a target of macOS when building. See #35459.

@cagedmantis @toothrot

@andybons
Copy link
Member

andybons commented Dec 6, 2019

@tjamet can you provide the output of go build -x?

@networkimprov
Copy link

Looks like a dup of #22281 & #35193 & #33968

@eliasnaur @odeke-em

@tjamet
Copy link
Author

tjamet commented Dec 8, 2019

indeed, it looks very much like a duplicate of those tickets. Sorry about that!
I didn't see the problem with other programs @ianlancetaylor I am not using CGO for any other program though.

here is the output of go build -x

mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg.link << 'EOF' # internal
packagefile command-line-arguments=/Users/thibault/Library/Caches/go-build/8b/8b55a428107aaee0aeb04dbd587b78f8591105cf4efaadbbfdd8ea1e47ebbc0d-d
packagefile database/sql=/usr/local/go/pkg/darwin_amd64/database/sql.a
packagefile github.com/mattn/go-sqlite3=/Users/thibault/Library/Caches/go-build/62/625d875525aa67b6968cdde27e0b741576d49506c84aa2445d2b46695be60ef7-d
packagefile log=/usr/local/go/pkg/darwin_amd64/log.a
packagefile runtime=/usr/local/go/pkg/darwin_amd64/runtime.a
packagefile context=/usr/local/go/pkg/darwin_amd64/context.a
packagefile database/sql/driver=/usr/local/go/pkg/darwin_amd64/database/sql/driver.a
packagefile errors=/usr/local/go/pkg/darwin_amd64/errors.a
packagefile fmt=/usr/local/go/pkg/darwin_amd64/fmt.a
packagefile io=/usr/local/go/pkg/darwin_amd64/io.a
packagefile reflect=/usr/local/go/pkg/darwin_amd64/reflect.a
packagefile sort=/usr/local/go/pkg/darwin_amd64/sort.a
packagefile strconv=/usr/local/go/pkg/darwin_amd64/strconv.a
packagefile sync=/usr/local/go/pkg/darwin_amd64/sync.a
packagefile sync/atomic=/usr/local/go/pkg/darwin_amd64/sync/atomic.a
packagefile time=/usr/local/go/pkg/darwin_amd64/time.a
packagefile unicode=/usr/local/go/pkg/darwin_amd64/unicode.a
packagefile unicode/utf8=/usr/local/go/pkg/darwin_amd64/unicode/utf8.a
packagefile crypto/sha1=/usr/local/go/pkg/darwin_amd64/crypto/sha1.a
packagefile crypto/sha256=/usr/local/go/pkg/darwin_amd64/crypto/sha256.a
packagefile crypto/sha512=/usr/local/go/pkg/darwin_amd64/crypto/sha512.a
packagefile math=/usr/local/go/pkg/darwin_amd64/math.a
packagefile net/url=/usr/local/go/pkg/darwin_amd64/net/url.a
packagefile strings=/usr/local/go/pkg/darwin_amd64/strings.a
packagefile runtime/cgo=/usr/local/go/pkg/darwin_amd64/runtime/cgo.a
packagefile syscall=/usr/local/go/pkg/darwin_amd64/syscall.a
packagefile os=/usr/local/go/pkg/darwin_amd64/os.a
packagefile internal/bytealg=/usr/local/go/pkg/darwin_amd64/internal/bytealg.a
packagefile internal/cpu=/usr/local/go/pkg/darwin_amd64/internal/cpu.a
packagefile runtime/internal/atomic=/usr/local/go/pkg/darwin_amd64/runtime/internal/atomic.a
packagefile runtime/internal/math=/usr/local/go/pkg/darwin_amd64/runtime/internal/math.a
packagefile runtime/internal/sys=/usr/local/go/pkg/darwin_amd64/runtime/internal/sys.a
packagefile internal/reflectlite=/usr/local/go/pkg/darwin_amd64/internal/reflectlite.a
packagefile internal/fmtsort=/usr/local/go/pkg/darwin_amd64/internal/fmtsort.a
packagefile math/bits=/usr/local/go/pkg/darwin_amd64/math/bits.a
packagefile internal/race=/usr/local/go/pkg/darwin_amd64/internal/race.a
packagefile crypto=/usr/local/go/pkg/darwin_amd64/crypto.a
packagefile encoding/binary=/usr/local/go/pkg/darwin_amd64/encoding/binary.a
packagefile hash=/usr/local/go/pkg/darwin_amd64/hash.a
packagefile internal/oserror=/usr/local/go/pkg/darwin_amd64/internal/oserror.a
packagefile internal/poll=/usr/local/go/pkg/darwin_amd64/internal/poll.a
packagefile internal/syscall/unix=/usr/local/go/pkg/darwin_amd64/internal/syscall/unix.a
packagefile internal/testlog=/usr/local/go/pkg/darwin_amd64/internal/testlog.a
EOF
mkdir -p $WORK/b001/exe/
cd .
/usr/local/go/pkg/tool/darwin_amd64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -buildmode=exe -buildid=wEANusrRlE4PWCHXqU7k/6MHzcFQa7XackiClGHR7/zuSDETUaEJrB7Vx2l-Qq/wEANusrRlE4PWCHXqU7k -extld=clang /Users/thibault/Library/Caches/go-build/8b/8b55a428107aaee0aeb04dbd587b78f8591105cf4efaadbbfdd8ea1e47ebbc0d-d
/usr/local/go/pkg/tool/darwin_amd64/buildid -w $WORK/b001/exe/a.out # internal
# command-line-arguments
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000012.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000013.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000014.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000015.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000016.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000017.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000018.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000019.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/dt/lz9gptg91vzchq7zp5grt85h0000gn/T/go-link-168878093/000020.o) was built for newer OSX version (10.15) than being linked (10.14)
mv $WORK/b001/exe/a.out main
rm -r $WORK/b001/

@toothrot
Copy link
Contributor

toothrot commented Dec 9, 2019

I don't have a mac machine handy (and am just learning the x/build/cmd/release code), but is setting MACOSX_DEPLOYMENT_TARGET in x/build/dashboard/builders.go#L528 sufficient?

Edit: I'll work on answering this question

@mariusgrigoriu
Copy link

Also experiencing this on MacOS 10.14 with Go 1.13.5 with cgo on a different project. Downgrading to Go 1.13.4 makes the warnings go away.

@richard-mauri
Copy link

richard-mauri commented Dec 16, 2019

I also am experiencing this on MaxOS 10.14.6 with go1.13.5
Downgrading to go1.13.4 makes the warnings go away

$ go version
go version go1.13.5 darwin/amd64

$ go build -o ./bin/darwin/encompassbeat -x  main.go
WORK=/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-build282330584
cat /Users/rmauri/Library/Caches/go-build/e8/e8bbe37f80f74a7fd8d266dcbdc46a831422aa01c21cb85e9bb3f6ff9e1af029-d  # internal
# command-line-arguments
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000000.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000001.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000002.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000003.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000004.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000009.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000010.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000015.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000016.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000017.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000018.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000019.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000020.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000021.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000022.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000023.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000024.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000025.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000026.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/000027.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/s0/g6ny6y0d5ss2fcspmcfhzfxn41wtqr/T/go-link-812475010/go.o) was built for newer OSX version (10.15) than being linked (10.14)```

@cagedmantis cagedmantis self-assigned this Dec 17, 2019
@medyagh
Copy link

medyagh commented Dec 21, 2019

I have the same problem

$ go version
go version go1.13.5 darwin/amd64

@JasonZhang95
Copy link

also met this problem

# command-line-arguments ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000000.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000001.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000002.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000003.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000004.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/go.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000005.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000006.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000007.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000008.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000009.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000010.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000011.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000012.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000013.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/sw/lgrvgk450ld5bvskc749btb80000gp/T/go-link-242272134/000014.o) was built for newer OSX version (10.15) than being linked (10.14)

@toothrot
Copy link
Contributor

toothrot commented Jan 9, 2020

@cagedmantis has been working on this all week, and it's a bit more involved than we first expected. We're still working on it, and will keep this thread updated.

@sourav1547
Copy link

This issue got resolved with go version go1.13.6 darwin/amd64. Thanks a lot.

@cagedmantis
Copy link
Contributor

@sourav1547 Would you mind sharing what version of macOS you are using?

@sourav1547
Copy link

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G103

@mariusgrigoriu
Copy link

Still experiencing this issue with go1.13.6.

@neondodongo
Copy link

I am also experiencing this problem with go1.13.6
On Mac OS X v10.14.6

@tinybit
Copy link

tinybit commented Jan 16, 2020

Still experiencing the same problem with 1.13.6

ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000000.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000001.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000002.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/go.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000003.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000004.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000005.o) was built for newer OSX version (10.15) than being linked (10.14) ld: warning: object file (/var/folders/lv/99xc89057771b7ldn6vtgg5rgd57nj/T/go-link-599844632/000006.o) was built for newer OSX version (10.15) than being linked (10.14)

Mac OS X version: 10.14.6

@ibrt
Copy link
Contributor

ibrt commented Jan 19, 2020

Also experiencing this with go1.13.6:

ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000006.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000007.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000008.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000009.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000010.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000011.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000012.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000013.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000014.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000015.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000016.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000017.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000018.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000019.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000022.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000023.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000024.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/rv/_jh1r0892_v7cq6l377lwbh80000gn/T/go-link-482883828/000025.o) was built for newer OSX version (10.15) than being linked (10.14)

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/216304 mentions this issue: cmd/release: set the minimum macOS version supported by releases

@cagedmantis cagedmantis added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jan 27, 2020
@cagedmantis
Copy link
Contributor

I've been able to reproduce this issue using the go1.12.15 release.

@cagedmantis
Copy link
Contributor

@gopherbot please open a backport for 1.12 and 1.13 since the linker warnings are appearing in both versions.

@networkimprov
Copy link

@sc0Vu could you file a new issue to report that, and describe how you upgraded Go and any other applicable config of your machine?

@sc0Vu
Copy link

sc0Vu commented Sep 22, 2020

It seems go version was hardcoded in https://go-review.googlesource.com/c/build/+/216304/5/cmd/release/release.go#367, which is prefixed with 1.14.

And I can remove these warning with the CGO_CFLAGS=-mmacosx-version-min=10.12 (found in the commit)

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/278435 mentions this issue: cmd/release: set macOS deployment target for darwin/arm64 too

@einthusan
Copy link

I am on MacOSX 10.11.6 and I still see these errors with go version go1.14.12 darwin/amd64

ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000014.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000015.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000016.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000017.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000018.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000037.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000038.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000039.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000040.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000041.o) was built for newer OSX version (10.12) than being linked (10.11)
ld: warning: object file (/var/folders/cj/ymv0b8js49l90hc7v5txjqg80000gn/T/go-link-218678783/000042.o) was built for newer OSX version (10.12) than being linked (10.11)

Maybe this issue should be re-opened?

@dmitshur
Copy link
Contributor

dmitshur commented Jan 6, 2021

@einthusan It'll be better to file a new issue, fill in the relevant information, and also mention this issue number. Thanks.

@networkimprov
Copy link

@einthusan how did you install Go on your Mac? This has been an issue when installing via homebrew.

@einthusan
Copy link

einthusan commented Jan 6, 2021

I downloaded it from https://golang.org/dl/ site itself. I was building a simple Ebiten (2D game engine in Go) game. I managed to prevent these warnings from showing when I used a flag to bypass "Metal" on OSX and use OpenGL. e.g. go build -tags=ebitengl main.go

@dmitshur I think we can forgo a fix for this... I am a few of the last on 10.11.6 ... El Captain.

@Anjali-Saha
Copy link

Anjali-Saha commented Jan 6, 2021 via email

@dmitshur
Copy link
Contributor

dmitshur commented Jan 6, 2021

I think we can forgo a fix for this... I am a few of the last on 10.11.6 ... El Captain.

@einthusan Go 1.14 is supposed to require macOS 10.11 as the oldest version, not 10.12. (See here.) You're right that this is not very high priority by now, as it'll stop being supported when Go 1.16 is out. However, if this is reproducible for you and if you don't mind, it can still be helpful to file an issue in case it helps us understand this better and ensure it doesn't happen in the future for newer versions.

@einthusan
Copy link

einthusan commented Jan 6, 2021

@dmitshur okay, in that case, I will.
#43546

@ronakg
Copy link

ronakg commented Jan 22, 2021

I just started seeing this issue after upgrading to Go 1.15.7. I'm running MacOS Big Sur (11.1).

Get this warning during running go test:

ld: warning: object file (/var/folders/f1/d20cq36s6gn1kj0vgdv855t00000gn/T/go-link-978373928/000028.o) was built for newer macOS version (11.0) than being linked (10.16)

@dmitshur
Copy link
Contributor

@ronakg Please open a new issue and reference this one. We'd like to be able to reproduce it, but may need more information. This issue is closed and not the right place to start a new investigation. Thanks.

@ronakg
Copy link

ronakg commented Jan 22, 2021

@ronakg Please open a new issue and reference this one. We'd like to be able to reproduce it, but may need more information. This issue is closed and not the right place to start a new investigation. Thanks.

Sure. Opened #43856.

@jamesvan2019
Copy link

I just upgraded to go1.14.3 (using brew upgrade go) and I see the same warning when running the test suite for my project as I did before. I have also tried cleaning the build cache with go clean -cache -modcache -testcache, but that seemed to have no effect. I am still seeing:

...
ld: warning: object file (/var/folders/w3/qgblwzwn55x4k_dj39r85jym0000gn/T/go-link-888110593/000019.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/w3/qgblwzwn55x4k_dj39r85jym0000gn/T/go-link-888110593/go.o) was built for newer OSX version (10.15) than being linked (10.14)
...

Is there something I have to do more than upgrade go to get the fix for this?

it works

@forzap
Copy link

forzap commented Jul 2, 2021

I suspect it somehow is similar to Julia issue (JuliaLang/julia#14182), where there's a mix-up during make caused by DARWINVER. My issue starts happening when I upgrade my Xcode from 11.5 to 12.4.

I tried all the above suggestions but it never worked (brew install / uninstall go, clean go cache, use latest Go, use Go v1.14, etc). My solution, is to install Command Line Tools version 11.5 and execute "xcode-select -s /Library/Developer/CommandLineTools" so that it points to CLT v11.5 instead of CLT v12.4 residing inside my Xcode. After that no more warning message showing.

@yyccQQu
Copy link

yyccQQu commented Nov 25, 2021

  • MAC
    Here's my solution:
    Golang version will not change
    Upgrade reinstalled protobuf proto-go-gen
    The most important thing is to restart your computer
    • if useless about above!!!!!!
    • reinstalled xcode-select
    sudo rm -rf /Library/Developer/CommandLineTools
    xcode-select --install
    

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/381854 mentions this issue: cmd/go: rewrite TestScript/cgo_stale_precompiled to be agnostic to staleness

gopherbot pushed a commit that referenced this issue Jan 31, 2022
…aleness

The configuration set by x/build/cmd/releasebot causes runtime/cgo to
be stale in the darwin/amd64 release (see #36025, #35459).
That staleness is mostly benign because we can reasonably assume that
users on macOS will either disable CGO entirely or have a C compiler
installed to rebuild (and cache) the stale packages if needed.

Fixes #50892
Fixes #50893
Updates #46347

Change-Id: Ib9ce6b5014de436264238f680f7ca4ae02c9a220
Reviewed-on: https://go-review.googlesource.com/c/go/+/381854
Trust: Bryan Mills <[email protected]>
Run-TryBot: Bryan Mills <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Russ Cox <[email protected]>
@aronderos-meli
Copy link

After upgrade go version from 1.17.6 to 1.19 this issue shows up in Golang IDE when I run gotest command on Mac with 12.5 OS.

The yyccQQu solution works for me.

@alecxcode
Copy link

alecxcode commented Oct 4, 2022

After upgrading Go version 17 to any of these: 1.18.6, 1.19.1 the issue shows up again. Nothing helps, including reinstalling xcode command line tools, restarting the machine.
ld: warning: object file (/var/folders/xf/.../T/go-link-1802583988/000000.o) was built for newer macOS version (12.0) than being linked (11.0)
The message repeats many times for various objects files. However these directories and files do not exist after the build command is finished.
Using macOS 11.6, arm64, Installed Go with pkg installer from Go website.

@dmitshur
Copy link
Contributor

dmitshur commented Oct 5, 2022

@alecxcode Please open a new issue and provide those details there. You can add a reference to this issue. However, this issue is closed so there's no active work happening here. Thanks.

@basi02
Copy link

basi02 commented Dec 19, 2022

Hey could you solve this?

@golang golang locked and limited conversation to collaborators Dec 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Darwin
Projects
None yet
Development

No branches or pull requests