title: Compiling Haskell "Hello World" on Mac Snow Leopard - crt1.10.5.o not found
body: <p>Just trying to compile some trivial Haskell, but its not finding the c runtimes, despite the fact that <em><strong>they're right there</strong></em>: </p>
  
  <pre><code>$ cat hello_world.hs
  main = putStrLn "hello, world"
  
  $ ghc --make hello_world
  [1 of 1] Compiling Main             ( hello_world.hs, hello_world.o )
  Linking hello_world ...
  ld: library not found for -lcrt1.10.5.o
  collect2: ld returned 1 exit status
  
  $ file /usr/lib/crt1.10.5.o 
  /usr/lib/crt1.10.5.o: Mach-O universal binary with 3 architectures
  /usr/lib/crt1.10.5.o (for architecture x86_64): Mach-O 64-bit object x86_64
  /usr/lib/crt1.10.5.o (for architecture i386):   Mach-O object i386
  /usr/lib/crt1.10.5.o (for architecture ppc7400):    Mach-O object ppc
  
  $ uname -a
  Darwin Nyx.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386
  $ ghc --version
  The Glorious Glasgow Haskell Compilation System, version 7.0.2
  </code></pre>
  
  <p>I installed from <a href="http://hackage.haskell.org/platform/mac.html" rel="nofollow">http://hackage.haskell.org/platform/mac.html</a></p>
  
  <p><hr>
  Verbose dump:</p>
  
  <pre><code>$ ghc -v --make hello_world
  Glasgow Haskell Compiler, Version 7.0.2, for Haskell 98, stage 2 booted by GHC version 6.12.3
  Using binary package database: /Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/package.conf.d/package.cache
  Using binary package database: /Users/Anm/.ghc/i386-darwin-7.0.2/package.conf.d/package.cache
  wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-6bf7b03ebc9c668817e4379b6796c0c2
  wired-in package integer-gmp mapped to integer-gmp-0.2.0.3-91607778cf3ae8f3948a50062b4f8479
  wired-in package base mapped to base-4.3.1.0-93953b308d1897309792406495cf356b
  wired-in package rts mapped to builtin_rts
  wired-in package template-haskell mapped to template-haskell-2.5.0.0-5134a59c0456de4c2a07cc56fa258728
  wired-in package dph-seq not found.
  wired-in package dph-par not found.
  Hsc static flags: -static
  *** Chasing dependencies:
  Chasing modules from: *hello_world.hs
  Stable obj: [Main]
  Stable BCO: []
  Ready for upsweep
    [NONREC
        ModSummary {
           ms_hs_date = Thu Mar 31 18:11:40 PDT 2011
           ms_mod = main:Main,
           ms_imps = [import Prelude]
           ms_srcimps = []
        }]
  compile: input file hello_world.hs
  Created temporary directory: /var/folders/UE/UEH-SvA7E-GPjyBwX5XrfU+++TI/-Tmp-/ghc13751_0
  *** Checking old interface for main:Main:
  [1 of 1] Skipping  Main             ( hello_world.hs, hello_world.o )
  *** Deleting temp files:
  Deleting: /var/folders/UE/UEH-SvA7E-GPjyBwX5XrfU+++TI/-Tmp-/ghc13751_0/ghc13751_0.s
  Warning: deleting non-existent /var/folders/UE/UEH-SvA7E-GPjyBwX5XrfU+++TI/-Tmp-/ghc13751_0/ghc13751_0.s
  Upsweep completely successful.
  *** Deleting temp files:
  Deleting: 
  link: linkables are ...
  LinkableM (Thu Mar 31 18:11:51 PDT 2011) main:Main
     [DotO hello_world.o]
  Linking hello_world ...
  *** Linker:
  /Developer/usr/bin/gcc -v -o hello_world -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fno-stack-protector -DDONT_WANT_WIN32_DLL_SUPPORT hello_world.o -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/base-4.3.1.0 -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/integer-gmp-0.2.0.3 -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/ghc-prim-0.2.0.0 -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2 -lHSrtsmain -lHSbase-4.3.1.0 -liconv -lHSinteger-gmp-0.2.0.3 -lHSghc-prim-0.2.0.0 -lHSrts -lm -ldl -u _ghczmprim_GHCziTypes_Izh_static_info -u _ghczmprim_GHCziTypes_Czh_static_info -u _ghczmprim_GHCziTypes_Fzh_static_info -u _ghczmprim_GHCziTypes_Dzh_static_info -u _base_GHCziPtr_Ptr_static_info -u _base_GHCziWord_Wzh_static_info -u _base_GHCziInt_I8zh_static_info -u _base_GHCziInt_I16zh_static_info -u _base_GHCziInt_I32zh_static_info -u _base_GHCziInt_I64zh_static_info -u _base_GHCziWord_W8zh_static_info -u _base_GHCziWord_W16zh_static_info -u _base_GHCziWord_W32zh_static_info -u _base_GHCziWord_W64zh_static_info -u _base_GHCziStable_StablePtr_static_info -u _ghczmprim_GHCziTypes_Izh_con_info -u _ghczmprim_GHCziTypes_Czh_con_info -u _ghczmprim_GHCziTypes_Fzh_con_info -u _ghczmprim_GHCziTypes_Dzh_con_info -u _base_GHCziPtr_Ptr_con_info -u _base_GHCziPtr_FunPtr_con_info -u _base_GHCziStable_StablePtr_con_info -u _ghczmprim_GHCziBool_False_closure -u _ghczmprim_GHCziBool_True_closure -u _base_GHCziPack_unpackCString_closure -u _base_GHCziIOziException_stackOverflow_closure -u _base_GHCziIOziException_heapOverflow_closure -u _base_ControlziExceptionziBase_nonTermination_closure -u _base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -u _base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -u _base_ControlziExceptionziBase_nestedAtomically_closure -u _base_GHCziWeak_runFinalizzerBatch_closure -u _base_GHCziTopHandler_runIO_closure -u _base_GHCziTopHandler_runNonIO_closure -u _base_GHCziConcziIO_ensureIOManagerIsRunning_closure -u _base_GHCziConcziSync_runSparks_closure -u _base_GHCziConcziSignal_runHandlers_closure -Wl,-search_paths_first -read_only_relocs warning -lHSffi
  Using built-in specs.
  Target: i686-apple-darwin10
  Configured with: /var/tmp/gcc/gcc-5666.3~123/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
  Thread model: posix
  gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
   /Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.5 -read_only_relocs warning -syslibroot /Developer/SDKs/MacOSX10.5.sdk -weak_reference_mismatches non-weak -u _ghczmprim_GHCziTypes_Izh_static_info -u _ghczmprim_GHCziTypes_Czh_static_info -u _ghczmprim_GHCziTypes_Fzh_static_info -u _ghczmprim_GHCziTypes_Dzh_static_info -u _base_GHCziPtr_Ptr_static_info -u _base_GHCziWord_Wzh_static_info -u _base_GHCziInt_I8zh_static_info -u _base_GHCziInt_I16zh_static_info -u _base_GHCziInt_I32zh_static_info -u _base_GHCziInt_I64zh_static_info -u _base_GHCziWord_W8zh_static_info -u _base_GHCziWord_W16zh_static_info -u _base_GHCziWord_W32zh_static_info -u _base_GHCziWord_W64zh_static_info -u _base_GHCziStable_StablePtr_static_info -u _ghczmprim_GHCziTypes_Izh_con_info -u _ghczmprim_GHCziTypes_Czh_con_info -u _ghczmprim_GHCziTypes_Fzh_con_info -u _ghczmprim_GHCziTypes_Dzh_con_info -u _base_GHCziPtr_Ptr_con_info -u _base_GHCziPtr_FunPtr_con_info -u _base_GHCziStable_StablePtr_con_info -u _ghczmprim_GHCziBool_False_closure -u _ghczmprim_GHCziBool_True_closure -u _base_GHCziPack_unpackCString_closure -u _base_GHCziIOziException_stackOverflow_closure -u _base_GHCziIOziException_heapOverflow_closure -u _base_ControlziExceptionziBase_nonTermination_closure -u _base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -u _base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -u _base_ControlziExceptionziBase_nestedAtomically_closure -u _base_GHCziWeak_runFinalizzerBatch_closure -u _base_GHCziTopHandler_runIO_closure -u _base_GHCziTopHandler_runNonIO_closure -u _base_GHCziConcziIO_ensureIOManagerIsRunning_closure -u _base_GHCziConcziSync_runSparks_closure -u _base_GHCziConcziSignal_runHandlers_closure -o hello_world -lcrt1.10.5.o -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/base-4.3.1.0 -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/integer-gmp-0.2.0.3 -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/ghc-prim-0.2.0.0 -L/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2 -L/Developer/usr/bin/../lib/gcc/i686-apple-darwin10/4.2.1 -L/Developer/usr/bin/../lib/gcc -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/Developer/usr/bin/../lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/Developer/usr/bin/../lib/gcc/i686-apple-darwin10/4.2.1/../../.. hello_world.o -lHSrtsmain -lHSbase-4.3.1.0 -liconv -lHSinteger-gmp-0.2.0.3 -lHSghc-prim-0.2.0.0 -lHSrts -lm -ldl -search_paths_first -lHSffi -lgcc_s.10.5 -lgcc -lSystem
  ld: library not found for -lcrt1.10.5.o
  collect2: ld returned 1 exit status
  *** Deleting temp files:
  Deleting: 
  *** Deleting temp dirs:
  Deleting: /var/folders/UE/UEH-SvA7E-GPjyBwX5XrfU+++TI/-Tmp-/ghc13751_0
  </code></pre>
  
  <p><hr>
  Okay... <code>/usr/lib/gcc/i686-apple-darwin10/4.2.1/</code> is on the implicit library path, but...</p>
  
  <pre><code>$ ls /usr/lib/gcc/i686-apple-darwin10/4.2.1/
  crt3.o      include     libcc_kext.a    libgcc_eh.a libgcov.a   libgomp.spec    x86_64
  finclude    install-tools   libgcc.a    libgcc_static.a libgomp.a   libstdc++.dylib
  </code></pre>