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/compile: OSX Builds cannot find libcrt0.o #50669

Closed
karlmutch opened this issue Jan 18, 2022 · 2 comments
Closed

cmd/compile: OSX Builds cannot find libcrt0.o #50669

karlmutch opened this issue Jan 18, 2022 · 2 comments

Comments

@karlmutch
Copy link

@karlmutch karlmutch commented Jan 18, 2022

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

go version go1.18beta1 darwin/amd64

Does this issue reproduce with the latest release?

N/A (1.18 Beta1)

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/karlmutch/Library/Caches/go-build"
GOENV="/Users/karlmutch/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/karlmutch/projects/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/karlmutch/projects"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/karlmutch/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/karlmutch/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18beta1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/karlmutch/projects/src/github.com/xxxxxx/xxx-xxxx/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/hv/zjrtcfqs64g1bhyh8wvx919r0000gp/T/go-build3854253269=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go build -ldflags="-extldflags=-static" -tags="osusergo netgo" ./cmd/kvserver

What did you expect to see?

# github.com/shirou/gopsutil/disk
iostat_darwin.c:28:2: warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:132:1: note: 'IOMasterPort' has been explicitly marked deprecated here

What did you see instead?

# github.com/shirou/gopsutil/disk
iostat_darwin.c:28:2: warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:132:1: note: 'IOMasterPort' has been explicitly marked deprecated here
# github.com/fetchrobotics/sage-kernel/cmd/kvserver
/Users/karlmutch/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Related #50662

@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Jan 18, 2022

macOS doesn't support it.
also, that's not a Go issue
https://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build

@karlmutch
Copy link
Author

@karlmutch karlmutch commented Jan 18, 2022

Thanks ! I had no idea this was the case.

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