Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

OSX build instructions

Jean-Christophe Houde edited this page May 30, 2014 · 8 revisions

Use these instructions to build the Fibernavigator on OSX (10.6 and later).

CMake

You will need to install CMake, which is a cross-platform open-source build system.

MacPorts

MacPorts is a utility to configure, compile and install tools and programs designed for the X11 system on a Mac. This can be used to install programs which you are used to, but are normally only available on Linux. You can get MacPorts. You should always take the time to check if the library or program you want has not been compiled natively on the Mac, because you can sometimes encounter problems when using MacPorts.

You will need to install MacPorts to install and correctly compile glew. Once MacPorts is installed, you can get it by issuing the following command

sudo port install glew +universal

Here, the "+universal" part is important if you want to compile both 32- and 64-bits builds. With the current situation of the Fibernavigator (which can only be compiled in 32 bits), the dual structure of glew is needed.

Configuring, compiling and using the Fibernavigator on a OSX 10.6 (or later) machine

By default, the compilation tools on recent versions of OSX target a x64 architecture. The problem with the current version of the Fibernavigator is that it uses the 2.8.x family of wxWidgets. This version is based on the Carbon framework, which does not support 64 bits builds. Therefore, the default settings of the compiler are not correct, and will create problems when using them to install wxWidgets via MacPorts. To work around this problem, you need to do the following steps.

Configure universal glew

If not already done, you can install the universal binaries of glew through MacPorts using

sudo port install glew +universal

which will compile a universal binary of glew, that can be used for 32 and 64 bits builds.

Additional step for OS X 10.8 or higher

If you want to compile on OS X 10.8 or higher, you will need to do this additional step, since the 10.6 SDK is not included in XCode anymore.

  1. Download the following SDK file.
  2. Untar it using
tar -xzf MacOSX10.6.sdk.tar.gz
  1. Copy the directory to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ . You may encounter some errors, they shouldn't cause any problem.
  2. Proceed to normal compilation.

Configure and build 32 bits wxWidgets

For the time being, the easiest solution to get the Fibernavigator running on the new MacBooks with OSX 10.6 or later is to manually compile wxWidgets, and link against this version. To do so, follow these steps. They were inspired in part by these steps.

  1. Get the source code for wxMac.
  2. Unpack the source in a directory of your choice.
  3. In the source folder (wxMac-2.8.12), create a subdirectory called something like build-release.
  4. Cd to this directory.
  5. Create a variable to hold the architecture type to use with the compiler using
arch_flags="-arch i386"
6.1. If on OSX 10.6, configure the build using the following command
../configure --with-opengl --prefix="/Users/houj2901/Documents/Utilitaires/Librairies/wxWidgets/wxMac-2.8.12/build-release/" CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
6.2. If on OSX 10.7, configure the build using:
../configure --with-opengl --prefix="/Users/houj2901/Documents/Utilitaires/Librairies/wxWidgets/wxMac-2.8.12/build-release/" CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"  --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
../configure --with-opengl --prefix="$(pwd)" CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/ --with-macosx-version-min=10.6
  1. Note that the "--prefix=" part is important for this setup. You should set it to the exact path where the libraries will be built. In the tested configuration, the libs stayed in the "Documents" folder of the user, since he didn't want to use them for all the system. It should also be possible to set it to "/usr/local/lib/" and do a "make install", but it hasn't been tested.
  2. Issue the "make" command. This can take between 5 and 10 minutes, depending on the machine.
  3. Once the librairies have been built, do a quick check using
otool -D libwx_base_carbon-2.8.0.dylib

in the build-release/lib directory. If the path written is the full path of the lib, you are ok.

Configure and build the Fibernavigator

With the wxWidgets librairies built, we can now configure and build the Fibernavigator. To do so, you must

  • Clone the source repo (see the Code page).
  • Create the make file or Xcode project using CMake. You can either call the ccmake command line tool, or use the CMake gui. The source directory should be set to the "src" subdirectory of your code, and the build directory should be set to the "build" subdirectory of your code.
  • When running ccmake or the CMake gui, you must make sure that
    • CMAKE_OSX_ARCHITECTURES is set to i386
    • wxWidgets_CONFIG_EXECUTABLE is set to the 'wx-config' program you generated when building wxWidgets. Normally, it should be in the "build-release" folder.
  • Once the variables have correctly been set, and the makefile or Xcode project has been generated, you can build the Fibernavigator as usual. It should then execute normally.