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
Labels
FrozenDueToAge 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

@bolenzhang
Copy link

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

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 ?

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 17, 2019
@banishee
Copy link

Its not work on the MacOS Catalina.
Try to rollback

@FUTC-Coding
Copy link

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 has been minimized.

@agnivade

This comment has been minimized.

@joint-song

This comment has been minimized.

@adibrastegarnia
Copy link

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

@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

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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin labels Oct 28, 2019
@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Oct 28, 2019
@adibrastegarnia
Copy link

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

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 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

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

@adibrastegarnia
Copy link

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

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

Man I'm getting it too

@edjroz
Copy link

edjroz commented Nov 2, 2019

I’m also receiving this error

@loodvn
Copy link

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 commented Nov 4, 2019

That commit actually landed before 1.13 debuted.

@thanm
Copy link
Contributor

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

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.)

@xt0fer
Copy link

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
Contributor

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 commented Dec 18, 2019

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

@networkimprov
Copy link

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
Contributor

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 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
Contributor

thanm commented Dec 18, 2019

OK, thanks for confirming that.

@itsmontoya
Copy link

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
Contributor

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
Contributor

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 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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
None yet
Development

No branches or pull requests