Up to Main Index Up to Journal for May, 2018 JOURNAL FOR WEDNESDAY 23RD MAY, 2018 ______________________________________________________________________________ SUBJECT: Most ARM5 builds removed due to cross-compile gotcha ;( DATE: Thu 24 May 04:12:23 BST 2018 Friday evening I sat looking into my monitor, thinking about WolfMUD. What should I work on next? I was very tempted to try and squeeze in a few more changes before the next release. Knowing how last minute changes have turned out recently, I decided to just start packaging what I had. For the v0.0.9 release I wanted to include an ARM7 build, as I now had a Raspberry Pi 3 model B and could do some testing on real hardware. I already had a generic, soft float, ARM5 build and a hard float, ARM6 build. Both the ARM5 and ARM6 builds I test on a Raspberry Pi model B. I’m not sure exactly what I was doing — apart from editing, running and testing the release makefile and resulting builds — but I suddenly realised that cross-compiling for Arm had a nasty gotcha. As a result I’ve removed the broken ARM5 builds from the downloads section of the website. I’m not sure why they are not all broken, but v0.0.1, v0.0.2 and v0.0.7 seem to be okay. I think v0.0.1 and v0.0.2 were assembled by hand and I switched to a makefile for v0.0.3 — but that doesn’t explain v0.0.7 *shrug* If there is any demand I will rebuild the deleted ARM5 versions and make them available. The gotcha… When cross-compiling for Arm only one executable file is created. If you compile for ARM5 and then ARM6 the ARM5 binary will be overwritten by the ARM5 executable with the same name. For example, my bin directory looks like: |-- linux_386 | `-- server |-- linux_arm | `-- server |-- server |-- windows_386 | `-- server.exe `-- windows_amd64 `-- server.exe Notice that there is only one linux_arm directory. I’m guessing this is also the situation when compiling for 386 if you set GO386 or mips/mipsle if you set GOMIPS. It would be nice if the directory name included the GOARM, GO386 or GOMIPS setting in the directory name. Then we would get something like: |-- linux_386 | `-- server |-- linux_arm_5 | `-- server |-- linux_arm_6 | `-- server |-- server |-- windows_386 | `-- server.exe `-- windows_amd64 `-- server.exe Also notice the server executable that is not in a sub-directory. That is the native compile for the machine I am compiling on, which is linux/amd64. I have to be very careful if I run the release makefile on a Raspberry Pi as the executable would now be for linux/arm instead of linux/amd64. It should be noted that ‘go install’ does have an --installsuffix flag. If I set this to ‘5’ when compiling for ARM5 it causes the sub-directory under the ‘pkg’ directory to be named ‘linux_arm_5’, but it does not effect the ‘bin’ sub-directory which is still 'linux_arm'. Also of note, under the ‘pkg’ sub-directory there IS a ‘linux_amd64’ sub-directory for the native build, even though there is no such sub-directory under ‘bin’. Due to the limitations of my makefile, ugly hacks and workarounds I’ve not made it available. With a trusty copy of “Managing projects with make”[1] to hand, I’m now working on cleaning up the release makefile and fixing a number of issues. I’m even thinking of using GOHOSTOS and GOHOSTARCH to move the native executable into an appropriate sub-directory while also using GOARM to create appropriate linux_arm_X sub-directories. That way at least everything will be in an appropriate sub-directory. -- Diddymus [1] Managing projects with make, Andy Oram and Steve Talbott Published by O’Reilly Media, October 1991, ISBN-10: 0-937175-90-0 Up to Main Index Up to Journal for May, 2018