Archive

Archive for May, 2009

Ruby on Rails

May 14th, 2009

I just started using Rails for a new project… My brother and some friends have been raving about it and how much time it would save us over our old-school PHP approach. I was never really skeptical of their claims, but the thought of learning something new for an important project is definitely scary.

However, I am now a believer in this RoR stuff. In just 4 short days, the basic framework of our new site is up and running! This timeframe even includes learning the entire framework (not to mention the Ruby language) from scratch. I’ll admit it was quite confusing at first, but once you ignore the scaffolding stuff (mostly for marketing and cool “make a blog in 15 minutes” demos) its really a piece of cake.

so yea, RoR ftw (until the next cool framework comes out :-)

Gee Projects, RoR , , ,

Building Universal Binaries on MAC OS X with configure

May 8th, 2009

I recently ran into a ton of problems while trying to build the latest version of Remobo as a universal binary with OS X 10.4 support on my MacBook Pro running 10.5. In the end, all the problems were solved by passing in the right compiler flags and configure parameters. Here is a quick rundown of what I learned. Hopefully it will help someone out in the future!

Our project uses configure and automake etc… so we did not have XCode to help us with the settings. This will be true for many open source projects and libraries you come across since they are mostly written for Linux.

1) Make sure to pass the right compiler flags.

For a universal binary, use:
CFLAGS="-arch ppc -arch i386"
LDFLAGS="-arch i386 -arch ppc"

If you also want backwards compatibility with a previous version of OS X (10.4 in this example), use something like:
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"

This will compile using the 10.4 SDK instead of the default 10.5 since I am runnign Leopard.

2) Pass in the right configure parameters.

Make sure to add this flag to configure:
./configure --disable-dependency-tracking

This will ensure there are no problems when compiling for multiple architectures.

3) Check your output binary.

You can use the “file” command to make sure everything went according to plan. If the binary is truly universal, you will see something like this:
file ./src/hello
src/hello: Mach-O fat file with 2 architectures
src/hello (for architecture i386): Mach-O executable i386
src/hello (for architecture ppc): Mach-O executable ppc

Hope that helps!

One last tip: make sure all the dependencies and libraries you are using are also compiled in this way or else you will get link errors since the linker cannot combine regular binaries with universal binaries.

Gee C++, Remobo, Tips , , , , ,