Up to Main Index                              Up to Journal for July, 2018

                     JOURNAL FOR SATURDAY 21ST JULY, 2018
______________________________________________________________________________

SUBJECT: Inconsistencies in Go’s build system
   DATE: Sat 21 Jul 04:41:38 BST 2018

Brain fart, just realised I’ve been compiling for ARMv5 on the Raspberry Pi
Zero when I should have been using ARMv6. Recompiling Go from source again as
I can’t remember if I overrode the GOARM setting or not, only takes an hour or
two *sigh*

On the Pi 3 and Pi Zero I’ve pointed GOCACHE to ‘/tmp’ which is on tmpfs. This
is to minimise writes to the SD Card, but means the cache is blown away after
a reboot. This is causing a slight problem, more so on the Pi Zero.

For an initial, native ‘go install’ setting --installsuffix="6" causes a
rebuild of parts of the standard library. This is a pain as it takes the first
compile nearly 3 minutes to complete on the Pi Zero. A native ‘go install’
without setting --installisuffix="6" does not rebuild any of the standard
library and results in an initial compile time of 40 seconds. Subsequent
compiles for changes are typically between 10 and 25 seconds, depending on
what changed. This is expected as --installisuffix keeps the output separate
from default builds.

I really love Go, but I really hate the way Go’s build system treats native
and foreign (cross-compiles) differently. I also hate the way it doesn’t
differentiate between ARMv5, ARMv6 and ARMv7 builds. If native builds ended up
in sub-directories of bin like cross-compiles, and sub-architectures were
split into GOOS_GOARCH_GOARM, GOOS_GOARCH_GO386 or GOOS_GOARCH_GOMIPS I’d be a
very happy bunny.

Am I the only one having this problem?

The ‘normal’ situation, if I just let Go do its thing is:


  Compiling on AMD64:

    bin
    |-- server        <-- AMD64 executable
    `-- linux_arm
        `-- server    <-- ARMv5, ARMv6, ARMv7 overwrite each other

  Compiling on ARM:

    bin
    |-- server        <-- ARMv5, ARMv6, ARMv7 overwrite each other
    `-- linux_amd64
        `-- server    <-- AMD64 executable


What I want to have, irrespective of compiling on ARM or AMD64, is:


    bin
    |-- server        <-- Native executable
    |-- linux_amd64
    |   `-- server
    |-- linux_arm_5
    |   `-- server
    |-- linux_arm_6
    |   `-- server
    `-- linux_arm_7
        `-- server


There are also linux_386, windows_386 and windows_amd64 directories. However,
as I am always cross-compiling for those architectures they already stay the
same on ARM and AMD64 systems.

So, I’ve been looking at my makefile again and making some improvements. I
think I’m nearly there. Having a consistent bin directory structure will allow
me to simplify the release script and have it consistent across architectures.

--
Diddymus


  Up to Main Index                              Up to Journal for July, 2018