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/cgo: cannot parse _cgo_.o as ELF, Mach-O, PE or XCOFF on Windows #62236

Closed
Azaretdodo opened this issue Aug 23, 2023 · 5 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. OS-Windows

Comments

@Azaretdodo
Copy link

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

$ go version 1.20.7

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env windows amd64 

What did you do?

I was try to install go from the src folder from go paste on windows system32 with the script all.bat but i happen these two lines of errors below

cgo: cannot parse $WORK\b251\_cgo_.o as ELF, Mach-O, PE or XCOFF
go tool dist : FAILED: C:\Windows\System32\go1.20.7\pkg\tool\windows_amd64\go_bootstrap install std cmd: exit status 1

What did you expect to see?

The success of the installing of go with all.bat script

What did you see instead?

cgo: cannot parse $WORK\b251\_cgo_.o as ELF, Mach-O, PE or XCOFF
go tool dist : FAILED: C:\Windows\System32\go1.20.7\pkg\tool\windows_amd64\go_bootstrap install std cmd: exit status 1

@bcmills
Copy link
Contributor

bcmills commented Aug 23, 2023

Sounds like a problem with your C compiler or linker.

Please post the complete output of go env as requested in the issue template, and also include information about the C toolchain (gcc --version or similar).

@bcmills bcmills added OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 23, 2023
@bcmills bcmills changed the title cgo cannot parse _cgo_.o as ELF, Mach-O, PE or XCOFF and go tool dist FAILED go_bootstrap install std cmd exit status 1 cmd/cgo: cannot parse _cgo_.o as ELF, Mach-O, PE or XCOFF on Windows Aug 23, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 23, 2023
@Azaretdodo
Copy link
Author

hello dear worker in IT,

maybe the problem when by the setup because go env answer a problem :

PS C:\Windows\System32\go1.20.7\src> go env
go: cannot find GOROOT directory: C:\Windows\System32\go1.20.7\bin\go.exe

so i am on the system windows 64 byte and use only msys for compile thus i paste below the variable use by go and the c compiler :

image

thanks you in advance for your help,

Regards.

Azaretdodo.

@bcmills
Copy link
Contributor

bcmills commented Aug 23, 2023

Yeah, that's not going to work. GOROOT and GOPATH do not mean what you seem to think they mean. You should not need to set either of those explicitly, no matter where you install the Go toolchain.

I suggest unsetting both of those variables and reading through https://go.dev/doc/code to familiarize yourself with the Go development workflow.

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 23, 2023
@Azaretdodo
Copy link
Author

you are just bad because goroot is always in windows => system32 for windows and gopath is always in the directory user for both system after for the documentation go it is always bugged because sometimes it is helping finaly i think you answer aside the meaning of the problem,

thanks you in advance to really help myself,

Regards.

Azaretdodo.

@bcmills
Copy link
Contributor

bcmills commented Aug 24, 2023

I'm sorry, I can't really parse that reply. 😅

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For asking questions, see:

Stack Overflow with questions tagged "go" or "golang"

The Go Forum, a web-based forum

Gophers Discord "Get live support and talk with other gophers on the Go Discord"

Gophers Slack, use the invite app for access. The #general channel is a good starting point.

Go Community on Hashnode with questions and posts tagged with "go"

The golang-nuts mailing list

Subreddit for Go

IRC channel #go-nuts on Libera

@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2023
@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 24, 2023
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. OS-Windows
Projects
None yet
Development

No branches or pull requests

3 participants