Opened 8 years ago

Closed 8 years ago

#5726 closed bug (fixed)

GHC 7.4.1 RC1 doesn't work with Xcode 4.2.1

Reported by: shelarcy Owned by: igloo
Priority: highest Milestone: 7.4.1
Component: Compiler Version: 7.3
Keywords: Cc: shelarcy@…, johan.tibell@…, chak
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: GHC doesn't work at all Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Xcode 4.2 removed gcc-4.2 now. But GHC 7.4.1 RC 1 uses gcc-4.2 as gcc. This behavior causes problem when compiling program.

$ ghc -c Export.hs
ghc: could not execute: /Developer/usr/bin/gcc-4.2
$ ghc Test.hs
[1 of 1] Compiling Main             ( Test.hs, Test.o )
ghc: could not execute: /Developer/usr/bin/gcc-4.2

GHC- and GHC- causes this problem.

And when using ghc-, ./configure causes error.

$ ./configure
checking for path to top of build tree... /Users/shelarcy/Desktop/ghc-
Build platform inferred as: i386-apple-darwin
Host platform inferred as: i386-apple-darwin
Target platform inferred as: i386-apple-darwin
GHC build  : i386-apple-darwin
GHC host   : i386-apple-darwin
GHC target : i386-apple-darwin
checking for perl... /opt/local/bin/perl
checking if your perl works in shell scripts... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for gsed... sed
checking XCode version... 4.2.1
configure: XCode version component 1: 4
configure: XCode version component 2: 2
checking for gcc-4.2... no
configure: error: cannot find gcc-4.2 in your PATH, no idea how to link

I can build program by GHC 7.2.2 (with some warning), and Haskell Platform 2011.4.0.0's GHC 7.0.4. So, I think this behavior is wrong.

See also: #5354

Change History (8)

comment:1 Changed 8 years ago by shelarcy

Cc: shelarcy@… added

comment:2 Changed 8 years ago by tibbe

Cc: johan.tibell@… added

comment:3 Changed 8 years ago by igloo

difficulty: Unknown

What gcc's that it does include?

And what does "gcc --version" say for each of them.

comment:4 Changed 8 years ago by shelarcy

Xcode 4.2.1 includes only llvm-gcc(-4.2).

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

See discussion at

comment:5 Changed 8 years ago by igloo

Milestone: 7.4.1
Priority: normalhighest

Does anyone know what the status is of building with the LLVM gcc?

comment:6 in reply to:  5 Changed 8 years ago by simonmar

Cc: chak added

Replying to igloo:

Does anyone know what the status is of building with the LLVM gcc?

If you configure on a system that has only llvm-gcc, the build will work, but the resulting GHC will produce slow binaries. See dba7254566b121408e7167200d0223a531b66e8b.

For 7.4.1 I suggest we build distributions using XCode 4.1, and make sure they work if you have XCode 4.2 installed (that is, they should use gcc, not gcc-4.2).

comment:7 Changed 8 years ago by igloo

Owner: set to igloo

comment:8 Changed 8 years ago by igloo

Resolution: fixed
Status: newclosed

Fixed in HEAD and 7.4:

commit 6ce7d8008c59fd6cf0be975a503d202866d45744

Author: Ian Lynagh <>
Date:   Wed Jan 11 19:01:55 2012 +0000

    Don't try to use gcc-4.2 on XCode >= 4.2

    It was removed in 4.2.

commit 37f70cdbc1975b02d0c27023c0ccb8993f7b6498

Author: Ian Lynagh <>
Date:   Wed Jan 11 21:00:42 2012 +0000

    Use /usr/bin/gcc when making the OS X installer

    On XCode 4.1, we use /usr/bin/gcc-4.2 as it makes better code than
    /usr/bin/gcc for us. However, gcc-4.2 doesn't exist in XCode 4.2, so we
    need to use /usr/bin/gcc there. As the installer can be used on either,
    we make it always use /usr/bin/gcc.
Note: See TracTickets for help on using tickets.