Changes between Version 5 and Version 6 of Building/FAQ


Ignore:
Timestamp:
Mar 10, 2009 12:06:51 PM (5 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Building/FAQ

    v5 v6  
    1 [[PageOutline]] 
    2  
    3 = Frequently asked questions about building GHC = 
    4  
    5 This page collects questions and advice about building GHC from source.  It is particularly prone to going out of date.  Please help keep it relevant and accurate.  At the moment it's fairly un-structured; please feel free to add structure if that'd make it easier to follow. 
    6  
    7 Platform-specific guidance belongs under one of the platform-specific help pages linked from the [wiki:Building Building guide contents page]. 
    8  
    9  
    10 == Space in TMPDIR == 
    11  
    12 One difficulty that comes up from time to time is running out of space 
    13 in {{{TMPDIR}}}.  (It is impossible for the configuration stuff to 
    14 compensate for the vagaries of different sysadmin approaches to temp 
    15 space.) 
    16  
    17 The quickest way around it is {{{setenv TMPDIR /usr/tmp}}} or 
    18 even {{{setenv TMPDIR .}}} (or the equivalent incantation with your shell 
    19 of choice). 
    20  
    21 The best way around it is to say 
    22 {{{ 
    23 export TMPDIR=<dir> 
    24 }}} 
    25 in your {{{build.mk}}} file.  Then GHC and the other 
    26 tools will use the appropriate directory in all cases. 
    27  
    28  
    29 == Warning "warning: assignment from incompatible pointer type" == 
    30  
    31 You may occasionally see a warning from the C compiler when compiling some 
    32 Haskell code, eg. "warning: assignment from 
    33 incompatible pointer type".  These are usually harmless, but it's a good idea to 
    34 report it on the mailing list so that we can fix it. 
    35  
    36 == Warning "ar: filename `GlaIOMonad__1_2s.o` truncated to `GlaIOMonad_`" == 
    37  
    38 Similarly, {{{ar}}}chiving warning messages like the following are not a problem: 
    39 {{{ 
    40 ar: filename GlaIOMonad__1_2s.o truncated to GlaIOMonad_ 
    41 ar: filename GlaIOMonad__2_2s.o truncated to GlaIOMonad_ 
    42 ... 
    43 }}} 
    44  
    45 == GCC 4 issues == 
    46  
    47 It has been observed on Gentoo systems that GCC 4 may fail, complaining about there being no {{{-nopie}}} option. You can either use GCC 3, re-emerge ghc or just edit your {{{/usr/bin/ghc}}} script to remove the {{{-nopie}}} flag (the latter is by far the quickest and is perfectly safe). 
    48  
    49 == Cpp variations == 
    50  
    51 GHC's sources go through {{{cpp}}} before being compiled, and {{{cpp}}} varies 
    52 a bit from one Unix to another.  One particular gotcha is macro calls 
    53 like this: 
    54 {{{ 
    55 SLIT("Hello, world") 
    56 }}} 
    57 Some {{{cpp}}}s treat the comma inside the string as separating two macro 
    58 arguments, so you get 
    59 {{{ 
    60 :731: macro `SLIT' used with too many (2) args 
    61 }}} 
    62 Alas, {{{cpp}}} doesn't tell you the offending file! 
    63 Workaround: don't put weird things in string args to {{{cpp}}} macros. 
    64  
    65  
    66 == Cabal/Distribution/Compat/FilePath.hs: No such file or directory == 
    67  
    68 You may see this: 
    69   {{{ 
    70 Distribution/Compat/FilePath.hs:2:  
    71   error: Cabal/Distribution/Compat/FilePath.hs: No such file or directory 
    72 make[1]: *** [depend] Error 1 
    73 make: *** [stage1] Error 1 
    74   }}} 
    75 '''Possible Solution''':: 
    76 Be sure you have run {{{sh darcs-all get}}} to get all necessary packages. Don't forget to run {{{sh boot}}} again after you pull in new packages. 
    77  
    78 == xargs: /usr/bin/ar: terminated by signal 11 == 
    79  
    80 You may see this when compiling libraries: 
    81 {{{ 
    82 (echo Control/Concurrent_stub.o System/CPUTime_hsc.o System/Time_hsc.o ; 
    83 /usr/bin/find Control/Applicative_split Control/Arrow_split 
    84 Control/Concurrent_split Control/Concurrent/Chan_split  
    85    ...long mess... 
    86 Text/PrettyPrint/HughesPJ_split Text/Printf_split Text/Read_split 
    87 Text/Read/Lex_split Text/Show_split Text/Show/Functions_split -name '*.o' 
    88 -print) | xargs /usr/bin/ar q libHSbase.a 
    89 /usr/bin/ar: creating libHSbase.a 
    90 xargs: /usr/bin/ar: terminated by signal 11 
    91 make[2]: *** [libHSbase.a] Error 125 
    92 make[2]: *** Deleting file `libHSbase.a' 
    93 make[1]: *** [all] Error 1 
    94 }}} 
    95 What is happening is that the ghc build system is linking thousands and 
    96 thousands of tiny .o files into `libHSbase.a`. GNU `ar` isn't optimised for 
    97 this use-case and it takes far more memory than it really needs to. So 
    98 what happens is that ar takes >500Mb of memory and your virtual 
    99 machine / virtual server probably isn't configured with that much memory 
    100 and so the linux kernel OOM killer terminates the ar process. 
    101  
    102 To make this worse, since there are so many .o files, it takes several 
    103 invocations of ar to link them all. On each invocation `ar` is building 
    104 the symbol index (-q is ignored) and this is what takes the most time 
    105 and memory. It's a good deal quicker to use a custom program (100 lines 
    106 of Haskell) to build `libHSbase.a` and then use `ranlib` just once to build 
    107 the symbol index. 
    108  
    109 [Duncan Coutts] I submitted a patch to gnu `binutils` to make ar take less memory when 
    110 linking 1000's of files so it now only takes around 100Mb rather than 
    111 500Mb when linking `libHSbase.a`. That patch is included in version 2.17 I 
    112 think (in other words most systems don't have it yet). 
    113  
    114 What you can do in the mean time is either configure your virtual 
    115 machine with more memory or turn off the split-objs feature when you 
    116 configure ghc. Just add `SplitObjs=NO` to your `mk/build.mk` file (which 
    117 may not exist to start with). (The Gentoo ebuild does this 
    118 automatically) 
    119  
    120  
     1[[redirect(wiki:Building/Troubleshooting)]]