exec格式错误 [英] exec format error
问题描述
我最近在我的电脑上安装了lubuntu 11.04.遵循本指南中的有关从源代码安装go的说明,在我的PC上安装golang很好.为了测试我的安装,我跑了hello.go并得到了这个错误:
I recently installed lubuntu 11.04 on my pc. Following this guide on installing go from source, installing golang on my pc went well. To test my installation, I ran hello.go and got this error:
fork/exec /tmp/go-build748212890/command-line-arguments/_obj/a.out: exec format error
我在google上进行了查找,发现的更相关的结果之一是删除了该软件包,然后再次重新安装.那没有帮助.
I looked it up on google, and one of the more relevant results that I found said to remove the package, then reinstall again. That did not help.
您能告诉我是什么导致了此错误,以及如何解决此问题?
Can you tell me what is causing this error, and how I can fix this?
谢谢,祝你有美好的一天!
Thanks, and have a nice day!
推荐答案
我遇到了这个问题-这很简单:我将$ GOOS设置为要测试的操作系统以外的其他操作系统.您无法进行跨平台测试.因此,对于"go test",不要设置$ GOOS.我很确定您收到的"Exec格式错误"是尝试在错误的体系结构/操作系统上执行某些操作的go测试的结果.
I had this problem - it was very simple: I had set $GOOS to something other than the OS I was testing on. You can't do cross-platform testing. So for "go test", don't set $GOOS. I'm pretty sure the "Exec format error" you got was a result of go test trying to execute something on the wrong architecture/OS.
这篇关于exec格式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!