I wanted to try cross-compiling gotop for the Raspberry Pi 4 using my Windows 10 Laptop. It threw me an error (Yikes!):

It was getting late, and I needed to get some grilling done. So I decided instead (for now) to go get itbuild it, and install it on my Pi 4 and play with a simpler task: cross-compiling for the ARM processor.

Here’s gotop, showing load across 4 CPU Cores, memory, and process utilization. If you type the “?” operator it will show you the key bindings, and if you know vim, most of them will be familiar to you.

Now that I have gotop up and running (I hope to use it to see how loaded it gets using picamara in a VNC session), I’ll show the important parts of cross-compiling from Windows 10 to the Pi 4.

You may also like:
Cross-Compilation With Buildroot.

Here’s a simple hello world that we’ll cross-compile. I’ll call the file howdy.go:

The Pi 4 uses an ARM 7 processor, but you can check this by running the uname command.

Compile the sample howdy.go for Linux, specifying the ARM 7 processor:

Run it on your Pi 4, making sure the permissions are good to run it.

I hope you found this post both practical and interesting!

Further Reading

Source link

Write A Comment