
I've shifted my attempts to cross-compile to the 7.6.2 sources. Here
I'm having better success with the instructions at
http://hackage.haskell.org/trac/ghc/wiki/Building/CrossCompiling, though
it still takes some fiddling and in the end I am still getting stuck.
To refresh, I'm trying to bootstrap from a working ghc (now I have 7.6.2
installed on the host) on a typical Linux 686 host system, glibc-based,
to get a ghc that can be installed on a similar target system, differing
in that it uses uclibc instead of glibc.
I have a working cross-compiler, and seem to have everything else I need
to have installed on my host. I did have to make sure that my
cross-compiler tree had gmp and libiconv and ncurses installed in it.
I also had to edit the file /usr/lib/ghc-7.6.2/include/ghcautoconf.h
on my host system. This was #defining _FILE_OFFSET_BITS to 64, but the
uclibc on my target system wasn't compiled with large file support,
hence I thought the uclibc in my cross-compiler toolchain shouldn't be
either. But then that #define in the host's ghcautoconf.h was
conflicting. So I just commented it out for the time being.
Here's what I've done, on the host, from a clean detar of the ghc 7.6.2
sources.
I made this change at three locations in ghc's topmost
configure script, to get it to recognize my cross-compiler tag
"i686-buildroot-linux-uclibc":
case "$build_vendor" in
- pc|gentoo) # like i686-pc-linux-gnu and i686-gentoo-freebsd8
+ pc|gentoo|buildroot) # like i686-pc-linux-gnu and
i686-gentoo-freebsd8
BuildVendor="unknown"
;;
(The other two locations are for $host_vendor and $target_vendor. Maybe
it's only necessary to do this for $target_vendor.)
Next, here is my mk/build.mk file:
# Fast build with optimised libraries, no profiling (RECOMMENDED):
BuildFlavour = quick
...
# An unregisterised, optimised build of ghc, for porting:
# BuildFlavour = unreg
...
The rest as in mk/build.mk.sample
Next, I had to make this patch to libraries/haskeline/cbits/h_wcwidth.c,
else I would get errors about types like size_t not being recognized. (I
forget the exact error.)
@@ -59,6 +59,7 @@
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
*/
+#include