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

My Trip to Tokyo (lots of Geo-Tagged Photos)

April 20th, 2009

I recently made a trip to Tokyo for some great sight seeing, shopping and of course eating!  My brother moved there recently, so I stayed at his place in Shibuya. I made sure to take lots of pictures and uploaded them all to Rotzy.  Check out the full set below.  If you see something you like, click through and see the geo-tag information.  I made sure to tag all the good eats so I can find them again next time.

Check out the photos here until I get the widget up…

Some of the places we visited during our short trip:

Meiji Temple, Harajuku, Omotesando, Roppongi, the Imperial Palace, Takao-San, and a few others I can’t recall at the moment :-)

Enjoy the pics!

Gee News

Amazon No Longer Allowing Associates to use Paid Search to Drive Traffic

April 6th, 2009

associates-logo-small_v265885005_Wow I just got this e-mail from Amazon and its pretty big news IMHO. I used to bid on keywords and send them directly to affiliate web sites and Amazon’s Associate program was great for this. In fact, LOTS of people still do this and it generates good money for those that do it successfully. These people are going to be mad!

Amazon used to have a pretty open policy of letting associates bid on keywords and send the traffic directly to Amazon.com, but I guess they finally figured out that this is costing them lots of money… so as of 5/1/2009 you can no longer do this. If you do, you simply won’t get paid. I wonder how the publishers will respond to this..

Here’s what the e-mail said: (more info here)

Dear Amazon Associate:

We’re writing to let you know about a change to the Amazon Associates Program. After careful review of how we are investing our advertising resources, we have made the decision to no longer pay referral fees to Associates who send users to www.amazon.com, www.amazon.ca, or www.endless.com through keyword bidding and other paid search on Google, Yahoo, MSN, and other search engines, and their extended search networks. If you’re not sure if this change affects you, please visit this page for FAQs.

As of May 1, 2009, Associates will not be paid referral fees for paid search traffic. Also, in connection with this change, as of May 1, 2009, Amazon will no longer make data feeds available to Associates for the purpose of sending users to the Amazon websites in the US or Canada via paid search.

This change applies only to the Associates programs in North America. If you are conducting paid search activities in connection with one of Amazon’s Associates Programs outside of the US and Canada, please refer to the applicable country’s Associates Program Operating Agreement for relevant terms and conditions.

We appreciate your continued support and participation in this advertising Program. If you have questions or concerns, please write to us by using the Contact Us form available on Associates Central.

Gee Advertising, News , , ,

Java on Google AppEngine

March 26th, 2009

Looks like the next language that Google’s App Engine will support is going to be Java! I was hoping for PHP or maybe ruby, but this is pretty cool too. So far the python version is great and I’m sure this will be just as good!

via TechCrunch

Gee News , ,

wxWidgets GUI and Multiple Threads

March 26th, 2009

logo9This is an obscure tip, but if you are using wxWidgets as the GUI library in your application, this may come in handy. We currently use it for Remobo and it has served us well as a cross-platform GUI framework.  In particular we are using the C++ lib.

Never try to call any GUI related functions or even instantiate any wxWidgets GUI elements such as Frames and Dialogs from any other thread except the main one!

This is a documented caveat, but for some reason we thought it would be ok to just instantiate a custom wxDialog object in the secondary thread and leave the actual GUI calls to the main thread.  Turns out that even creating the object in a secondary worker thread will cause subsequent UI calls to hang indefinitely.  What made this worse is that it did not show up in MAC OS X but only on Windows…

We just spent a few days on this and it was impossible to find via regular debugging methods since the calls went deep into the Windows UI library… no fun at all. The solution is to call soemthing like wxPostEvent() to post some event from your secondary thread to the main thread and do all your wxWidgets stuff from there… including the wxWindow instantiation.

Gee C++, Remobo, Tips , ,

Buiding an iPhone Photo Sharing App on Google App Engine

March 18th, 2009

I did a “lightning talk” today at a local meetup for developers interested in cloud computing and Google’s App Engine specifically.  The demo covered the basics of how Rotzy (which is built entirely on AppEngine) works and what it does etc… but I also tried to fit in as many tips and tricks for using App Engine as I could.  Seemed like at least a few devs found it useful which is great!

Here are some of the (poorly made) slides I used while explaining some of the App Engine specific stuff.  Hopefully some more people will find it useful too.  Also, definitely check out Rotzy for the iPhone… it was built in our spare time and we are excited that it is growing steadily with a great community of users :-)

Gee Projects, Python, Tips, rotzy , , ,

Fun with My New Flip Mino HD

March 10th, 2009

This thing is tons of fun… super light and compact.  I use it mostly to take candid videos of my 16 month old son, but I also find myself bringing it out everywhere I go just for kicks :-)   Here’s a fun video I took today at our local Milk Tea hangout.

3 Straws, 3 Cups

Here’s a pic of the device itself… if you are in the market for a $200 mini HD camcorder then definitely check it out.

Its pretty cheap at Amazon right now or you can get it directly from the people who make it and customize it with custom colors and graphics.

Gee Fatherhood, Fun, News , ,

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

What Makes Twitter a Winner and Game-Changer?

February 13th, 2009

Today Twitter announced that they are receiving an additional $35 million in funding (even though they don’t really need it).

Erick Schonfeld from TechCrunch took the opportunity to ask IVP’s (Institutional Venture Partners) Todd Chaffee about why they decided to invest in Twitter at this stage. In response, he listed off a few reasons why Twitter is a winner and potential game-changer. These bullet points really caught my eye:

1. Open. That makes it easy for others to build on top of Twitter and it also makes it searchable.
2. Real time. It is a huge database of what is happening right now.
3. Ubiquitous. You can get to it from just about any device.
4. Scalable. (Don’t laugh)
5. Persistent. It allows for an archive of what is happening and what has happened, which is searchable (see No. 1).

Read more on that interview here

It seems so simple yet not many companies can cross every one of these points off the list.  I’ll definitely keep this in mind while moving forward with some of my projects.  At least two of them are heading in this direction (I hope): Remobo and Rotzy

Gee News, Twitter , ,

Google AppEngine High CPU Requests Removed

February 13th, 2009

Today Google announced that they have removed the “high cpu request” limit on their AppEngine platform.  This is great news as it used to limit your requests to a certain CPU usage quota… so any requests that used up too many cycles would eventually fail (if you did it too many times).

There is also one negative aspect to this.  The old quota really helps you to optimize your code to run fast and hence be more scalable.  Now that the quota is gone, it’ll be easier to be lazy about that :-(

Here are the recent changes that were announced:

  • No more “High CPU Requests”! App Engine Apps were once allowed no more than 2 CPU-intensive requests per minute. We’ve made some adjustments to the way we handle requests, and have eliminated this limitation altogether. To learn more about how this works and the implications for your app, see our documentation.
  • Response deadline raised to 30 seconds. The amount of time an App Engine app can take to respond to an incoming request has been raised from 10 to 30 seconds! There are limits on the number of simultaneous active requests an application can process at any given moment–see our docs to learn more.
  • Size limits on code files, static files, and requests/responses raised to 10MB! App Engine apps can now receive requests and send responses of up to 10MB in size, and users can upload 10MB code and static files as well. Note that API requests (e.g. memcache.set(), db.put()) are still limited to 1MB in size.

Gee News, Python , ,