FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  


FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: [Patch] Embeddable Framework with deps on Mac OS X  (Read 2848 times)


  • Newbie
  • Posts: 5
    • View Profile
[Patch] Embeddable Framework with deps on Mac OS X
« on: April 11, 2011, 11:33:33 am »


I'm proposing a change to allow building as a framework with framework dependencies.  Attached are two patches to add support for this, and make it the default on Mac OS X.

First, you still need scons and SWIG from somewhere.  Macports works fine.  These are not runtime dependencies, only compile dependencies.

Second, I've broken it into two patches.  The first one is a the "real" patch, and the second one is a patch for generated files.  Since I have a different version of the autotools that was used to generate the build system for guichan, that diff is big and ugly, but mostly meaningless.  The second patch, I won't discuss.  It's not necessary if you run "autoreconf" yourself after apply the first patch, but you'll need all the autotools installed, and the effect on the finally svn diff will be similar.  It may be worthwhile to remove the generated files from svn and regenerate them prior to creating the tgz for distribution, like most autotools projects.

On to the first diff...

There are three basic pieces.  First is the change to build/  This eliminates all compile dependencies on /opt/local, and relies on frameworks for the dependencies.  The dependencies are expected to be installed into mac-ext.  I've posted a tgz of all the dependencies at  This includes a build of patched guichan, though there is more to the patch to allow rebuilding this.

The big issue with the dependencies right now is that for some of them, I didn't include the tools or instructions to recreate them.  Documentation will be my next step, and it will include all the code and instructions for rebuilding the deps as necessary.  SDL is already built as a framework on the website.  For boost, I have a little makefile that will build the frameworks with install_name_tool after the bjam build has run.  For ogg and vorbis, I tweaked the included xcode build files (mostly changed their install path to be @executable_path/../Frameworks).  The second issue is that I made no effort to get these dependencies working on 10.5.  They may work.  That probably won't.  That's fixable with compiler flags but I don't have 10.5 to test anymore.

The second piece are the changes to ext/SConscript to allow building guichan as a framework.  I've included a makefile that post-processes the built libraries to produce the frameworks.  I've changed ext/SConscript to call ./configure with the needed arguments on darwin, and make sure I call my post-processing makefile before copying the frameworks to mac-ext.   This makefile and perl script are nearly identical to what I use to build boost frameworks, for the curious.  This is not ideal.  The ideal solution would be to fix guichan to build the framework it it's own makefiles.  However I'm not in a hurry to learn libtool and the autotools right now as I'm still learning scons and pythong, and what I have today has the advantage that it works.

The third piece are all the changes to build Fife.framework.  This is mostly creating the right directory structure, and some linker flag changes.  Also symlinks.  The thing I don't like about this patch is that this is my first time with scons, (and probably the second or third time with python) so the symlink tasks feel like an egregious hack.  However it works.

A few more notes:

Since this is designed to be built as an application embedded framework, all the dependences and Fife.framework are expected to reside in "@executable_path/../Frameworks"  Ie. in your application's Frameworks folder.  This means you need to set DYLD_FRAMEWORK_PATH properly to locate the frameworks before you've built your app.  I'm assuming that whoever packages the app is going to want to embed the python framework as well.  py2app has support for this.  Because both of these are going to be embedded, I've changed the default install path of fife, for darwin framework builds to be "dest"

If you type scons install-all, "dest" will contain Fife.framework, libfife.a, and a python directory suitable for adding to your PYTHONPATH.

If you want to run the editor after building fife try this:
$ cd /path/to/fife-root
$ export PYTHONPATH=$(pwd)/dest/python
#(you could also use $(pwd)/engine/python)
$ export DYLD_FRAMEWORK_PATH=$(pwd)/mac-ext
$ cd tools/editor
$ ./

Obviously using py2app to build an is a good next step.

Also, I don't know about packaging but the python directory may be better suited in Fife.framework/Versions/Current/python (with a symlink at Fife.framework/python pointing to Versions/Current/python).  It doesn't really matter how it's packaged, as long as the .app bundle can eventually find it.  Whatever is easiest on py2app is probably best.

I didn't test Fife.framework.  I don't have a C++ fife game handy.  Also, mac-ext contains all of the boost libs, even though most of them aren't required for fife.  As apparently I'm the first person to make boost available as a framework, I made the whole thing available (who knows what C++ games use other parts of boost).

Please give feedback.  This is by no means perfect, it's functioning.

Ack -- patches too large:

links to patches:


  • Newbie
  • Posts: 5
    • View Profile
Re: [Patch] Embeddable Framework with deps on Mac OS X
« Reply #1 on: April 21, 2011, 11:45:11 pm »

Did you reply to the wrong topic?  Because I have no idea what you are quoting.


  • Developer
  • Full Member
  • *
  • Posts: 206
    • View Profile
Re: [Patch] Embeddable Framework with deps on Mac OS X
« Reply #2 on: May 01, 2011, 01:36:28 pm »

I tried the patch on a local copy of the 0.3.3dev branch. I only applied the first patch and ran the autoreconf myself as mentioned.

I have OS X 10.5.8

Here are my results/findings so far:

autoreconf by itself did not seem to work, i still got errors with build guichan instead i had to run:
cd <fife>/ext/guichan-0.8.2
glibtoolize -c -f
autoreconf -i

I don't know if the glibtoolize is absolutely necessary but i saw this on another site describing a similar problem and it got me past the problem.

Next I got an error stating that was not found so I made the following change:
In file <fife>/ext/guichan-0.3.2/fw-build/Makefile
I added a colon to the include line so it now looks like: include:

Now when i build I am having the following error and I am not sure how to get around it.

lots of build output....then this:
make all
cp -r ../dest/usr/local/include/* dist/Guichan.framework/Headers
cp: ../dest/usr/local/include/*: No such file or directory
make: *** [headers] Error 1


  • Developer
  • Full Member
  • *
  • Posts: 206
    • View Profile
Re: [Patch] Embeddable Framework with deps on Mac OS X
« Reply #3 on: October 01, 2011, 11:07:49 am »

I quickly gave this another try and encountered a little different outcome so I thought i would update the post.

After following the instructions above i ran the command:

scons install-shared

After I got a build error I combed through the output and noticed these:
Code: [Select]
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/BoostSystem.framework/BoostSystem, file is not of required architecture
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/BoostFilesystem.framework/BoostFilesystem, file is not of required architecture
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/BoostRegex.framework/BoostRegex, file is not of required architecture
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/GuichanSdl.framework/GuichanSdl, file is not of required architecture
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/Guichan.framework/Guichan, file is not of required architecture
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/Png.framework/Png, file is not of required architecture
ld warning: in /Users/jesse/Programming/fife/0.3.3dev/mac-ext/GuichanOpengl.framework/GuichanOpengl, file is not of required architecture

and my build error was:
Code: [Select]
ld: symbol(s) not found
collect2: ld returned 1 exit status
scons: *** [build/engine/release/Fife] Error 1

I am currently running OS X 10.5.8 (32-bit arch) and from the linker warnings and dsrogers first post it seems the frameworks are built using OS X 10.6 and do not seem compatible with 10.5.8.

It would be helpful as another data point if someone with 10.6 could try to build using these instructions to see if it works for them.