| 127 | | |
| 128 | | == What to look for if your build fails == |
| 129 | | |
| 130 | | This section collects typical failure cases, and what to do about them. |
| 131 | | |
| 132 | | === Using autoconf by mistake === |
| 133 | | |
| 134 | | If you used {{{autoconf}}} instead of {{{sh boot}}}, |
| 135 | | you'll get an error when you run {{{./configure}}}: |
| 136 | | {{{ |
| 137 | | ...lots of stuff... |
| 138 | | creating mk/config.h |
| 139 | | mk/config.h is unchanged |
| 140 | | configuring in ghc |
| 141 | | running /bin/sh ./configure --cache-file=.././config.cache --srcdir=. |
| 142 | | ./configure: ./configure: No such file or directory |
| 143 | | configure: error: ./configure failed for ghc |
| 144 | | }}} |
| 145 | | |
| 146 | | === Cannot create configure === |
| 147 | | {{{autoreconf}}} (which gets run by {{{sh boot}}}) seems to create the file {{{configure}}} |
| 148 | | read-only. So if you need to run {{{sh boot}}} again (which I sometimes do for safety's sake), |
| 149 | | you get |
| 150 | | {{{ |
| 151 | | /usr/bin/autoconf: cannot create configure: permission denied |
| 152 | | }}} |
| 153 | | Solution: delete {{{configure}}} first. |
| 154 | | |
| 155 | | === Configure can't find darcs version === |
| 156 | | |
| 157 | | When you run your configure script, it falls over with |
| 158 | | {{{ |
| 159 | | sh-2.04$ ./configure --with-gcc=c:/mingw/bin/gcc --with-ld=c:/mingw/bin/ld.exe --host=i386-unknown-mingw32 |
| 160 | | configure: WARNING: If you wanted to set the --build type, don't use --host. |
| 161 | | If a cross compiler is detected then cross compile mode will be used. |
| 162 | | checking for GHC version date... -nThe system cannot find the file specified. |
| 163 | | configure: error: failed to detect version date: check that darcs is in your path |
| 164 | | }}} |
| 165 | | This error is nothing to do with `darcs`! The darcs-version test in `configure` uses `sort`, and it is picking up the Windows sort (in `c:\windows\system32`) instead of the MSYS or Cygwin sort. |
| 166 | | |
| 167 | | Solution: either hack the configure script by hand, or (better) make sure that MSYS/Cygwin are in your PATH before Windows. Since `c:\windows\system32` is, by default, in the System Environment Variable called PATH, and System Variables come first when searching for paths, you'll have to put MSYS/Cygwin bin directory in the System PATH, before `c:\windows\system32`. |
| 168 | | |
| 169 | | (Incidentally, `find` is another program that Windows has too, with different functionality to Unix.) |
| 170 | | |
| 171 | | === Aregument list too long === |
| 172 | | |
| 173 | | You may find this towards the end of compiling the base library: |
| 174 | | {{{ |
| 175 | | c:\ghc\ghc-6.6.1\bin\ar.exe: creating libHSbase.a |
| 176 | | xargs: c:/ghc/ghc-6.6.1/bin/ar: Argument list too long |
| 177 | | make[2]: *** [libHSbase.a] Error 126 |
| 178 | | make[2]: *** Deleting file `libHSbase.a' |
| 179 | | Failed making all in base: 1 |
| 180 | | make[1]: *** [all] Error 1 |
| 181 | | make[1]: Leaving directory `/cygdrive/c/GHC6.6.1/ghc-6.6.1/libraries' |
| 182 | | make: *** [stage1] Error 2 |
| 183 | | }}} |
| 184 | | Sadly the argument list has a limited length in Windows. This may be fixable |
| 185 | | somehow (Windows expertise welcomed here), but what we do is to set |
| 186 | | {{{ |
| 187 | | SplitObjs = NO |
| 188 | | }}} |
| 189 | | in `build.mk`. That stops the splitting-up of object files, and dramatically reduces |
| 190 | | the number of object files involved. Link times are also improved. (Binary size increases |
| 191 | | though.) |
| 192 | | |
| 193 | | Also, you can arrange for the (huge) list of files to be processed iteratively, rather all at once, and that would probably be a principal solution. `xargs` feeds the file names to the appropriate command (e.g. `ar`). In `$(GHC_TOP)/mk/target.mk` find the place where it is called and add this switch |
| 194 | | {{{ |
| 195 | | xargs -n NNN |
| 196 | | }}} |
| 197 | | where NNN is the number of arguments processed at a time. It should be small enough to be less than the limit and large enough for the whole thing not to be too slow. |
| 198 | | |
| 199 | | Note, that it's not good to edit `target.mk` in general. |