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: malformed mach-o image: segment __DWARF has vmsize < filesize #34935

Open
bolenzhang opened this issue Oct 16, 2019 · 20 comments

Comments

@bolenzhang
Copy link

@bolenzhang bolenzhang commented Oct 16, 2019

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

why not fix this issue #32673 in the version of go1.13?

$ go version
go version go1.13.1 darwin/amd64

Does this issue reproduce with the latest release?

no

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/zhangliyong/Library/Caches/go-build"
GOENV="/Users/zhangliyong/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/zhangliyong/go"
GOPRIVATE=""
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/zhangliyong/chain/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/rz/4wlrcszd55gf6s2j571bhlzr0000gn/T/go-build990418285=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Ran a shell script about golang testing.

What did you expect to see?

it works without errors

What did you see instead?

dyld: malformed mach-o image: segment __DWARF has vmsize < filesize

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Oct 17, 2019

I don't understand. The fix for #32673 was backported to 1.11 and 1.12. That means it is already there in 1.13. Your issue must be something else. Could you provide more details of how to reproduce this ?

@banishee

This comment has been minimized.

Copy link

@banishee banishee commented Oct 17, 2019

Its not work on the MacOS Catalina.
Try to rollback

@FUTC-Coding

This comment has been minimized.

Copy link

@FUTC-Coding FUTC-Coding commented Oct 21, 2019

I had the same problem, updated go with the newest version from the website and it worked again. Also on MacOS Catalina.

@joint-song

This comment was marked as resolved.

Copy link

@joint-song joint-song commented Oct 22, 2019

I hit this on bazel go test. After run bazel test, It produce an error with msg "dyld: malformed mach-o image: segment __DWARF has vmsize < filesize
Abort trap: 6".

I am not sure it's a problem of go or bazel. It can be reproduced both on Linux and macOS.

As for running Go env on mac:

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/XXX/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/XXX/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vy/1yxldnjd3_j1_rx77hmpg_lw0000gn/T/go-build972143009=/tmp/go-build -gno-record-gcc-switches -fno-common"
@agnivade

This comment was marked as resolved.

Copy link
Contributor

@agnivade agnivade commented Oct 22, 2019

@joint-song - I am not sure how you are getting this on Linux. This error is very specific to mac.

To all those facing this problem, please ensure you are on the latest 1.13 release, and provide the macOS version and a small reproducer that exhibits this problem. Thanks.

@joint-song

This comment was marked as resolved.

Copy link

@joint-song joint-song commented Oct 23, 2019

@joint-song - I am not sure how you are getting this on Linux. This error is very specific to mac.

To all those facing this problem, please ensure you are on the latest 1.13 release, and provide the macOS version and a small reproducer that exhibits this problem. Thanks.

@agnivade I am sorry. In my case, it should be my fault with code. All tests went through with PASS after one more time rerun. 😜

@adibrastegarnia

This comment has been minimized.

Copy link

@adibrastegarnia adibrastegarnia commented Oct 28, 2019

@agnivade
I have the same problem. My go version is 1.12.5 and yesterday, I upgraded my mac os to 10.15. I cannot upgrade to 1.13 at this moment because we are still using 1.12.X for a project.

To give you an idea, when I source .bashrc or try to run a go program, I am getting that error.

@adibrastegarnia

This comment has been minimized.

Copy link

@adibrastegarnia adibrastegarnia commented Oct 28, 2019

@agnivade
I don't think it is related to go version. The same error when I upgraded to go 1.13.3 as well on Mac os 10.15.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 28, 2019

Somebody please tell us how to reproduce this. Tell us precisely what you did. Tell us precisely what happened. Thanks.

@ianlancetaylor ianlancetaylor changed the title dyld: malformed mach-o image: segment __DWARF has vmsize < filesize cmd/linik: malformed mach-o image: segment __DWARF has vmsize < filesize Oct 28, 2019
@ianlancetaylor ianlancetaylor changed the title cmd/linik: malformed mach-o image: segment __DWARF has vmsize < filesize cmd/link: malformed mach-o image: segment __DWARF has vmsize < filesize Oct 28, 2019
@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Oct 28, 2019
@adibrastegarnia

This comment has been minimized.

Copy link

@adibrastegarnia adibrastegarnia commented Oct 28, 2019

Somebody please tell us how to reproduce this. Tell us precisely what you did. Tell us precisely what happened. Thanks.

I will do my best to explain but I did lots of things to make it work.

1- I removed my previous go version by deleting /usr/local/go and /etc/paths.d/go.
2- I installed the golang version 1.13.3 by copying it to /usr/local:
tar -C /usr/local -xzf go1.13.3.darwin-amd64.tar.gz

3- I have these lines in my .bashrc

export GOPATH=/Users/adibrastegarnia/go
export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go/
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
export GO111MODULE=on

When I tried to run source .bashrc that error happened.

I ended up installing the golang using the pkg installer and it looks normal now. To be honest, I don't know exactly at what conditions that error occurs but I know that is happened when I tried to install it using archive package.

Thanks,
Adib

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 28, 2019

If .bashrc contains only the export statements that you listed, I don't see any possible way that sourcing .bashrc could produce the error

dyld: malformed mach-o image: segment __DWARF has vmsize < filesize

We can only fix this problem if we have a way to reproduce this ourselves. Thanks.

(Separately, I recommend very strongly that you not set GOROOT in your .bashrc file. It is only necessary to set GOROOT under special and unusual circumstances. If some of our documentation recommended that you set GOROOT, please let us know, so that we can fix it. Thanks.)

@adibrastegarnia

This comment has been minimized.

Copy link

@adibrastegarnia adibrastegarnia commented Oct 28, 2019

If .bashrc contains only the export statements that you listed, I don't see any possible way that sourcing .bashrc could produce the error

dyld: malformed mach-o image: segment __DWARF has vmsize < filesize

We can only fix this problem if we have a way to reproduce this ourselves. Thanks.

(Separately, I recommend very strongly that you not set GOROOT in your .bashrc file. It is only necessary to set GOROOT under special and unusual circumstances. If some of our documentation recommended that you set GOROOT, please let us know, so that we can fix it. Thanks.)

I also have a auto-completion call for a go program in .bashrc. Thanks for your recommendation, I will consider it. If I encountered again, I will let you know.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 28, 2019

What program does the auto-completion call try to run? Exactly how was that program built? Thanks.

@adibrastegarnia

This comment has been minimized.

Copy link

@adibrastegarnia adibrastegarnia commented Oct 28, 2019

What program does the auto-completion call try to run? Exactly how was that program built? Thanks.

It just a go program which has a cli using cobra framework.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 29, 2019

Thanks, but that doesn't help tell us what we need to know.

We can only fix this problem if we have a way to reproduce this ourselves. Thanks.

@chaseWillden

This comment has been minimized.

Copy link

@chaseWillden chaseWillden commented Nov 1, 2019

Man I'm getting it too

@edjroz

This comment has been minimized.

Copy link

@edjroz edjroz commented Nov 2, 2019

I’m also receiving this error

@loodvn

This comment has been minimized.

Copy link

@loodvn loodvn commented Nov 4, 2019

Seems to have been fixed in 1.13.4: 26954bd (sorry, didn't know how to link this properly).

Discussion and closed issue: #32673

@networkimprov

This comment has been minimized.

Copy link

@networkimprov networkimprov commented Nov 4, 2019

That commit actually landed before 1.13 debuted.

@thanm

This comment has been minimized.

Copy link
Member

@thanm thanm commented Nov 13, 2019

@bolenzhang It would be nice if we could close this bug out -- any more to do / say here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.