Search code examples
gogithubnodesraspberry-pi4go-modules

Go Mod Download on Raspberry Pi4


Am running into a

cannot execute binary file: Exec format error

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?


Solution

  • 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 's/v0.0.0-20200107021104-147ed25f233e/v0.0.0-20220216073600-600054663ec1/' go.mod > aux_file
     pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release 
     pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release  sed 's/github.com\/wedeploy\/gosocketio v0.0.7-beta/github.com\/cih-y2k\/wedeploy-gosocketio v0.0.8/' aux_file > 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 ±  cp aux_file2 go.mod
     pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release ±  rm aux_file aux_file2
     pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release ±  go mod download github.com/cih-y2k/wedeploy-gosocketio
     pi@raspberrypi  ~/go/src/github.com/thetatoken/theta   release ± 
    

    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="arm"
    GOHOSTARCH="arm"