Sun Dec 3 19:53:12 EST 2017
lxc + qemu armhf vm with ghc
Let's try a static hello world program.
Compiles but doesn't run properly; likely needs libs still.
So basically, GHC needs a different C library, or the C library needs
to go on the target.
Let's try to build a cross-ghc.
It needs gold. Does buildroot support gold?
--enable-gold in buildroot's binutils options
Got it this far:
Module `GHC.Conc' does not export `getAllocationCounter'
Probably best to compile haskell with the same version, and use a more
git checkout ghc-8.0
git submodule update --init
checking for arm-linux-gcc option to accept ISO C99... unsupported
configure: error: C99-compatible compiler needed
tried 8.2 and 8.4
Looking at config.log:
configure:6274: checking for arm-linux-gcc option to accept ISO C99
configure:6423: arm-linux-gcc -std=gnu99 -c -g -O2 conftest.c >&5
conftest.c:67:9: error: unknown type name 'wchar_t'
const wchar_t *name;
I did see somewhere a variable to enable this.
Toolchain -> Enable WCHAR support
Ok it gets past this, but then runs into trouble here:
checking for ld bug 16177... affected
configure: error: Your linker is affected by binutils #16177, which
critically breaks linkage of GHC objects. Please either upgrade
binutils or supply a different linker with the LD environment
Going from 2.26.1 to 2.27
Not clear if that will fix it.
Nope won't fix it.
The configure script checks the bug's effect, not the version.
Latest version is 2.29.1
Let's see which is the latest version in buildroot.
2.29.1 is available in current head
Author: Guo Ren <firstname.lastname@example.org>
Date: Thu Mar 23 18:46:14 2017 +0800
Author: Bernd Kuhls <email@example.com>
Date: Sun Dec 3 20:41:40 2017 +0100
2.29.1 still has the problem
I guess there is no way around this until it gets fixed.
Unfortunately, things are still broken with BFD ld due to ld bug 16177
(https://sourceware.org/bugzilla/show_bug.cgi?id=16177) wherein ld
inexplicably generates R_ARM_COPY relocations where a standard
R_ARM_ABS32 relocation would do just fine (as gold does). Sadly,
despite the bug being reported two months ago, there has been no
activity from the ld side. For now I suspect we'll just have to advise
users to use gold on ARM.
How to use gold?
"...supply a different linker with the LD environment variable"
# apt-get install ghc happy alex
# cd $(dirname $0)/ghc
cat <<EOF >mk/build.mk
./configure --target=arm-linux && make -j24
"make -j24" gave problems
trying just make
Nope.. I tried a lot of permutations but all of them fail some way or
other. There has to be some tutorial on how to compile this, and what
versions to use.
This mentions a couple of patches and a different libffi version: