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: unexpected 32-bit segment on Mac M1 #70620

Open
ikhin opened this issue Nov 30, 2024 · 3 comments
Open

cmd/link: unexpected 32-bit segment on Mac M1 #70620

ikhin opened this issue Nov 30, 2024 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@ikhin
Copy link

ikhin commented Nov 30, 2024

Go version

go1.23.3

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/my/Library/Caches/go-build'
GOENV='/Users/my/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-buildvcs=false'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/my/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/my/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/my/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/my/Desktop/main/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/7c/51v8_yt929s281kn6_8v9wtw0000gn/T/go-build664131383=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Do go build or go test with Goland 2024.3 on Mac M1 normally.

What did you see happen?

panic: unexpected 32-bit segment

goroutine 1 [running]:
cmd/link/internal/ld.machoCombineDwarf(0x1400015c200, 0x14000a6c0b8, 0x140013af000, {0x14009754140?, 0x16f7e70ac?}, {0x14009efe120, 0x59})
cmd/link/internal/ld/macho_combine_dwarf.go:224 +0x109c
cmd/link/internal/ld.(*Link).hostlink.func7(0x10095d5c8?, 0x14000a6c0b8?, 0x0?, {0x14009efe120?, 0x140097542d0?})
cmd/link/internal/ld/lib.go:2056 +0x38
cmd/link/internal/ld.(*Link).hostlink.func6({0x1008720dd, 0xf}, 0x1400c36d340)
cmd/link/internal/ld/lib.go:1993 +0x21c
cmd/link/internal/ld.(*Link).hostlink(0x1400015c200)
cmd/link/internal/ld/lib.go:2054 +0x4940
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x0, 0x0, 0x0}, ...})
cmd/link/internal/ld/main.go:473 +0x17e8
main.main()
cmd/link/main.go:72 +0xbb4

What did you expect to see?

I just want to share the solution for people searching

command execute:

go env -w CGO_ENABLED='0'

and set cgo support disable in Goland Setting

@seankhliao seankhliao changed the title cgo: unexpected 32-bit segment on Mac M1 cmd/link: unexpected 32-bit segment on Mac M1 Nov 30, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 30, 2024
@seankhliao
Copy link
Member

do you have code that can reproduce this issue?
is this reproducible without goland?
which clang is used?

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 2, 2024
@mknyszek mknyszek added this to the Backlog milestone Dec 2, 2024
@mknyszek
Copy link
Contributor

mknyszek commented Dec 2, 2024

CC @golang/compiler

@cherrymui cherrymui added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
Status: No status
Development

No branches or pull requests

6 participants