Archive for May, 2008

building an fltk app on Mac OS X

Wednesday, May 21st, 2008

This is how I set up a FLTK project under XCode 3.0, which is current as of this writing. I assume that fltk is installed under /usr/local; if not then modify appropriately. This will produce an OS X application, meaning something you can double-click in Finder to run. Note that the link line below forces the project to be statically linked against the fltk libraries, instead of a dynamic link. The reason I do it this way instead of dragging the libraries into the project is because that part of XCode is horribly broken — a library reference in the GUI translates to the gcc command line option ‘-llibname‘ which will search for the library and prefer dynamic libraries.

Note also that the following settings will produce an app built with the default system SDK, so on Leopard it will build against 10.5 and not work on Tiger systems. To build a universal binary you need to make sure fltk was built against 10.4u and set the Base SDK Path appropriately.

  1. create a c++ command line tool project
  2. delete the command line program target
  3. add a new target of type Carbon C++ Application
  4. under the target “Build” preferences (command-i):
    • add the following to Other Linker Flags:
      -framework CoreServices -framework ApplicationServices -framework IOKit -framework AGL -framework OpenGL /usr/local/lib/libz.a /usr/local/lib/libfltk.a /usr/local/lib/libfltk_images.a /usr/local/lib/libfltk_jpeg.a /usr/local/lib/libfltk_gl.a /usr/local/lib/libfltk_png.a
    • add /usr/local/include to Header Search Paths
    • optionally add a precompiled header to be included everywhere (search for prefix)

  5. drag sources into the Source folder (or something else you create). be careful with the copy files into group option, it’s enabled by default.
  6. delete the automatically generated main.cpp
  7. Build and you’re done!

libdc1394 on OS X Leopard

Sunday, May 11th, 2008

After upgrading to Leopard I started getting the error message “Could not create LocalIsochPortInterface”. Eventually I found that building libdc1394 against the universal SDK did the trick, like this:

./configure CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386

Clearly something has changed in 10.5.