GHC 4.08.2 on OpenBSD 2.9, almost

Simon Marlow simonmar@microsoft.com
Mon, 18 Mar 2002 10:00:47 -0000


>     I'm trying to port any recent version of ghc to OpenBSD 2.9.
>   =20
>     I have, with a little bit of work, been able to compile 4.08.2
>     from .hc sources.
>   =20
>     I now get the following kind of undefined symbol errors:
>=20
>         Main.o: Undefined symbol `__init_Prelude' referenced from text
>         segment
>         Main.o: Undefined symbol `PrelBase_unpackCStringzh_closure'
>         referenced from text segment
>         Main.o: Undefined symbol `PrelIO_putStr_closure'=20
> referenced from
>         text segment
>=20
>             [ ... ]
>=20
>         PrelMain__1.o: Undefined symbol `___init_Main'=20
> referenced from text
>         segment
>         .o::PrelMain(void): Undefined symbol=20
> `_Main_main_closure' referenced
>         from text segment
>         .o::PrelMain(void): Undefined symbol=20
> `_Main_main_closure' referenced
>         from text segment
>=20
>     My guess is that this kind of thing has happened before=20
> ... is there
>     an area in the source I should be looking at?

This looks suspiciously like a mismatch in the handling of leading
underscores in symbol names somewhere.  It appears from the messages
above that Main.o doesn't have extra leading underscores on its symbols,
but the libraries do.  Perhaps Main.o was compiled by the native code
generator?  Because the leading-underscore setting is compiled into the
compiler via an external setting, you'll need to bootstrap the compiler
before the setting will be correct for your system.

Try compiling your test program with -fvia-C.

Cheers,
	Simon