2007-12-23

Ruby.framework broken in MacOSX10.5.sdk

If you're trying to build against Ruby.framework on Mac OS X 10.5 you may have come across a problem with the SDK. This manifests itself as this error:

gcc test.c -framework Ruby -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
ld: framework not found Ruby
collect2: ld returned 1 exit status

This appears to be fixable like this:

cd /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current
sudo ln -s usr/lib/libruby.dylib Ruby

I don't know whether that's the right fix, but it seems to do the trick. Radar 5661551.

2 comments:

sjml said...

Kind of a stretch, but have you had any luck building against Ruby.framework? I can't seem to get my app to see its headers without pointing it to the absolute path, which kind of kills the point of using a framework.

OneSadCookie said...

If you're building against the 10.4u SDK, you can't use Ruby.framework because it didn't exist; you'll need to use the unix-style includes and library.

If you're building against the 10.5 SDK, the fix provided in the post seems to do the trick.

If you're building on 10.5 without an SDK, the framework works fine.