在Raspberry Pi4上进行Go Mod下载

huangapple go评论96阅读模式
英文:

Go Mod Download on Raspberry Pi4

问题

我在运行以下命令时遇到了“无法执行二进制文件: 执行格式错误”的问题:

go mod download github.com/cih-y2k/wedeploy-gosocketio

https://github.com/kuoyaoming93/guardian-mainnet-guide/blob/master/docs/COMPILE_ARM64.md#install-guardian-node-from-source-code

我已经删除并重新下载了必要的目录,但问题仍未解决。

这是否意味着我需要下载另一种语言才能执行该文件?

谢谢!

英文:

Am running into a "cannot execute binary file: Exec format error" when running the following command from the below repository:

go mod download github.com/cih-y2k/wedeploy-gosocketio

<https://github.com/kuoyaoming93/guardian-mainnet-guide/blob/master/docs/COMPILE_ARM64.md#install-guardian-node-from-source-code>

Have deleted and re-downloaded the necessary directories, wasn't the solution.

Does this mean I need to download another language for this file to execute?

Thank you!

答案1

得分: 2

我的建议是按照提到的所有步骤来使用arm64架构的theta,否则你可能会使用来自其他架构(如amd64)的二进制文件。

我在我的树莓派上进行了快速检查,没有报告任何问题,因为go.mod文件已被替换为一个带有正确分支的新文件。

最后,cannot execute binary file: Exec format error表示你正在使用与当前主机架构不匹配的二进制文件,即arm64

 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  sed &#39;s/v0.0.0-20200107021104-147ed25f233e/v0.0.0-20220216073600-600054663ec1/&#39; go.mod &gt; aux_file
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release 
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  sed &#39;s/github.com\/wedeploy\/gosocketio v0.0.7-beta/github.com\/cih-y2k\/wedeploy-gosocketio v0.0.8/&#39; aux_file &gt; aux_file2
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release 
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  rm go.mod
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177;  cp aux_file2 go.mod
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177;  rm aux_file aux_file2
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177;  go mod download github.com/cih-y2k/wedeploy-gosocketio
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177; 

由于树莓派是基于Linux的,你可以使用以下命令来验证架构:

pi@raspberrypi  ~  arch ; uname -m
armv6l
armv6l

还应该检查Go环境:

pi@raspberrypi  ~  go env | grep -i ARCH
GOARCH=&quot;arm&quot;
GOHOSTARCH=&quot;arm&quot;
英文:

My recommendation is to follow all the steps mentioned to use theta with arm64, otherwise you could be using the binaries from another arch like amd64.

I did a quick check in my raspberry and no problem reported, since the go.mod file has been replaced. with a new one with correct branches.

Finally, cannot execute binary file: Exec format error means that you are using binaries that doesn't match with the current host architecture, in this case arm64.

 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  sed &#39;s/v0.0.0-20200107021104-147ed25f233e/v0.0.0-20220216073600-600054663ec1/&#39; go.mod &gt; aux_file
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release 
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  sed &#39;s/github.com\/wedeploy\/gosocketio v0.0.7-beta/github.com\/cih-y2k\/wedeploy-gosocketio v0.0.8/&#39; aux_file &gt; aux_file2
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release 
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  rm go.mod
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177;  cp aux_file2 go.mod
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177;  rm aux_file aux_file2
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177;  go mod download github.com/cih-y2k/wedeploy-gosocketio
 pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release &#177; 

Since raspberry is Linux based you can use the following to verify the arch:

pi@raspberrypi  ~  arch ; uname -m
armv6l
armv6l

Go Env is also a check you should do:

pi@raspberrypi  ~  go env | grep -i ARCH
GOARCH=&quot;arm&quot;
GOHOSTARCH=&quot;arm&quot;

huangapple
  • 本文由 发表于 2022年8月15日 02:37:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/73354242.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定