Opened 9 years ago

Closed 9 years ago

#5011 closed bug (fixed)

installing xcode 4 breaks ghc linking

Reported by: carter Owned by: igloo
Priority: highest Milestone: 7.2.1
Component: Compiler Version: 7.0.2
Keywords: Cc: pho@…, william.knop.nospam@…
Operating System: MacOS X Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


As of installing xcode 4 earlier today,

i'm getting errors of the form ld: library not found for -lcrt1.10.5.o collect2: ld returned 1 exit status

for any haskell code that invokes ld in its cabal install process. 1) is this related to some problem in xcode / what the haskell code defaults to linking to? 2) is this something completely unrelated?

just guessing, would be that ghc 7.0.2 on snow leopard is doing some static linking iwth the 10.5 compatible c runtime lib, which isn't kept in xcode 4's dev libs?

Change History (7)

comment:1 Changed 9 years ago by PHO

Cc: pho@… added

comment:2 Changed 9 years ago by carter

just to be clear, this error, unlike the other os x error, prevents compilation from succeeding.

comment:3 Changed 9 years ago by carter

one workaround is to copy the 10.5 leopard SDK thats part of xcode 3's developer directory into the the SDK directory xcode 4, but this isn't a viable long term solution, especially since new macs will be either os x 10.6 or 10.7 , and new installs of xcode will very soon be predominantly be of xcode 4

comment:4 Changed 9 years ago by altaic

Cc: william.knop.nospam@… added

As you said, the issue is the lack of the 10.5 SDK in Xcode 4. It seems like the simplest course of action at this point would be to distribute an installer pkg built against each of the SDKs. Simply specifying --with-macosx-deployment-target= for configure is enough to build against the 10.6 SDK.

comment:5 Changed 9 years ago by altaic

Correction: -isysroot /Developer/SDKs/MacOSX10.5.sdk is specified in aclocal.m4. I'm not sure why it's there; -mmacosx-version-min=10.5 is sufficient to make sure the 10.4 and earlier SDKs aren't attempted, yet newer SDKs are useable. Apple is also pretty good about supporting deprecated functions for a couple generations of SDKs, so the 10.6 SDK should be fine without having to rework anything.

For instance, I just built a new ghc HEAD against 10.6's SDK. I removed the -isysroot /Developer/SDKs/MacOSX10.5.sdk entries from aclocal.m4, ran make maintainer-clean, perl boot, ./configure --with-macosx-deployment-target=10.6 --enable-bootstrap-with-devel-snapshot, and finally make -j2. The build works fine... In fact, the build against 10.6's SDK passed four more tests in the test suite than the previous build against 10.5's SDK (although I'd since pulled a couple patches).

I no longer have Xcode 3 since Xcode 4 overwrote it, and I haven't yet been bothered to copy the 10.5 SDK over from an old Xcode 3 pkg. No worries.

comment:6 Changed 9 years ago by igloo

Milestone: 7.2.1
Owner: set to igloo
Priority: normalhighest

Currently the installers don't work on 10.5 anyway, due to a DTrace issue, so hopefully if we just drop the flags which aim to make it work on 10.5 then it'll work with both XCode 3 and 4.

comment:7 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed


Sun Mar 13 14:03:22 GMT 2011  Ian Lynagh <>
  * Stop explicitly asking for 10.5 support on OS X; fixes #5011
  XCode 4 doesn't include the 10.5 SDK, so if we explicitly ask for it
  then linking fails.
Note: See TracTickets for help on using tickets.