[<<][haskell][>>][..]
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:

compiler/main/ErrUtils.hs:63:27:
    Module `GHC.Conc' does not export `getAllocationCounter'

Probably best to compile haskell with the same version, and use a more
recent one.



git checkout ghc-8.0
git submodule update --init


stuck here:

checking for arm-linux-gcc option to accept ISO C99... unsupported
configure: error: C99-compatible compiler needed

tried 8.2 and 8.4

fucking mess

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
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_USE_WCHAR=y

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
               variable.

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

Was at:

commit 54242226f034c1245d379df5f98cefcc13553437
Author: Guo Ren <ren_guo@c-sky.com>
Date:   Thu Mar 23 18:46:14 2017 +0800

Switching to:

commit cbb50827f6334dab4c4a4922a2a5ae37380d812b
Author: Bernd Kuhls <bernd.kuhls@t-online.de>
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.

https://ghc.haskell.org/trac/ghc/ticket/4210

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"


Trying this:

#!/bin/sh
# apt-get install ghc happy alex
# cd $(dirname $0)/ghc
PATH=~/exo/br/target/bbb/host/usr/bin:$PATH
export PATH
cat <<EOF >mk/build.mk
HADDOCK_DOCS=NO
EOF
export LD=arm-linux-ld.gold
./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:
https://medium.com/@zw3rk/a-haskell-cross-compiler-for-raspberry-pi-ddd9d41ced94




[Reply][About]
[<<][haskell][>>][..]