Version 10 (modified by kirsten, 11 years ago) (diff)


Building GHC on Mac OS X 10.2, by Kirsten aged 26 1/52

  1. grab the HEAD off darcs, per Building/GettingTheSources (no problems here)
  2. run autoreconf (this went ok, because I had just upgraded my autoconf in order to build darcs)
  3. run ./configure
  4. oops, I only have happy 1.13, it wants happy 1.15
  5. go to the happy download page. what, no Mac OS X binary?
  6. grab the happy sources
  7. ./configure, make, make install. so far so good
  8. ./configure GHC again
  9. LOL, I need alex 2.0
  10. 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"
  11. LOL, *still* no Mac OS X binary.
  12. ./configure; make in alex
  13. have disgusting IM conversation with friend while waiting
  14. alex: "you lose at life":
    Creating a symbolic link from alex-2.0.1 to alex in /usr/local/bin failed: `/usr/local/bin/alex' already exists
    Perhaps remove `/usr/local/bin/alex' manually?
    make[2]: *** [install] Error 1
    make[1]: *** [install] Error 1
    make: *** [install] Error 1
  15. consider a career change
  16. rm /usr/local/bin/alex
  17. sudo rm /usr/local/bin/alex
  18. sudo make me a sandwich
  19. sudo make install
  20. okay, I have alex. yippee.
  21. ./configure in GHC again
  22. seems to have worked. With trembling fingers (or maybe that's just the freezing Southern California weather), type "make".
  23. OH NOEZ:
    gcc -O -DTABLES_NEXT_TO_CODE -I. -I../rts    -c mkDerivedConstants.c -o mkDerivedConstants.o
    InfoTables.h:314: illegal member declaration, missing name, found `}'
    OSThreads.h:135: #error "Threads not supported"
    OSThreads.h:141: undefined type, found `OSThreadId'
    OSThreads.h:145: illegal external declaration, missing `;' after `OSThreadProcAttr'
    OSThreads.h:145: illegal external declaration, missing `;' after `*'
    OSThreads.h:147: undefined type, found `OSThreadId'
    OSThreads.h:148: undefined type, found `OSThreadProc'
    OSThreads.h:153: undefined type, found `Condition'
    OSThreads.h:154: undefined type, found `Condition'
    OSThreads.h:155: undefined type, found `Condition'
    OSThreads.h:156: undefined type, found `Condition'
    OSThreads.h:157: undefined type, found `Condition'
    OSThreads.h:158: undefined type, found `Mutex'
    OSThreads.h:163: undefined type, found `Mutex'
    OSThreads.h:164: undefined type, found `Mutex'
    OSThreads.h:169: undefined type, found `ThreadLocalKey'
    OSThreads.h:170: undefined type, found `ThreadLocalKey'
    OSThreads.h:171: undefined type, found `ThreadLocalKey'
    Storage.h:211: undefined type, found `Mutex'
    Storage.h:212: undefined type, found `Mutex'
    ../rts/Task.h:88: undefined type, found `OSThreadId'
    ../rts/Task.h:115: undefined type, found `Condition'
    ../rts/Task.h:116: undefined type, found `Mutex'
    ../rts/Task.h:225: illegal function prototype, found `*'
    ../rts/Task.h:225: illegal function definition, found `)'
    ../rts/Task.h:235: undefined type, found `ThreadLocalKey'
    ../rts/Capability.h:74: undefined type, found `Mutex'
    ../rts/Capability.h:197: undefined type, found `Mutex'
    cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode
    make[1]: *** [mkDerivedConstants.o] Error 1
    make: *** [stage1] Error 1
  24. Cry.
  25. Hmm, how old is my gcc, anyway?
    % gcc --version
    gcc (GCC) 3.1 20020420 (prerelease)
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [ yeah, no shit, Sherlock ]
  26. Will upgrading my gcc break everything? Probably. Should I do it anyway? Probably.
  27. Actually, upgrading gcc sounds about as appealing as a quadruple root canal. Maybe I can use gcc2 (2.95.2) instead.
  28. Aaaaargh, of course I'm not that lucky:
    checking for gcc... gcc2
    checking for C compiler default output file name... 
    configure: error: C compiler cannot create executables
  29. Start downloading tarball for newer gcc from: Also consider becoming religious so I can pray for it to be actually useful.
  30. Length: 31,674,171 [application/x-tar]
     2% [>                                    ] 895,686       14.36K/s    ETA 34:52
  31. Wish that parents-in-law would get the faster internets at their house.
  32. Eat breakfast.
  33. 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.
  34. Hope that autoconf; ./configure; make; make install will just work, since I don't have the attention span for anything else.
  35. Run make.
  36. For some reason, the configure script thinks that my PPC laptop is an i386. ./configure doesn't do anything. Nor does ./configure --help.
  37. No, actually it thinks I want to build a cross-compiler. Why would I want that?
  38. 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.
  39. Try setenv HOSTS ppc
  40. make
  41. Still complains with the same message:
    * Building Apple GCC 3.3 Compiler(s) (languages = c++,c,objc,objc++) for thins *
    * ---------------------------------------------------------------------------- *
    * BUILDHOST       = Kirsten-Chevaliers-Computer.local. -- a ppc                *
    * HOSTS           = ppc  i386                                                  *
    * TARGETS         = ppc  i386                                                  *
    * SRCROOT         = /tmp/gcc3/gcc-1495                                         *
    * OBJROOT         = /tmp/gcc3/gcc-1495/obj                                     *
    * SYMROOT         = /tmp/gcc3/gcc-1495/obj/../sym                              *
    * DSTROOT         = /tmp/gcc3/gcc-1495/obj/../dst                              *
    * RC_RELEASE      =                                                            *
    * CFLAGS          = -g                                                         *
    * OPT_OVERRIDE    =                                                            *
    * NEXT_ROOT       =                                                            *
    * BUILD           = ppc                                                        *
    * BOOTSTRAP       = yes                                                        *
    * PREFIX          = /usr                                                       *
    * DO_SYMLINKS     = no                                                         *
    * ENABLE_CHECKING = --disable-checking                                         *
    * Default cc      =                                                            *
    * Curr. Hdrs.     = 3.1                                                        *
    * ---------------------------------------------------------------------------- *
    * 12/27/06 10:08:49 PST                                                        *
    ? The directory /usr/libexec/gcc/darwin/i386 is missing!!! ?
    ? Please install a compiler that generates code for i386.  ?
    make: *** [build] Error 1
  42. Try export HOSTS
  43. make
  44. Still complains.
  45. 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.
  46. Apparently you can also set the TARGETS environment variable. Try setting it to ppc also.
  47. ??????????????????????????????????????????
    ? Host type i386 should also be a target ?
  48. Well, maybe if I could also set the HOSTS to just ppc, that wouldn't be a problem.
  49. 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.
  50. 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.
  51. Go back to bed.
  52. ...but not *yet*. The hell?
    + Building libiberty                     +
    + -------------------------------------- +
    + cwd = /tmp/gcc3/gcc-1495/obj/libiberty +
    + gnumake srcdir=/tmp/gcc3/gcc-1495/libiberty BUILD_PREFIX=ppc- BUILD_PREFIX_1=ppc- 'HOST_CC= cc -arch ppc -no-cpp-precomp' 'CFLA\
    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-\
    precomp -g'
    if [ x"" != x ] && [ ! -d pic ]; then \
      mkdir pic; \
    else true; fi
    touch stamp-picdir
    if [ x"" != x ]; then \
      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\
    tional -pedantic  /tmp/gcc3/gcc-1495/libiberty/regex.c -o pic/regex.o; \
    else true; fi
    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\
    onal -pedantic /tmp/gcc3/gcc-1495/libiberty/regex.c -o regex.o
    gnumake[1]: cc: Command not found
    gnumake[1]: *** [regex.o] Error 127
    + status=2
    + command set +x
    + set +x
    * *** gnumake failed building libiberty *** *
  53. WTF is "libiberty"?
  54. 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.
  55. Try setting the CC environment variable to {{{/usr/gcc}}.
  56. make. Doesn't work.
  57. make clean
  58. make. Doesn't work.
  59. Edit the makefile in the libiberty subdir: CC = gcc. Again, there's probably a better way...
  60. make. Doesn't work.
  61. make clean
  62. make. Really go back to bed.