[Haskell-cafe] Building cross compiler fails

Jon Schneider haskell at jschneider.net
Tue Oct 14 12:23:17 UTC 2014


I am after a ghc cross compiler. I have been cross compiling stuff for
years and also built cross-compiling gcc from time to time but am having
trouble building a cross-compiling ghc.

I have read https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation and
associated pages.

In the ghc-7.8.3 directory I do
./configure --target=arm-linux-gnueabi -with-gcc=arm-linux-gnueabi-gcc

but make eventually fails (in stage 1)

configure: error: in `/home/jon/build/ghc-7.8.3/libraries/terminfo':
configure:3386: arm-linux-gnueabi-gcc -o conftest  -fno-stack-protector
conftest.c -lncurses   >&5
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld:
cannot find -lncurses

Firstly the requirement for termcap is surely unnecessary. We don't need
it as the target will just be processing data.

We do have an libncurses kicking about and I know _exactly_ what -L option
to pass to (in this case) arm-linux-gnueabi-gcc to make this work but
where to specify it to ghc's build system escapes me.

I have tried setting CFLAGS, LDFLAGS, CONF_GCC_LINKER_OPTS_STAGE1 the
configure commandline and also mk/build.mk .

>From searching it is clear this has tripped people up time and time again
and that there is something missing from the documentation.

So in summary please could
https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation be updated to show
where to specify the CFLAGS and LDFLAGS that should accompany the compiler
specified with -with-gcc (or derived from --target).

Also more generally could the build documentation show how to omit frills
like curses and termcap if at all possible.

Jon



More information about the Haskell-Cafe mailing list