Archive

Posts Tagged ‘macbook pro’

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 , , , , ,

Apple’s Quality Control – Does it Matter?

February 18th, 2009

mac-logoI love my iPhone and MacBook Pro but I have to say that Apple’s quality control seems to be a bit lacking. Last night, my Macbook Pro’s screen suddenly went black and would not come back on.  I tried a hard reboot, resetting the PRAM, resetting the SMC, plugging in an external screen, and even just leaving it alone for 10 minutes before trying again LOL. It was already 1am at the time, so I just browsed Digg on my iPhone, went to sleep and brought it in this afternoon to see a  Genius at the Bar.

After some routine tests, he said it was a video board/chip error and that it would have to be replaced.  Lucky for me, this is a known/documented error and the repair would be free even though I am out of warranty.  They do have the part in stock and he assured me it would be ready for pickup in a couple days. Not too bad considering I have lots of other computers at home I can use.

So why am I questioning Apple’s QC?

This is actually already the second repair I have had to do on the MBP in just over a year.  The first time they had to replace the entire top panel because of a faulty touch pad.  On top of that, I have also gone through 4 different iPhones due to random issues where it just would not power on anymore (2 of the 1st gen and 2 of the 3G).  Each time they replaced it on the spot, with no questions asked (except for the obligatory, “did you drop it in water”?). None of my old PCs ever needed servicing and they are still running strong (Dell, Fujitsu, IBM, etc).  So, I was thinking… if not for their stellar customer service, I might be tempted to stop buying Apple stuff… but really I know I just can’t resist their shiny new products :-)

Gee News, apple , , , , ,