So, building GCC and glibc.

In short, I have given up trying to build GCC and glibc.

I spent ten weeks trying. It can’t be done out-of-the-box, because the build system is much more complex than its documentation, and it may also be the build system is actually does not work out-of-the-box, and requires significant source code / build system modification to work, where those modifications most likely vary by GCC and glibc version, and are themselves undocumented.

The benefit of building glibc is that it allows the building of the various versions of pthreads, where the benchmark app benchmarks the locking mechanisms in pthreads.

I can however build GCC now, on its own, so I’ve been getting on with this. This allows the makefile to be checked (I’ve already seen I’m now using GCC options which early GCCs don’t know about) and will allow me to run test and benchmark.

Building GCC on the dev boards is quite time consuming. They only have 1 GB of RAM, so I an only run make -j 1, because the boards although they have more cores run out of memory with more parallel builds (well, at least with later GCCs, which have more complex builds; earlier GCCs get away with more).

It took twelve hours to build GCC 6.2.0 on my PINE64 :-)

I had quite a few problems with the CI20 dev board – but in part I think this was due to running out of store (I was running with -j 4, then -j 2, and now -j 1, same as the other boards) and in part I suspect because if the CPUs are running flat out, the board can freeze up – adding “nice” to the make for configure seemed to help…)

So this leaves me now building GCCs.

The baseline is a pre 4.7.3 and a post 4.7.3 on each platform. The native compiler is 4.9.2 (they’re all running debian 8, oddly enough) but on the PINE64 this compiler doens’t understand -march=native – but I want the same GCC, from the same build process, on each machine anyway.

So far, I have achieved this on x86_64 (my laptop). 4.2.0 is built, as is 4.9.2 and 5.2.0.

On the PINE64, aarch64, support for the platform arrived with GCC 4.8.0. I’ve built 4.9.2 and 6.2.0 successfully.

On the Pi 2, running arm, complete failure so far. I’ve tried building the latest point release for every GCC prior to 4.7.3 and they ALL fail, for different reasons.

4.9.2 also fails, as does 5.2.0, because of a bug in libgmp.

It looks like I’m going to have to do some real hacking on the arm platform to make a GCC, even on its own.

On the CI20, MIPS32, I’ve tried 4.2.0 and 4.2.4 and they both failed, I think due to changes in signal handling, such that later GCCs can no longer compiler these earlier versions (header file incompatibilities).

Another three builds are currently running – let’s see how it goes.

Oh – I emailed (together) the GCC and glibc help mailing lists, explaining what I wanted to do, and asked for help.

In glibc 2.25 there seems now to be a script for building glibc, which may help – but I’m too emotionally antagonistic toward this task now to continue down that route.

One other guy pointed out about NetBSD “pkgsrc”, a way to get hold of working portable source.

But that was it. No other help. People either didn’t know, or were wisely steering clear of someone else’s tar-pit which would be problematic to help with from the outside.