golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.1k stars 17.68k forks source link

macOS Monterey 12.6 go build ld: warning: -no_pie is deprecated when targeting new OS versions #55058

Closed ghj1976 closed 2 years ago

ghj1976 commented 2 years ago

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

$ go version
go version go1.19.1 darwin/amd64go 

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/guohongjun/Library/Caches/go-build"
GOENV="/Users/guohongjun/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/guohongjun/Documents/MyCodes/mygocodes/pkg/mod"
GONOPROXY="dianpingoa.com"
GONOSUMDB="dianpingoa.com"
GOOS="darwin"
GOPATH="/Users/guohongjun/Documents/MyCodes/mygocodes"
GOPRIVATE="dianpingoa.com"
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/guohongjun/Documents/MyCodes/sankuaigocodes/src/sankuai/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/hp/_v5x9cvd5fvf_0k3q00t9_7h0000gp/T/go-build3638380680=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

macOS Monterey 12.6

image

Xcode Version 14.0 (14A309)

image
% go build  
# sankuai/zcm/daily
ld: warning: -no_pie is deprecated when targeting new OS versions
image
ghj1976 commented 2 years ago

这是 github.com/mattn/go-sqlite3 的bug

mikesmitharoo commented 2 years ago

Happening to me too

lindianfeng commented 2 years ago

happening to me too

lggomezsf commented 2 years ago

I haven't updated yet to run into this but cannot get a clear output on the ld -v to get the exact version:

@(#)PROGRAM:ld  PROJECT:ld64-764
BUILD 11:22:55 Apr 28 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 13.1.6, (clang-1316.0.21.2.5) (static support for 28, runtime is 28)
TAPI support using: Apple TAPI version 13.1.6 (tapi-1316.0.7.3)

As of 2.39 the -no-pie field isn't deprecated but this is GNU ld so I guess it's a misomer.

I haven't done a manual link to verify but my guess is that the warning is getting propagated from the ld call. The relevant darwin/arm64 logic for the params can be seen on this commit although I don't know how should the linker frontend proceed with this

Emixam23 commented 2 years ago

Sam over here :(

cherrymui commented 2 years ago

See also #54482 . Although it has some discussion about another issue, but there are already some discussion about this. Closing as a dup. Thanks.

Also note that this is a warning, not an error. The build should still succeed and the generated program should work. (Although it affects some tests that checks build output.)

kd-s-t commented 2 years ago

its only a warning but its annoying, how do we disable it?

ZekeLu commented 2 years ago

@ollolollollooloo See https://github.com/golang/go/issues/54482#issuecomment-1251124908

nicoarguello commented 2 years ago

Pudieron resolver este inconveniente ld: warning: -no_pie is deprecated when targeting new OS versions?

fujie-xiyou commented 2 years ago

golang版本升级到1.18.8 或者1.19.3 即可解决 Upgrade the version of golang to 1.18.8 or 1.19.3 to solve the problem