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

Closed
bolenzhang opened this issue Oct 16, 2019 · 32 comments
Closed

cmd/link: malformed mach-o image: segment __DWARF has vmsize < filesize #34935

bolenzhang opened this issue Oct 16, 2019 · 32 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
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
Copy link

@banishee banishee commented Oct 17, 2019

Its not work on the MacOS Catalina.
Try to rollback

@FUTC-Coding
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.

@agnivade

This comment was marked as resolved.

@joint-song

This comment was marked as resolved.

@adibrastegarnia
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
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
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
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
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
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
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
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
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
Copy link

@chaseWillden chaseWillden commented Nov 1, 2019

Man I'm getting it too

@edjroz
Copy link

@edjroz edjroz commented Nov 2, 2019

I’m also receiving this error

@loodvn
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
Copy link

@networkimprov networkimprov commented Nov 4, 2019

That commit actually landed before 1.13 debuted.

@thanm
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?

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 17, 2019

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 Nov 17, 2019
@xt0fer
Copy link

@xt0fer xt0fer commented Dec 18, 2019

I hit this trying to use a executable from this repo: https://github.com/kyleconroy/sqlc.git
Inside of the project, cd cmd/sqlc; go build; ./sqlc

dyld: malformed mach-o image: segment __DWARF has vmsize < filesize
Abort trap: 6
@thanm
Copy link
Member

@thanm thanm commented Dec 18, 2019

Hi @xt0fer , this issue is closed -- if you are still seeing problems, please open a new issue, including details on how to reproduce (go version, etc). As mentioned previously this should have been fixed in Go 1.13.

@xt0fer
Copy link

@xt0fer xt0fer commented Dec 18, 2019

yeah, I should have mentioned this result was using... 1.13.5

@networkimprov
Copy link

@networkimprov networkimprov commented Dec 18, 2019

Erm, @thanm the issue closed due to "waiting for info" and @xt0fer just posted a possible reproducer; I think it could be reopened.

@thanm
Copy link
Member

@thanm thanm commented Dec 18, 2019

Erm, @thanm the issue closed due to "waiting for info" and @xt0fer just posted a possible reproducer; I think it could be reopened.

OK, I built a fresh copy of Go from the go1.13 release branch on my macbook, downloaded github.com/kyleconroy/sqlc, did "cd cmd/sqlc; go build; ./sqlc", and I don't see this issue (I just get a usage message). Anything else that I am missing? My machine is running 10.14.6.

@xt0fer
Copy link

@xt0fer xt0fer commented Dec 18, 2019

Negative; I was (damn brew) still managing to compile with 1.12.1 here, when I thought I was using 1.13.5 over there. I was able to compile and run fine via 1.13.5. I believe the issue closed and fixed.

@thanm
Copy link
Member

@thanm thanm commented Dec 18, 2019

OK, thanks for confirming that.

@itsmontoya
Copy link

@itsmontoya itsmontoya commented Feb 14, 2020

One of my F/E Engineers are receiving this issue on both 1.12.5 and 1.13.8. Should I have him roll back to 1.13.5?

@thanm
Copy link
Member

@thanm thanm commented Feb 14, 2020

@itsmontoya the fix for this problem has been in Go1.13 since 1.13.1 -- can you please verify that you are indeed using the correct version? Several other folks have posted similarly and in each case the problem was a stale Go version. Thanks.

@thanm
Copy link
Member

@thanm thanm commented Feb 14, 2020

I should add that Go 1.12.5 does not contain the release for this bug, you will need Go 1.12.7 or later.

@buihdk
Copy link

@buihdk buihdk commented Apr 30, 2020

I still encountered this issue in the Go newest version v1.14.2. I posted an issue here, could someone please check? #38765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.