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: with MacOS Mojave 10.14 beta, warning: URGENT: building for OSX, but linking against dylib during make.bash #27095

Open
Cospotato opened this Issue Aug 20, 2018 · 20 comments

Comments

Projects
None yet
@Cospotato

Cospotato commented Aug 20, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11rc1 darwin/amd64

Does this issue reproduce with the latest release?

no

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

GOARCH="amd64"
GOBIN="/Users/CosPotato/go/bin"
GOCACHE="/Users/CosPotato/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/CosPotato/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2g/4x1xzstj4vdbj939flg1q7v00000gn/T/go-build865953866=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

sudo GOROOT_BOOTSTRAP=/usr/local/go1_9 ./make.bash
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

0 warning(s), 0 error(s).

What did you see instead?

Building Go cmd/dist using /usr/local/go1_9.
Building Go toolchain1 using /usr/local/go1_9.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for darwin/amd64.
# runtime/cgo
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libpthread.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# os/signal/internal/pty
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# plugin
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# net
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# os/user
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# crypto/x509
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//Security.framework/Security) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation) built for (unknown). Note: This will be an error in the future.
---
Installed Go for darwin/amd64 in /usr/local/go
Installed commands in /usr/local/go/bin

@agnivade agnivade changed the title from runtime: ld: warning on Mac OS Mojave 10.14 Beta (18A365a) to cmd/link: warning: URGENT: building for OSX, but linking against dylib when bootstrapping with 1.9 Aug 20, 2018

@agnivade

This comment has been minimized.

Member

agnivade commented Aug 20, 2018

Just wanted to confirm it is not a GOROOT_BOOTSTRAP issue right ? Do you see the same issue using 1.10 ?

@Cospotato

This comment has been minimized.

Cospotato commented Aug 20, 2018

@agnivade Confirmed, it is not a GOROOT_BOOTSTRAP issue.
run sudo GOROOT_BOOTSTRAP=/usr/local/go1_10 ./make.bash
got

Building Go cmd/dist using /usr/local/go1_10.
Building Go toolchain1 using /usr/local/go1_10.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for darwin/amd64.
# runtime/cgo
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libpthread.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# os/signal/internal/pty
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# plugin
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# net
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# os/user
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
# crypto/x509
ld: warning: ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//Security.framework/Security) built for (unknown). Note: This will be an error in the future.URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation) built for (unknown). Note: This will be an error in the future.

---
Installed Go for darwin/amd64 in /usr/local/go
Installed commands in /usr/local/go/bin

@agnivade agnivade changed the title from cmd/link: warning: URGENT: building for OSX, but linking against dylib when bootstrapping with 1.9 to cmd/link: warning: URGENT: building for OSX, but linking against dylib during make.bash Aug 20, 2018

@agnivade

This comment has been minimized.

Member

agnivade commented Aug 20, 2018

@mvdan mvdan added this to the Go1.11 milestone Aug 20, 2018

@mvdan

This comment has been minimized.

Member

mvdan commented Aug 20, 2018

Milestoning for 1.11, just in case this is unexpected or bad enough to fix before the final release.

@rasky rasky changed the title from cmd/link: warning: URGENT: building for OSX, but linking against dylib during make.bash to cmd/link: with OSX beta, warning: URGENT: building for OSX, but linking against dylib during make.bash Aug 20, 2018

@rasky

This comment has been minimized.

Member

rasky commented Aug 20, 2018

I've changed the description back to mentioning that this happens with OSX beta.

@Cospotato which version of Xcode you have installed in your OSX beta? Is it the latest one?

@Cospotato

This comment has been minimized.

Cospotato commented Aug 20, 2018

@rasky
I'm using XCode 9.4.1

$ /usr/bin/xcodebuild -version
Xcode 9.4.1
Build version 9F2000

I also installed XCode 10.0.0-beta. But I selected to the stable one with xcode-select.

@rasky

This comment has been minimized.

Member

rasky commented Aug 20, 2018

@Cospotato does the error appear with Xcode 10 beta?

@ianlancetaylor ianlancetaylor changed the title from cmd/link: with OSX beta, warning: URGENT: building for OSX, but linking against dylib during make.bash to cmd/link: with MacOS Mojave 10.14 beta, warning: URGENT: building for OSX, but linking against dylib during make.bash Aug 21, 2018

@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Aug 21, 2018

CC @randall77

What fresh hell is this?

@Cospotato

This comment has been minimized.

Cospotato commented Aug 21, 2018

@rasky Interesting, When I run make.bash with XCode 10 Beta. The warning disappeared! I don't know why.

@rasky

This comment has been minimized.

Member

rasky commented Aug 21, 2018

MacOS and XCode are always supposed to upgrade together. In fact, you can use newer XCode on previous MacOS versions, but not viceversa.

Ian, Keith, given the changes that went in Go 1.11 to start using libsystem, I think we should at least document to always use the latest XCode

@randall77

This comment has been minimized.

Contributor

randall77 commented Aug 21, 2018

Got me. Anyone have the source to OSX's ld?
I suspect there's some way they are detecting the version of libSystem and friends, and it is failing. Hence the (unknown). Possibly it is the path. @Cospotato, if you can try editing runtime/sys_darwin.go and replace all of the libSystem.B.dylib with libSystem.dylib (the latter is just a symlink the the former) and see if anything changes.

Another possibility is versioning. If I do

$ otool -L /bin/ls
/bin/ls:
	/usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
$ otool -L ../bin/go
../bin/go:
	/usr/lib/libSystem.B.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 0.0.0, current version 0.0.0)

So somehow Go binaries don't have compatibility/current versions. I don't know how to pick the right versions and/or record that in the binary, but if someone who is experiencing this bug could figure out at least the latter, we could test to see if that is it.

@randall77

This comment has been minimized.

Contributor

randall77 commented Aug 24, 2018

@Cospotato Just to be clear, these are only warnings, not errors? You can still build binaries, and run them, just fine?

@andybons andybons modified the milestones: Go1.11, Go1.11.1 Aug 25, 2018

@FiloSottile FiloSottile modified the milestones: Go1.11.1, Go1.12 Aug 31, 2018

@randall77

This comment has been minimized.

Contributor

randall77 commented Sep 4, 2018

So I looked into this a bit more. My understanding is as follows. The linker records a path, compatibility version, and current version for each shared library a binary is linked against. Additionally, each shared library also has a compatibility and current version.

At load time, the dynamic loader checks the version information for compatibility.

The current version (both the version recorded in the load command in the executable, and the version on the shared library itself) are ignored.

The compatibility version listed in the load command in the executable must be less than or equal to the compatibility version on the shared library itself.

I hacked our linker to require version 2.0.0 of libSystem.dylib, and those binaries will not run:

dyld: Library not loaded: /usr/lib/libSystem.B.dylib
  Referenced from: /private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/pkg/tool/darwin_amd64/go_bootstrap
  Reason: Incompatible library version: go_bootstrap requires version 2.0.0 or later, but libSystem.B.dylib provides version 1.0.0

We currently specify 0.0.0 for both compatibility version and current version. That seems maximally compatible.

The question remains: what happened during @Cospotato 's build? The (unknown) part of the error sounds like the dynamic loader is unable to find the version (or even the architecture? or even the file itself?) of the libraries it is loading. This does not sound like a problem in Go, but in the OS installation itself. I've seen errors like this on the web that have happened for some bad Xcode beta versions.

TL;DR I don't think there's anything we need to do here, absent something I'm missing.

References:

@randall77 randall77 self-assigned this Sep 4, 2018

@dmitshur

This comment has been minimized.

Member

dmitshur commented Sep 25, 2018

Is this still an issue with the final release of macOS Mojave 10.14 (which came out today)? I can't reproduce it.

@joshcarter

This comment has been minimized.

joshcarter commented Sep 25, 2018

I'm seeing this when trying to build on a clean 10.14 install. Go version 1.11, Xcode version 10.0 build version 10A255.

EDIT: I had installed Go using Homebrew. After removing the Homebrew version and installing the binary version from golang.org, this problem went away.

@Txiaozhe

This comment has been minimized.

Txiaozhe commented Sep 29, 2018

I am get an error when I compile one c++ file:
ld: warning: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.

with my c++ file depends /usr/lib/libSystem.dylib and /usr/lib/libc++.dylib, it is the same problem?

my mac: macos mojave 10.14

@gopherbot

This comment has been minimized.

gopherbot commented Oct 4, 2018

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Oct 4, 2018

@robpike robpike reopened this Oct 5, 2018

@gopherbot gopherbot closed this Oct 5, 2018

@robpike

This comment has been minimized.

Contributor

robpike commented Oct 5, 2018

Why won't this issue stay open?

@robpike robpike reopened this Oct 5, 2018

@agnivade agnivade removed the WaitingForInfo label Oct 5, 2018

@agnivade

This comment has been minimized.

Member

agnivade commented Oct 5, 2018

You have to remove the WaitingForInfo label.

@dmitshur

This comment has been minimized.

Member

dmitshur commented Oct 5, 2018

I think it's another instance of gopherbot fighting with people, but doing so only once (i.e., it didn't close the issue after Rob reopened it the second time). This is #21312.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment