Skip to content

OS X: ghc broken on Snow Leopard

I downloaded GHC-6.10.4-i386.pkg and installed it on a OS X 10.6 Snow Leopard seed. gcc in Snow Leopard defaults to x86_64. This breaks even trivial builds with GHC since it passes either no or incompatible flags.

GHC should either produce proper x86_64 assembly or pass "-arch i386" to force a 32-bit build.

An example follows.

Trivial source:

$ cat Foo.hs
main = do
     putStrLn "Foo!"

Direct build broken:

$ ghc --make Foo.hs -v3
Glasgow Haskell Compiler, Version 6.10.4, for Haskell 98, stage 2 booted by GHC version 6.10.3.20090628
Using package config file: /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/./package.conf
hiding package base-3.0.3.1 to avoid conflict with later version base-4.1.0.0
wired-in package ghc-prim mapped to ghc-prim-0.1.0.0
wired-in package integer mapped to integer-0.1.0.1
wired-in package base mapped to base-4.1.0.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package syb mapped to syb-0.1.0.1
wired-in package template-haskell mapped to template-haskell-2.3.0.1
wired-in package dph-seq mapped to dph-seq-0.3
wired-in package dph-par mapped to dph-par-0.3
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: *Foo.hs
Stable obj: []
Stable BCO: []
Ready for upsweep
  [NONREC
      ModSummary {
         ms_hs_date = Fri Jul 24 11:35:52 PDT 2009
         ms_mod = main:Main,
         ms_imps = []
         ms_srcimps = []
      }]
compile: input file Foo.hs
Created temporary directory: /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24470_0
*** Checking old interface for main:Main:
[1 of 1] Compiling Main             ( Foo.hs, Foo.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 10
*** Simplify:
    Result size = 8
*** Tidy Core:
    Result size = 8
*** CorePrep:
    Result size = 10
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** Assembler:
gcc -I. -c /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24470_0/ghc24470_0.s -o Foo.o

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:36:0:
    suffix or operands invalid for `push'

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:83:0:
    suffix or operands invalid for `push'

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:130:0:
    suffix or operands invalid for `push'

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:156:0:
    32-bit absolute addressing is not supported for x86-64

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:156:0:
    cannot do signed 4 byte relocation

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:159:0:
    32-bit absolute addressing is not supported for x86-64

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24470_0/ghc24470_0.s:159:0:
    cannot do signed 4 byte relocation
*** Deleting temp files:
Deleting: /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24470_0/ghc24470_0.s
*** Deleting temp dirs:
Deleting: /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24470_0

Via-C build broken:

$ ghc --make Foo.hs -v3 -fvia-c
Glasgow Haskell Compiler, Version 6.10.4, for Haskell 98, stage 2 booted by GHC version 6.10.3.20090628
Using package config file: /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/./package.conf
hiding package base-3.0.3.1 to avoid conflict with later version base-4.1.0.0
wired-in package ghc-prim mapped to ghc-prim-0.1.0.0
wired-in package integer mapped to integer-0.1.0.1
wired-in package base mapped to base-4.1.0.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package syb mapped to syb-0.1.0.1
wired-in package template-haskell mapped to template-haskell-2.3.0.1
wired-in package dph-seq mapped to dph-seq-0.3
wired-in package dph-par mapped to dph-par-0.3
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: *Foo.hs
Stable obj: []
Stable BCO: []
Ready for upsweep
  [NONREC
      ModSummary {
         ms_hs_date = Fri Jul 24 11:35:52 PDT 2009
         ms_mod = main:Main,
         ms_imps = []
         ms_srcimps = []
      }]
compile: input file Foo.hs
Created temporary directory: /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0
*** Checking old interface for main:Main:
[1 of 1] Compiling Main             ( Foo.hs, Foo.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 10
*** Simplify:
    Result size = 8
*** Tidy Core:
    Result size = 8
*** CorePrep:
    Result size = 10
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** C Compiler:
gcc -x c /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.hc -o /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.raw_s -DDONT_WANT_WIN32_DLL_SUPPORT -mdynamic-no-pic -march=i686 -fno-defer-pop -fomit-frame-pointer -fno-builtin -DSTOLEN_X86_REGS=4 -fwrapv -mno-omit-leaf-frame-pointer -fno-unit-at-a-time -ffloat-store -fno-strict-aliasing -v -S -Wimplicit -O -D__GLASGOW_HASKELL__=610 -DTABLES_NEXT_TO_CODE -I . -I /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/base-4.1.0.0/include -I /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/include
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5646~6/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 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5646)
 /usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 -quiet -v -I . -I /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/base-4.1.0.0/include -I /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/include -imultilib x86_64 -D__DYNAMIC__ -DDONT_WANT_WIN32_DLL_SUPPORT -DSTOLEN_X86_REGS=4 -D__GLASGOW_HASKELL__=610 -DTABLES_NEXT_TO_CODE /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.hc -quiet -dumpbase ghc24479_0.hc -mmacosx-version-min=10.6.0 -mdynamic-no-pic -march=i686 -mno-omit-leaf-frame-pointer -m64 -auxbase-strip /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.raw_s -O -Wimplicit -version -fno-defer-pop -fomit-frame-pointer -fno-builtin -fwrapv -fno-unit-at-a-time -ffloat-store -fno-strict-aliasing -o /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.raw_s
ignoring nonexistent directory "/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/base-4.1.0.0/include
 /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/include
 /usr/local/include
 /usr/lib/gcc/i686-apple-darwin10/4.2.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

/var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-/ghc24479_0/ghc24479_0.hc:1:0:
     error: CPU you selected does not support x86-64 instruction set
GNU C version 4.2.1 (Apple Inc. build 5646) (i686-apple-darwin10)
	compiled by GNU C version 4.2.1 (Apple Inc. build 5646).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
*** Deleting temp files:
Deleting: /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.raw_s /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.hc
Warning: deleting non-existent /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0/ghc24479_0.raw_s
*** Deleting temp dirs:
Deleting: /var/folders/p5/p5hZ-IyTHEamZkUAcT8VfU+++TM/-Tmp-//ghc24479_0
Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information