Up to Main Index                          Up to Journal for November, 2024

                    JOURNAL FOR SUNDAY 10TH NOVEMBER, 2024
______________________________________________________________________________

SUBJECT: Building the Go toolchain on Raspberry Pi
   DATE: Sun 10 Nov 21:39:50 GMT 2024

For Halloween this year I decided to do something different and wrote “The
Long Dark”[1] as an experiment in writing with AI collaboration. I expected
some people to like it, and others not. However, most of the comments were
instead about the AI attribution I provided :|

The comments can be summarised as “You don’t cite your spellchecker, thesaurus
or text editor. Why cite the AI tools?”. A good question, to which I do not
have a good answer :( The only answer I have is that it is expected that you
cite the use of AI tools…

I guess I’ll get a similar reaction for “The Forgotten Page” on the 404 page
/not-found.html once people find it :P

Moving swiftly on to other matters…

Since Halloween, I have been spending a lot of time building the Go toolchain
on my various Raspberry Pi models. The toolchain being the Go compiler itself
and associated tools and libraries. In particular I’ve focused on building the
toolchain on a Raspberry Pi Zero W — which takes up to 6 hours. I also took
the opportunity to update my guide[2] on the process, found in the annex.

Building the Go toolchain on multiple Raspberry Pi can be quite challenging.
Depending on the model you have to deal with limited memory, slow CPUs,
wearing out SDCards, different ARM architectures, 64-bit vs 32-bit.

To start with I was building Go 1.23.2, just as I was about to publish the
updated guide, Go 1.23.3 dropped and I had to start over :(

Some things I learned during the process…

Building Go on a Raspberry Pi 4 running a 32-bit Raspberry Pi OS has issues. I
think the failure is due to a 64-bit CPU running a 64-bit kernel with a 32-bit
userland. However, this is a typical setup for Raspberry Pi OS. The problem is
the Go compiler sees the 64-bit CPU/kernel and then creates 64-bit binaries
which will not run in 32-bit userland.

Go 1.23 has also added tests for vDSO (virtual dynamic shared object) usage.
The new tests fail on a Raspberry Pi 4 running a 64-bit kernel with a 32-bit
useland. I suspect this is due to similar 64/32-bit reasons.

For details on resolving both of these issues see the guide.

Neither of these problems are present on a Raspberry Pi 4 running a 64-bit OS.
They are also not present on a Raspberry Pi 3 or Zero running a 32-bit OS.
It’s a good thing I have multiple Raspberry Pi with differing configurations.

On a positive note, recent versions of Go seem to require a lot less memory
during the build process.

Building the Go toolchain on multiple Raspberry Pi is more than just an idle
exercise. I use them for testing my code under different environments. For
example, finding 64/32-bit issues - especially in my Mere/Mote projects. They
are good for performance testing. Being relatively slow machines, performance
changes are amplified and easier to detect.

--
Diddymus

  [1] Journal for Thursday 31st October, 2024; An eerie something for
      Halloween: ../10/31.html

  [2] Building the go toolchain from source on a Raspberry Pi Zero:
      /annex/building-go-on-rpi.html



  Up to Main Index                          Up to Journal for November, 2024