Go to the first, previous, next, last section, table of contents.

Linking and consistency-checking

GHC has to link your code with various libraries, possibly including: user-supplied, GHC-supplied, and system-supplied (`-lm' math library, for example).

`-l<FOO>':
Link in a library named `lib<FOO>.a' which resides somewhere on the library directories path. Because of the sad state of most UNIX linkers, the order of such options does matter. Thus: `ghc -lbar *.o' is almost certainly wrong, because it will search `libbar.a' before it has collected unresolved symbols from the `*.o' files. `ghc *.o -lbar' is probably better. The linker will of course be informed about some GHC-supplied libraries automatically; these are:
-l equivalent     description                                 
------------------------------------------------------------
-lHSrts,-lHSclib  basic runtime libraries                     
-lHS              standard Prelude library                    
-lgmp             GNU multi-precision library (for Integers)  
`-syslib <name>':
If you are using an optional GHC-supplied library (e.g., the HBC library), just use the `-syslib hbc' option, and the correct code should be linked in. Please see section See section System libraries for information about optional GHC-supplied libraries.
`-L<dir>':
Where to find user-supplied libraries... Prepend the directory `<dir>' to the library directories path.
`-static':
Tell the linker to avoid shared libraries.
`-no-link-chk' and `-link-chk':
By default, immediately after linking an executable, GHC verifies that the pieces that went into it were compiled with compatible flags; a "consistency check". (This is to avoid mysterious failures caused by non-meshing of incompatibly-compiled programs; e.g., if one `.o' file was compiled for a parallel machine and the others weren't.) You may turn off this check with `-no-link-chk'. You can turn it (back) on with `-link-chk' (the default).


Go to the first, previous, next, last section, table of contents.