Changes between Version 27 and Version 28 of KirstenSandbox


Ignore:
Timestamp:
Jan 12, 2007 1:15:27 PM (9 years ago)
Author:
kirsten
Comment:

archiving old stuff

Legend:

Unmodified
Added
Removed
Modified
  • KirstenSandbox

    v27 v28  
    1 = Building GHC on Mac OS X 10.2 in 136 Easy Steps, by Kirsten aged 26 1/52 =
    2 
    3  1. grab the HEAD off darcs, per Building/GettingTheSources (no problems here)
    4  1.  run autoreconf (this went ok, because I had just upgraded my autoconf in order to build darcs)
    5  1.  run ./configure
    6  1.  oops, I only have happy 1.13, it wants happy 1.15
    7  1.  go to the happy download page. what, no Mac OS X binary?
    8  1.  grab the happy sources
    9  1.  ./configure, make, make install. so far so good
    10  1.  ./configure GHC again
    11  1.  LOL, I need alex 2.0
    12  1.  why isn't this integrated into the GHC build process? also, googling for just "alex" is un-useful. so is googling for "alex lexer" and "alex lexer haskell"
    13  1.  LOL, *still* no Mac OS X binary.
    14  1.  ./configure; make in alex
    15  1.  have disgusting IM conversation with friend while waiting
    16  1.  alex: "you lose at life":
    17 {{{
    18 Creating a symbolic link from alex-2.0.1 to alex in /usr/local/bin failed: `/usr/local/bin/alex' already exists
    19 Perhaps remove `/usr/local/bin/alex' manually?
    20 make[2]: *** [install] Error 1
    21 make[1]: *** [install] Error 1
    22 make: *** [install] Error 1
    23 }}}
    24  1.  consider a career change
    25  1.  rm /usr/local/bin/alex
    26  1.  sudo rm /usr/local/bin/alex
    27  1.  sudo make me a sandwich
    28  1.  sudo make install
    29  1.  okay, I have alex. yippee.
    30  1.  ./configure in GHC again
    31  1.  seems to have worked. With trembling fingers (or maybe that's just the freezing Southern California weather), type "make".
    32  1. OH NOEZ:
    33 {{{
    34 gcc -O -DTABLES_NEXT_TO_CODE -I. -I../rts    -c mkDerivedConstants.c -o mkDerivedConstants.o
    35 InfoTables.h:314: illegal member declaration, missing name, found `}'
    36 OSThreads.h:135: #error "Threads not supported"
    37 OSThreads.h:141: undefined type, found `OSThreadId'
    38 OSThreads.h:145: illegal external declaration, missing `;' after `OSThreadProcAttr'
    39 OSThreads.h:145: illegal external declaration, missing `;' after `*'
    40 OSThreads.h:147: undefined type, found `OSThreadId'
    41 OSThreads.h:148: undefined type, found `OSThreadProc'
    42 OSThreads.h:153: undefined type, found `Condition'
    43 OSThreads.h:154: undefined type, found `Condition'
    44 OSThreads.h:155: undefined type, found `Condition'
    45 OSThreads.h:156: undefined type, found `Condition'
    46 OSThreads.h:157: undefined type, found `Condition'
    47 OSThreads.h:158: undefined type, found `Mutex'
    48 OSThreads.h:163: undefined type, found `Mutex'
    49 OSThreads.h:164: undefined type, found `Mutex'
    50 OSThreads.h:169: undefined type, found `ThreadLocalKey'
    51 OSThreads.h:170: undefined type, found `ThreadLocalKey'
    52 OSThreads.h:171: undefined type, found `ThreadLocalKey'
    53 Storage.h:211: undefined type, found `Mutex'
    54 Storage.h:212: undefined type, found `Mutex'
    55 ../rts/Task.h:88: undefined type, found `OSThreadId'
    56 ../rts/Task.h:115: undefined type, found `Condition'
    57 ../rts/Task.h:116: undefined type, found `Mutex'
    58 ../rts/Task.h:225: illegal function prototype, found `*'
    59 ../rts/Task.h:225: illegal function definition, found `)'
    60 ../rts/Task.h:235: undefined type, found `ThreadLocalKey'
    61 ../rts/Capability.h:74: undefined type, found `Mutex'
    62 ../rts/Capability.h:197: undefined type, found `Mutex'
    63 cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode
    64 make[1]: *** [mkDerivedConstants.o] Error 1
    65 make: *** [stage1] Error 1
    66 }}}
    67  1.  Cry.
    68  1.  Hmm, how old is my gcc, anyway?
    69 {{{
    70 % gcc --version
    71 gcc (GCC) 3.1 20020420 (prerelease)
    72 Copyright (C) 2002 Free Software Foundation, Inc.
    73 This is free software; see the source for copying conditions.  There is NO
    74 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [ yeah, no shit, Sherlock ]
    75 }}}
    76  1. Will upgrading my gcc break everything? Probably. Should I do it anyway? Probably.
    77  1. Actually, upgrading gcc sounds about as appealing as a quadruple root canal. Maybe I can use gcc2 (2.95.2) instead.
    78  1. Aaaaargh, of course I'm not that lucky:
    79 {{{
    80 checking for gcc... gcc2
    81 checking for C compiler default output file name...
    82 configure: error: C compiler cannot create executables
    83 }}}
    84  1.  Start downloading tarball for newer gcc from: [http://www.opensource.apple.com/darwinsource/August2003GCCUpdate/]. Also consider becoming religious so I can pray for it to be actually useful.
    85  1. 
    86 {{{
    87 Length: 31,674,171 [application/x-tar]
    88 
    89  2% [>                                    ] 895,686       14.36K/s    ETA 34:52
    90 }}}
    91  1.  Wish that parents-in-law would get the faster internets at their house.
    92  1.  Eat breakfast.
    93  1.  Installing gcc on a full stomach is probably better anyway (though quite possibly not). Unzip the tarball. Notice that {{{INSTALL}}} is a directory. That's already a bad sign.
    94  1.  Hope that {{{autoconf; ./configure; make; make install}}} will just work, since I don't have the attention span for anything else.
    95  1.  Run make.
    96  1.  For some reason, the configure script thinks that my PPC laptop is an i386. {{{./configure}}} doesn't do anything. Nor does {{{./configure --help}}}.
    97  1.  No, actually it thinks I want to build a cross-compiler. Why would I want that?
    98  1.  Apparently the hosts to build for are controlled by the {{{HOSTS}}} environment variable, or maybe it's set somewhere in one of the config files. I'm not sure. Nor am I sure why I have the attention span to grovel through the sources but not to read the documentation.
    99  1.  Try {{{setenv HOSTS ppc}}}
    100  1.  {{{make}}}
    101  1.  Still complains with the same message:
    102 {{{
    103 ********************************************************************************
    104 * Building Apple GCC 3.3 Compiler(s) (languages = c++,c,objc,objc++) for thins *
    105 * ---------------------------------------------------------------------------- *
    106 * BUILDHOST       = Kirsten-Chevaliers-Computer.local. -- a ppc                *
    107 * HOSTS           = ppc  i386                                                  *
    108 * TARGETS         = ppc  i386                                                  *
    109 * SRCROOT         = /tmp/gcc3/gcc-1495                                         *
    110 * OBJROOT         = /tmp/gcc3/gcc-1495/obj                                     *
    111 * SYMROOT         = /tmp/gcc3/gcc-1495/obj/../sym                              *
    112 * DSTROOT         = /tmp/gcc3/gcc-1495/obj/../dst                              *
    113 * RC_RELEASE      =                                                            *
    114 * CFLAGS          = -g                                                         *
    115 * OPT_OVERRIDE    =                                                            *
    116 * NEXT_ROOT       =                                                            *
    117 * BUILD           = ppc                                                        *
    118 * BOOTSTRAP       = yes                                                        *
    119 * PREFIX          = /usr                                                       *
    120 * DO_SYMLINKS     = no                                                         *
    121 * ENABLE_CHECKING = --disable-checking                                         *
    122 * Default cc      =                                                            *
    123 * Curr. Hdrs.     = 3.1                                                        *
    124 * ---------------------------------------------------------------------------- *
    125 * 12/27/06 10:08:49 PST                                                        *
    126 ********************************************************************************
    127 
    128 
    129 ????????????????????????????????????????????????????????????
    130 ? The directory /usr/libexec/gcc/darwin/i386 is missing!!! ?
    131 ? Please install a compiler that generates code for i386.  ?
    132 ????????????????????????????????????????????????????????????
    133 
    134 make: *** [build] Error 1
    135 }}}
    136  1.  Try {{{export HOSTS}}}
    137  1.  {{{make}}}
    138  1.  Still complains.
    139  1.  For the 65536th time in my life, consider destroying everything Turing-complete and then going out to enjoy the big room with the blue ceilings.
    140  1.  Apparently you can also set the {{{TARGETS}}} environment variable. Try setting it to {{{ppc}}} also.
    141  1.
    142 {{{
    143 ??????????????????????????????????????????
    144 ? Host type i386 should also be a target ?
    145 ??????????????????????????????????????????
    146 }}}
    147  1.  Well, maybe if I could also set the {{{HOSTS}}} to just {{{ppc}}}, that wouldn't be a problem.
    148  1.  Use grep again (the only IDE I'll ever need) and figure out to edit the {{{GNUmakefile}}} to change the {{{HOSTS = }}} and {{{targets = }}} lines to obliterate any and all traces of {{{i386}}}. There's probably a better way. At this point I don't care.
    149  1.  Start {{{make}}} again. It is, at least, convinced that it only wants to be building a {{{ppc}}} compiler, without any of that crazy {{{i386}}} nonsense.
    150  1.  Go back to bed.
    151  1.  ...but not *yet*. The hell?
    152 {{{
    153 ++++++++++++++++++++++++++++++++++++++++++
    154 + Building libiberty                     +
    155 + -------------------------------------- +
    156 + cwd = /tmp/gcc3/gcc-1495/obj/libiberty +
    157 ++++++++++++++++++++++++++++++++++++++++++
    158 
    159 + gnumake srcdir=/tmp/gcc3/gcc-1495/libiberty BUILD_PREFIX=ppc- BUILD_PREFIX_1=ppc- 'HOST_CC= cc -arch ppc -no-cpp-precomp' 'CFLA\
    160 GS= -g' 'GCC_CFLAGS=-no-cpp-precomp -g' 'BOOT_CFLAGS=-O2 -g -no-cpp-precomp -mdynamic-no-pic' 'CC=cc -arch ppc -arch ppc -no-cpp-\
    161 precomp -g'
    162 if [ x"" != x ] && [ ! -d pic ]; then \
    163   mkdir pic; \
    164 else true; fi
    165 touch stamp-picdir
    166 if [ x"" != x ]; then \
    167   cc -arch ppc -arch ppc -no-cpp-precomp -g -c -DHAVE_CONFIG_H -g -I. -I/tmp/gcc3/gcc-1495/libiberty/../include  -W -Wall -Wtradi\
    168 tional -pedantic  /tmp/gcc3/gcc-1495/libiberty/regex.c -o pic/regex.o; \
    169 else true; fi
    170 cc -arch ppc -arch ppc -no-cpp-precomp -g -c -DHAVE_CONFIG_H -g -I. -I/tmp/gcc3/gcc-1495/libiberty/../include  -W -Wall -Wtraditi\
    171 onal -pedantic /tmp/gcc3/gcc-1495/libiberty/regex.c -o regex.o
    172 gnumake[1]: cc: Command not found
    173 gnumake[1]: *** [regex.o] Error 127
    174 + status=2
    175 + command set +x
    176 + set +x
    177 
    178 *********************************************
    179 * *** gnumake failed building libiberty *** *
    180 *********************************************
    181 }}}
    182  1. WTF is "libiberty"?
    183  1. Apparently, not only does it think it should be using {{{cc}}} instead of {{{gcc}}} (which are supposed to be the same anyway, no?), the {{{PATH}}} isn't getting exported correctly, because {{{cc}}} is certainly in {{{/usr}}}, which is in my {{{PATH}}}.
    184  1. Try setting the {{{CC}}} environment variable to {{{/usr/gcc}}.
    185  1. {{{make}}}. Doesn't work.
    186  1. {{{make clean}}}
    187  1. {{{make}}}. Doesn't work.
    188  1. Edit the makefile in the {{{libiberty}}} subdir: {{{CC = gcc}}}. Again, there's probably a better way...
    189  1. {{{make}}}. Doesn't work.
    190  1. {{{make clean}}}
    191  1. {{{make}}}. Really go back to bed.
    192  1. Decide for some reason to get back out of bed and leave the other warm body in it behind in order to start building {{{gcc}}} again. Consider whether I need psychological help.
    193  1. The problem is that it can't find {{{cc}}} in the {{{PATH}}} and although {{{/usr}}}, where {{{cc}}} is, SHOULD be in the {{{PATH}}}, it's not getting exported properly fsr.
    194  1. Create a symbolic link to {{{/usr/cc}}} in {{{/usr/bin}}}.
    195  1. Chainsaw, meet butter.
    196  1. {{{make}}}. {{{libiberty}}} makes it all the way through this time.
    197  1. NOW WHAT
    198 {{{
    199 cc -arch ppc -no-cpp-precomp -g -c -no-cpp-precomp  -g -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0 -DIN_GCC   -W -Wall -Wwri\
    200 te-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -mdynamic-no-pic -DHAVE_CONFIG_H -DGE\
    201 NERATOR_FILE    -I. -I. -I/tmp/gcc3/gcc-1495/gcc -I/tmp/gcc3/gcc-1495/gcc/. -I/tmp/gcc3/gcc-1495/gcc/config -I/tmp/gcc3/gcc-1495/\
    202 gcc/../include -I/tmp/gcc3/gcc-1495/gcc/../more-hdrs \
    203   ./gengtype-lex.c -o gengtype-lex.o
    204 gengtype-lex.c:1: warning: ISO C forbids an empty source file
    205 cc -arch ppc -no-cpp-precomp -g -c -no-cpp-precomp  -g -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0 -DIN_GCC   -W -Wall -Wwri\
    206 te-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -mdynamic-no-pic -DHAVE_CONFIG_H -DGE\
    207 NERATOR_FILE    -I. -I. -I/tmp/gcc3/gcc-1495/gcc -I/tmp/gcc3/gcc-1495/gcc/. -I/tmp/gcc3/gcc-1495/gcc/config -I/tmp/gcc3/gcc-1495/\
    208 gcc/../include -I/tmp/gcc3/gcc-1495/gcc/../more-hdrs \
    209   ./gengtype-yacc.c -o gengtype-yacc.o
    210 cc: ./gengtype-yacc.c: No such file or directory
    211 cc: no input files
    212 gnumake[2]: *** [gengtype-yacc.o] Error 1
    213 gnumake[1]: *** [stage1_build] Error 2
    214 + status=2
    215 + command set +x
    216 + set +x
    217 
    218 ********************************************
    219 * *** gnumake failed building compiler *** *
    220 ********************************************
    221 }}}
    222  1. Figure this is probably because I don't have bison and yacc installed. Consider the comical aptness of the term "yak-shaving" here.
    223  1. Wait a sec, I do have bison and yacc! They're under {{{/usr}}}! Why the hell are they under {{{/usr}}}, anyway, and why isn't {{{/usr}}} in my {{{PATH}}}? Actually, that was probably just because I unzipped a tarball in the wrong place at some point. I guess I'll just put them all in {{{/usr/bin}}}.
    224  1. {{{make clean}}} so configure can notice that bison and yacc and flex are there now. {{{make}}}
    225  1.
    226 {{{
    227 (cd . && \
    228  bison  -d -o gengtype-yacc.c /tmp/gcc3/gcc-1495/gcc/gengtype-yacc.y || \
    229  ( rm -f gengtype-yacc.c && false ) )
    230 bison: /usr/share/bison.simple: No such file or directory
    231 gnumake[2]: *** [gengtype-yacc.c] Error 1
    232 gnumake[1]: *** [stage1_build] Error 2
    233 + status=2
    234 + command set +x
    235 + set +x
    236 
    237 ********************************************
    238 * *** gnumake failed building compiler *** *
    239 ********************************************
    240 }}}
    241  1. WTH is {{{bison.simple}}}?
    242  1. Download {{{bison.simple}}} off the intorblags and put it in {{{/usr/bin}}}.
    243  1. Oh, it wants it to be in {{{/usr/share}}}. Well, sure, put it there too.
    244  1. It's missing another include file:
    245 {{{
    246 In file included from /tmp/gcc3/gcc-1495/gcc/config/rs6000/host-darwin.c:25:
    247 /usr/include/sys/mman.h:62:39: mach/shared_memory_server.h: No such file or directory
    248 In file included from /tmp/gcc3/gcc-1495/gcc/config/rs6000/host-darwin.c:25:
    249 /usr/include/sys/mman.h:170: parse error before "sf_mapping_t"
    250 /usr/include/sys/mman.h:171: parse error before "sf_mapping_t"
    251 /tmp/gcc3/gcc-1495/gcc/config/rs6000/host-darwin.c: In function `segv_handler':
    252 /tmp/gcc3/gcc-1495/gcc/config/rs6000/host-darwin.c:66: dereferencing pointer to incomplete type
    253 /tmp/gcc3/gcc-1495/gcc/config/rs6000/host-darwin.c:115: dereferencing pointer to incomplete type
    254 /tmp/gcc3/gcc-1495/gcc/config/rs6000/host-darwin.c:115: dereferencing pointer to incomplete type
    255 gnumake[2]: *** [host-darwin.o] Error 1
    256 gnumake[1]: *** [stage1_build] Error 2
    257 }}}
    258  1. What is {{{shared_memory_server.h}}} and why isn't there an easy way to answer the question "what is it, and to get it can I just download the file somewhere or do I have to finally give in and buy the upgrade to Mac OS 10.4?"
    259  1. Wait a day. Drive to the Apple store.
    260  1. Get told that of course I can't exchange money for the goods and services I want, because my four-year-old laptop is ''too old''.
    261  1. Consider buying a PC.
    262  1. Post on the GHC mailing list to seek pity (or at least laughs).
    263  1. Per a resulting suggestion, start downloading the .dmg for gcc 3.3 off [http://connect.apple.com/] (which of course isn't google-able because of course you have to create an account and mumble mumble deep web mumble.)
    264  1. Be thankful that at least this one is only going to take 23 minutes to download instead of 34. Get dressed.
    265  1. Try to install the gcc .pkg. It says I need the December 2002 Developer Tools update too (which is of course exactly what the person on the mailing list said as well.)
    266  1. Start the Dec. 2002 update downloading. ''6-hour download.'' Crie.
    267  1. Be grateful that at least you're not on dialup.
    268  1. Be grateful that at least you have First World problems rather than the other kind.
    269  1. About 10 hours later, double-click the installer. Wait 15 minutes.
    270  1. "The software was successfully installed." Now there's an experience I haven't had in a while.
    271  1. Double-click the August 2003 GCC updater. Wait 2 minutes.
    272  1. "The software was successfully installed." I'm on a roll!!
    273  1. So, where was I two days ago, anyway? Oh yeah, trying to build GHC! That was the original point, wasn't it? I'm not sure anymore.
    274  1. Of course, GHC is still looking for gcc under /usr (since it's first in your PATH for some reason) and not under /usr/bin where it really lives.
    275  1. Edit PATH to put /usr at the end. This doesn't work.
    276  1. Play some symlink games.
    277  1. Now {{{gcc}}} points to gcc 3.3, but the same error message comes up as before when I run {{{make}}} in ghc:
    278 {{{
    279 % make
    280 make -C utils/mkdependC boot
    281 ------------------------------------------------------------------------
    282 == make boot -r;
    283  in /Users/krc/ghc-head/ghc/includes
    284 ------------------------------------------------------------------------
    285 gcc -O -DTABLES_NEXT_TO_CODE -I. -I../rts    -c mkDerivedConstants.c -o mkDerivedConstants.o
    286 In file included from Rts.h:144,
    287                  from mkDerivedConstants.c:23:
    288 OSThreads.h:135:4: #error "Threads not supported"
    289 In file included from Rts.h:144,
    290                  from mkDerivedConstants.c:23:
    291 OSThreads.h:141: error: parse error before "osThreadId"
    292 OSThreads.h:141: warning: data definition has no type or storage class
    293 OSThreads.h:145: error: parse error before "OSThreadProc"
    294 OSThreads.h:145: warning: data definition has no type or storage class
    295 OSThreads.h:147: error: parse error before '*' token
    296 OSThreads.h:153: error: parse error before '*' token
    297 OSThreads.h:154: error: parse error before '*' token
    298 OSThreads.h:155: error: parse error before '*' token
    299 OSThreads.h:156: error: parse error before '*' token
    300 OSThreads.h:157: error: parse error before '*' token
    301 OSThreads.h:163: error: parse error before '*' token
    302 OSThreads.h:164: error: parse error before '*' token
    303 OSThreads.h:169: error: parse error before '*' token
    304 OSThreads.h:170: error: parse error before '*' token
    305 OSThreads.h:171: error: parse error before '*' token
    306 In file included from Rts.h:160,
    307                  from mkDerivedConstants.c:23:
    308 Storage.h:211: error: parse error before "sm_mutex"
    309 Storage.h:211: warning: data definition has no type or storage class
    310 Storage.h:212: error: parse error before "atomic_modify_mutvar_mutex"
    311 Storage.h:212: warning: data definition has no type or storage class
    312 In file included from ../rts/Capability.h:27,
    313                  from mkDerivedConstants.c:28:
    314 ../rts/Task.h:88: error: parse error before "OSThreadId"
    315 ../rts/Task.h:88: warning: no semicolon at end of struct or union
    316 ../rts/Task.h:115: error: parse error before "cond"
    317 ../rts/Task.h:115: warning: data definition has no type or storage class
    318 ../rts/Task.h:116: error: parse error before "lock"
    319 ../rts/Task.h:116: warning: data definition has no type or storage class
    320 ../rts/Task.h:155: error: parse error before '}' token
    321 ../rts/Task.h:155: warning: data definition has no type or storage class
    322 ../rts/Task.h:158: error: parse error before '*' token
    323 ../rts/Task.h: In function `isBoundTask':
    324 ../rts/Task.h:160: error: `task' undeclared (first use in this function)
    325 ../rts/Task.h:160: error: (Each undeclared identifier is reported only once
    326 ../rts/Task.h:160: error: for each function it appears in.)
    327 ../rts/Task.h: At top level:
    328 ../rts/Task.h:166: error: parse error before '*' token
    329 ../rts/Task.h:166: warning: data definition has no type or storage class
    330 ../rts/Task.h:178: error: parse error before '*' token
    331 ../rts/Task.h:178: warning: data definition has no type or storage class
    332 ../rts/Task.h:183: error: parse error before '*' token
    333 ../rts/Task.h:188: error: parse error before '*' token
    334 ../rts/Task.h:194: error: parse error before '*' token
    335 ../rts/Task.h:200: error: parse error before '*' token
    336 ../rts/Task.h:205: error: parse error before '*' token
    337 ../rts/Task.h:209: error: parse error before '*' token
    338 ../rts/Task.h:209: warning: data definition has no type or storage class
    339 ../rts/Task.h:225: error: parse error before '*' token
    340 ../rts/Task.h:225: error: parse error before '*' token
    341 ../rts/Task.h:225: error: `OSThreadProcAttr' declared as function returning a function
    342 ../rts/Task.h:235: error: parse error before "currentTaskKey"
    343 ../rts/Task.h:235: warning: data definition has no type or storage class
    344 ../rts/Task.h:246: error: parse error before '*' token
    345 ../rts/Task.h:257: error: parse error before '*' token
    346 ../rts/Task.h: In function `setMyTask':
    347 ../rts/Task.h:260: error: `task' undeclared (first use in this function)
    348 ../rts/Task.h: At top level:
    349 ../rts/Task.h:270: error: parse error before '*' token
    350 ../rts/Task.h: In function `taskEnter':
    351 ../rts/Task.h:274: error: `task' undeclared (first use in this function)
    352 In file included from mkDerivedConstants.c:28:
    353 ../rts/Capability.h: At top level:
    354 ../rts/Capability.h:42: error: parse error before "Task"
    355 ../rts/Capability.h:42: warning: no semicolon at end of struct or union
    356 ../rts/Capability.h:61: error: parse error before '*' token
    357 ../rts/Capability.h:61: warning: data definition has no type or storage class
    358 ../rts/Capability.h:71: error: parse error before '*' token
    359 ../rts/Capability.h:71: warning: data definition has no type or storage class
    360 ../rts/Capability.h:74: error: parse error before "lock"
    361 ../rts/Capability.h:74: warning: data definition has no type or storage class
    362 ../rts/Capability.h:81: error: parse error before '*' token
    363 ../rts/Capability.h:81: warning: data definition has no type or storage class
    364 ../rts/Capability.h:82: error: parse error before '*' token
    365 ../rts/Capability.h:82: warning: data definition has no type or storage class
    366 ../rts/Capability.h:97: error: parse error before '}' token
    367 ../rts/Capability.h:174: error: parse error before "Task"
    368 ../rts/Capability.h:191: error: parse error before "Task"
    369 ../rts/Capability.h:197: error: parse error before '*' token
    370 ../rts/Capability.h:220: error: parse error before "Task"
    371 ../rts/Capability.h:224: error: parse error before "Task"
    372 ../rts/Capability.h: In function `recordMutableCap':
    373 ../rts/Capability.h:247: error: dereferencing pointer to incomplete type
    374 ../rts/Capability.h:253: error: dereferencing pointer to incomplete type
    375 mkDerivedConstants.c: In function `main':
    376 mkDerivedConstants.c:228: error: dereferencing pointer to incomplete type
    377 mkDerivedConstants.c:228: error: dereferencing pointer to incomplete type
    378 mkDerivedConstants.c:229: error: dereferencing pointer to incomplete type
    379 mkDerivedConstants.c:229: error: dereferencing pointer to incomplete type
    380 mkDerivedConstants.c:231: error: dereferencing pointer to incomplete type
    381 mkDerivedConstants.c:232: error: dereferencing pointer to incomplete type
    382 mkDerivedConstants.c:233: error: dereferencing pointer to incomplete type
    383 mkDerivedConstants.c:233: error: dereferencing pointer to incomplete type
    384 make[1]: *** [mkDerivedConstants.o] Error 1
    385 make: *** [stage1] Error 1
    386 [Kirsten-Chevaliers-Computer:~/ghc-head/ghc] krc%
    387 }}}
    388  1. Go to bed.
    389  1. No, no, can't rest as long as this problem isn't solved. Maybe this is a terrible idea, but what if I try {{{./configure --disable-threaded-rts}}}?
    390  1. {{{make clean}}}
    391  1. {{{make}}}
    392  1. OMFG!!!111 it at least makes it past {{{mkDerivedConstants.c}}} this time
    393  1. :-((((
    394 {{{
    395 ------------------------------------------------------------------------
    396 == make boot -r;
    397  in /Users/krc/ghc-head/ghc/compat
    398 ------------------------------------------------------------------------
    399 ../utils/mkdependC/mkdependC -f .depend    -I. -Iinclude -I../includes  -- -O -I. -Iinclude -D__\
    400 GHC_PATCHLEVEL__=1 -I../libraries/base/cbits -I../libraries/base/include    -- cbits/directory.c\
    401  cbits/rawSystem.c cbits/unicode.c
    402 /usr/local/bin/ghc -M -optdep-f -optdep.depend  -osuf o    -H16m -O -I. -Iinclude -Rghc-timing -\
    403 I../libraries -fglasgow-exts -no-recomp Compat/Directory.hs Compat/RawSystem.hs Compat/Unicode.h\
    404 s Distribution/Compat/FilePath.hs Distribution/Compat/ReadP.hs Distribution/Compiler.hs Distribu\
    405 tion/GetOpt.hs Distribution/InstalledPackageInfo.hs Distribution/License.hs Distribution/Package\
    406 .hs Distribution/ParseUtils.hs Distribution/Version.hs Language/Haskell/Extension.hs System/Dire\
    407 ctory/Internals.hs
    408 <<ghc: 8979932 bytes, 3 GCs, 9280/9280 avg/max bytes residency (1 samples), 15M in use, 0.04 INI\
    409 T (0.02 elapsed), 0.17 MUT (1.53 elapsed), 0.03 GC (0.04 elapsed) :ghc>>
    410 make all
    411 /usr/local/bin/ghc -H16m -O -I. -Iinclude -Rghc-timing  -I../libraries -fglasgow-exts -no-recomp\
    412     -c System/Directory/Internals.hs -o System/Directory/Internals.o  -ohi System/Directory/Inte\
    413 rnals.hi
    414 System/Directory/Internals.hs:1: parse error on input `#'
    415 <<ghc: 5251084 bytes, 3 GCs, 5688/5688 avg/max bytes residency (1 samples), 16M in use, 0.03 INI\
    416 T (0.01 elapsed), 0.06 MUT (0.31 elapsed), 0.02 GC (0.02 elapsed) :ghc>>
    417 make[2]: *** [System/Directory/Internals.o] Error 1
    418 make[1]: *** [boot] Error 2
    419 make: *** [stage1] Error 1
    420 }}}
    421  1. Well, my {{{/usr/local/bin/ghc}}} is really old. 6.0.1, in fact. Maybe I need something newer for bootstrapping. What does the documentation say? Have I ever read it before? If not, why break my streak?
    422  1. Hmm, says "version 5.04 at least." 6.0.1 > 5.04 (or so I would naively think).
    423  1. {{{System/Directory/Internals.hs}}} has an {{{OPTIONS}}} pragma. Why am I suspecting that GHC 6.0.1 doesn't know about this pragma? Would the documentation lie to me? (Probably.)
    424  1. Then again, I no longer have any idea where my version of GHC 6.0.1 came from.
    425  1. Maybe I'll download a binary of GHC instead.
    426  1. Oh wait, I CAN'T do that, because I have Mac OS 10.2.
    427  1. Hey, I might have a functioning other version of GHC sitting around. These ideas just keep getting worse and worse...
    428 {{{
    429 ./configure --with-ghc=~/GHC/ghc-6.4.2/ghc/compiler/ghc-inplace --disable-threaded-rts
    430 }}}
    431  1. Huh, it got all the way through ./configure even though apparently the path name wasn't getting canonicalized. Nice!
    432 {{{
    433 ./configure --with-ghc=/Users/krc/GHC/ghc-6.4.2/ghc/compiler/ghc-inplace --disable-threaded-rts
    434 }}}
    435  1. Oh, CRIE, that's not going to work, I never finished building the libraries with the other GHC, and indeed COULDN'T.
    436  1. Back to square one:
    437 {{{
    438 ./configure --with-ghc=/usr/local/bin/ghc --disable-threaded-rts
    439 }}}
    440  1. Wonder how I ever got this installed in the first place.
    441  1. Sleep.
    442  1. In the morning, look at that Internals.hs file more carefully. Something weird seems to be happening with cpp. For one thing, the file paths in the includes in {{{Internals.hs}}} seem to be wrong, but upon fixing them, {{{cpp}}} dumps in a bunch of lines that begin with things like {{{# 1}}}, which ghc doesn't seem to like.
    443  1. Start building ghc on a Linux system to compare what that file ends up looking like. (Which should be interesting since that's a webhosting account where autoconf doesn't even seem to be installed. Hope it doesn't matter!)
    444  1. Okay, well, {{{compat/}}} builds perfectly on the Linux box. No big shock, I guess. But what does cpp do?
    445  1. Huh, on the Linux box, that Internals.hs file doesn't seem to even get touched. A configure problem? Or maybe it really is needed on Mac OS but not Linux?
    446  1. Aw, crap, looking at the Makefile under {{{compat/}}} tells me that Internals.hs is getting built because I'm bootstrapping with a ghc less than 6.3, whereas on that Linux box, I have ghc 6.4 already, so that's that mystery solved.
    447  1. ''Why'' can't I get a binary ghc for OS 10.2? (Because, I guess, everyone else upgraded already, and I'm the last of the Mohicans.)
    448  1. So, I suspect {{{Internals.hs}}} may be bitrotted, but that still doesn't solve the mystery of how to get cpp to do the right thing with it.
    449  1. And thanks to a minimal test case, it's not even those line pragmas that's making ghc throw up.
    450  1. Go on IRC.
    451  1. A very nice person, {{{pejo}}}, points out: [http://www.haskell.org/ghc/dist/6.4/MacOSX/]
    452  1. Download the mysterious tarball from there and unzip it.
    453  1. Reconfigure:
    454 {{{
    455 ./configure --with-ghc=/private/tmp/ghc_d/ghc-bootstrap/bin/ghc --disable-threaded-rts
    456 }}}
    457  1. That went okay. {{{make}}}
    458  1. Edit the paths in {{{/tmp/ghc_d/ghc-bootstrap/bin/ghc}}} (which is a shell script) to change {{{/opt/local}}} to {{{/tmp/ghc_d/ghc-bootstrap}}}. Four times.
    459  1. {{{make}}} again
    460  1. Oh noez:
    461 {{{
    462 make -C utils/mkdependC boot
    463 ------------------------------------------------------------------------
    464 == make boot -r;
    465  in /Users/krc/ghc-head/ghc/includes
    466 ------------------------------------------------------------------------
    467 ../utils/mkdependC/mkdependC -f .depend     -- -O -DTABLES_NEXT_TO_CODE -I. -I../rts    -- mkDerivedConstants.c
    468 ------------------------------------------------------------------------
    469 == make boot -r;
    470  in /Users/krc/ghc-head/ghc/compat
    471 ------------------------------------------------------------------------
    472 /bin/sh: test: unknownunknown: integer expression expected
    473 /private/tmp/ghc_d/ghc-bootstrap/bin/ghc -M -optdep-f -optdep.depend  -osuf o -optdep--exclude-module=System.Directory.Internals   -H16m -O -I. -Iinclude -Rghc-timing -I../li\
    474 braries -fglasgow-exts -no-recomp Compat/Directory.hs Compat/RawSystem.hs Compat/Unicode.hs Distribution/Compat/FilePath.hs Distribution/Compat/ReadP.hs Distribution/Compiler\
    475 .hs Distribution/GetOpt.hs Distribution/InstalledPackageInfo.hs Distribution/License.hs Distribution/Package.hs Distribution/ParseUtils.hs Distribution/Version.hs Language/Ha\
    476 skell/Extension.hs tmp.hs
    477 dyld: /private/tmp/ghc_d/ghc-bootstrap/lib/ghc-6.4/ghc-6.4 can't open library: /opt/local/lib/libreadline.5.0.dylib  (No such file or directory, errno = 2)
    478 make[1]: *** [depend] Trace/BPT trap
    479 make: *** [stage1] Error 1
    480 }}}
    481  1. Wonder whether 11:49 AM is too early in the day to start drinking.
    482  1. Do I have libreadline? Yes, but only version 4. Is that good enough? Maybe. Try some horrible symlink games.
    483  1. Damn:
    484 {{{
    485 dyld: /private/tmp/ghc_d/ghc-bootstrap/lib/ghc-6.4/ghc-6.4 version mismatch for library: /opt/local/lib/libreadline.5.0.dylib (compatibility version of user: 5.0.0 greater th\
    486 an library's version: 4.0.0)
    487 make[1]: *** [depend] Trace/BPT trap
    488 }}}
    489   1. Okay, I'll just go download readline 5.0 instead. Google says that's "trivial".
    490   1. Several days later after getting distracted by other things, try to actually build readline. Realize it's not actually "trivial".
    491   1. Buy a PC.
     1[[KirstenSandbox/MacOS10.2]]