Lars Pind

internet software, coaching, and entrepreneurship

Lars Pind - internet software, coaching, and entrepreneurship
Check out Coach TV, my video blog on happiness and personal development for geeks.

How do I compile Mac software?

November 15, 2005 · 13 comments

So I noticed that this FlickrExport thing is actually open source, so I figured I could change it to point to 23hq.com myself. But I have no idea how to compile this bastard, and my Xcode ignores me when I tell it to open the files in FlickrExport.xcodeproj.

Can any of you Mac gurus out there (Mark, others?) tell me how to make it compile? Doesn’t OS X ship with everything needed to make software for it?

blog comments powered by Disqus

13 responses so far ↓

  • 1 Guan Yang // Nov 15, 2005 at 11:17 PM

    1) You need a newer version of Xcode. 2) FlickrExport is open source, but it depends on the FlickrKit library, which isn't. There are many instances of flickr.com's hostname hardcorded in FlickrKit.
  • 2 Lars Pind // Nov 15, 2005 at 11:56 PM

    Thanks, Guan. svn co http://speirs.org/svn/FlickrKit/trunk gets you FlickrKit. Downloading Xcode 2.2 -- 2 hours 30 minutes to go.
  • 3 Lars Pind // Nov 16, 2005 at 10:55 AM

    I have it *almost* working, but now I'm stuck. I managed to compile the thing, and even produce a .dmg with the installer. But then when I open iPhoto, it doesn't work, and my console says this:
    2005-11-16 09:47:50.388 iPhoto[5638] *** -[NSBundle load]: Error loading code /Applications/iPhoto.app/Contents/PlugIns/FlickrExport.iPhotoExporter/Contents/MacOS/FlickrExport for bundle /Applications/iPhoto.app/Contents/PlugIns/FlickrExport.iPhotoExporter, error code 4 (link edit error code 4, error number 0 (Library not loaded: @executable_path/../Frameworks/Growl.framework/Versions/A/Growl
      Referenced from: /Applications/iPhoto.app/Contents/PlugIns/FlickrExport.iPhotoExporter/Contents/MacOS/FlickrExport
      Reason: image not found))
    2005-11-16 09:47:50.388 iPhoto[5638] Not a valid plugin: /Applications/iPhoto.app/Contents/PlugIns/FlickrExport.iPhotoExporter
    If I leave everything in the plugin, and just replace the FlickrExport with the one that Fraser does, then it works. Switch back to mine and it doesn't. So it's something about the linking that I can't figure out. I've tried with both the precompiled growl SDK, and with a compile-from-scratch, same result. How can I see what libraries a binary links to? Anything else I can try? If you want me to help you get this setup on your machine, let me know, there was quite a bit of detective work in getting everything working this far.
  • 4 Lars Pind // Nov 16, 2005 at 11:29 AM

    Guan helped me get to the next step. Here's what otool -L says about mine:
    FlickrExport:
            /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
            /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
            @executable_path/../Frameworks/Growl.framework/Versions/A/Growl (compatibility version 1.0.0, current version 1.0.0)
            @executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/FlickrKit.framework/Versions/A/FlickrKit (compatibility version 1.0.0, current version 1.0.0)
            /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.2)
    And here's what it says about Fraser's:
    FlickrExport:
            /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
            /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
            @executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/Growl.framework/Versions/A/Growl (compatibility version 1.0.0, current version 1.0.0)
            @executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/FlickrKit.framework/Versions/A/FlickrKit (compatibility version 1.0.0, current version 1.0.0)
            /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.2.1)
    Note how @executable_path needs to be relative to iPhoto, not to the plugin. And note also how even I have the right path for FlickrKit, but not for Growl. How do I coerce Xcode into doing the right thing here?
  • 5 Mark Aufflick // Jan 05, 2006 at 03:31 PM

    grr - sill Ajax posting thingamy crashed my firefox, so here goes again! I don't know why the Growl link path doesn't match the (correct) one for the FlikrKit framework, but you can manually solve the problem like so:
    PowerBook-G4$ otool -L FlickrExport 
    FlickrExport:
    	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 9.0.0)
    	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
    	@executable_path/../Frameworks/Growl.framework/Versions/A/Growl (compatibility version 1.0.0, current version 1.0.0)
    	@executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/FlickrKit.framework/Versions/A/FlickrKit (compatibility version 1.0.0, current version 1.0.0)
    	/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.3)
    
    PowerBook-G4$ install_name_tool -change @executable_path/../Frameworks/Growl.framework/Versions/A/Growl @executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/Growl.framework/Versions/A/Growl FlickrExport 
    
    PowerBook-G4$ otool -L FlickrExport 
    FlickrExport:
    	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 9.0.0)
    	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
    	@executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/Growl.framework/Versions/A/Growl (compatibility version 1.0.0, current version 1.0.0)
    	@executable_path/../PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/FlickrKit.framework/Versions/A/FlickrKit (compatibility version 1.0.0, current version 1.0.0)
    	/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.3)
    
    PowerBook-G4$
    the install_name_tool command is in my path as /usr/bin/install_name_tool. If you can't figure out how to make Xcode/gcc link it right in the first place, I don't see aproblem with adding this command to a script step in the build process. Hvad skal vi have til frokost?
  • 6 Lars Pind // Jan 05, 2006 at 11:42 PM

    You rock! Thanks so much for figuring out how to solve this. Sorry about crashing your browser. Vi skal have sild!
  • 7 Lars Pind // Mar 16, 2006 at 11:09 AM

    Here are some instructions I receieved straight from the horse's mouth (Fraser): 1. .xcodeproj files are only supported in (IIRC) Xcode 2.2 and later. 2. You need to build your own version of Growl - the precompiled one has an incorrect (for our purposes) install path. You can: 2.1 Check out a particular tag of Growl from svn. I usually pull the latest release (0.7.4 right now?) 2.2 Open the Growl project and set the value of INSTALL_PATH for the Growl.framework target to: @executable_path/../Contents/PlugIns/FlickrExport.iPhotoExporter/Contents/Frameworks/ 3.Make sure the FlickrExport project references that framework (and make sure it gets copied into Frameworks/ in the Copy Files build phase.
  • 8 Matt Perreault // Jun 29, 2006 at 03:11 AM

    I've been trying to compile FlickrExport 1.3.4 and I'm having the same problems with the Growl error thing... I really don't know much about what I'm doing... Where do I find the Growl source if I need to compile my own version? Thanks! -Matt
  • 9 Matt Perreault // Jun 29, 2006 at 04:05 AM

    I found the Growl Source... Now I'm trying to compile it for myself... which file do I change the target in??? I'm referring to what you describe in post #7...
  • 10 Lars Pind // Jun 29, 2006 at 07:59 AM

    I never acually got around to compiling this, since right after Fraser told me about it, he released FlickrExport with 23 support himself. I'd switched to a new computer, and getting this all setup for compilation when normally I don't do any Xcode stuff was just too painful. Sorry.
  • 11 Matt Perreault // Jun 29, 2006 at 12:02 PM

    So far it's like pulling teeth... :)
  • 12 Mike Purvis // Jul 07, 2006 at 06:15 AM

    Hi everyone, I have a question about comment #3 above. I've recompiled Photon as a Universal binary for iPhoto 6, and it seems to be at least partially working, but there are aspects that are obviously failing silently. I'm just confused where you got "the console" from. I'm pretty new to OSX development, so it might be something obvious that I'm just missing. Is it just an error log somewhere that you're tailing? Thanks!
  • 13 Mark Aufflick // Jul 07, 2006 at 07:12 AM

    Hi Mike, Yes, the console is an app that shows you the standard console output. On a traditional Unix box, the console is a single serial terminal attached to the physical server. On MacOSX you will find an application that shows you not only the console output but also a whole load of crash logs etc. Go to the Utilities folder inside the Applications folder and you will find it.