Compiling in Mac OS X

Jump to: navigation, search

Compiling for Mac OS X is not hard; someone else has already gone through the pain of compiling all dependencies and utilities. Compiling requires an Intel Mac.

  1. Download the Source
  2. Download a build of FB pre-1.06 [1]. This is a branch of the official version not yet merged in. The sources for this build are here. This is a WIP branch and definitely not ready to be merged upstream, but shouldn't take too long.
    • Either make sure that the fbc executable is in your PATH, or pass the fbc argument to scons to point to it.
  3. Install (extract somewhere) the SDL 1.2 and SDL_mixer frameworks: [2] [3] (You can actually use the SDL_mixer.Framework inside wip/mac/frameworks.tar.gz if you want, but not SDL.Framework)
    • scons looks for the frameworks both in /Library/Frameworks and ~/Library/Frameworks, or calls sdl-config.
  4. In the main 'wip' directory, run 'scons' as usual, or 'scons .', etc. All targets should work.
  5. Run ./ to produce and This is optional; you can just run ohrrpgce-custom and ohrrpgce-game directly
  6. You can run ./ to package a distribution.

C/C++/Objective-C compiler[edit]

You need clang or an Apple gcc compiler to compile objective-C code (mac/SDLMain.m) because the system headers use blocks, which aren't supported by FSF GCC without Apple's patch for blocks added. For example GCC from macports doesn't work. clang does support blocks. XCode 4.2/GCC 4.2.1 is tested and confirmed working.

In addition, fbc needs to run gcc. It does NOT support clang, at least not clang 3.6.1 from macports. I'm not actually sure whether a more version of clang from XCode works. That will need to be tested. Probably it does not. XCode 4.2/Apple GCC 4.2.1, and GCC 4.9.3 from MacPorts are both known to work.

Worst case, it is actually possible to use one compiler ('GCC') for fbc -gen gcc (use any version of real GCC), and a different compiler ('CC') for the C/C++/Objective-C code (any version of Apple gcc or clang or gcc-clang) like so:

 CC=clang GCC=/opt/local/bin/gcc scons

Things you don't need to compile[edit]

utilities.tar.gz also includes Intel-only builds of madplay and oggenc, which are otherwise stock.

wip/mac/Frameworks.tar.gz contains Intel-only builds of SDL and SDL_mixer; SDL.Framework is also missing headers to reduce its size. SDL_mixer has had a patch applied (see below) to fix Midi looping, though more recent SDL_mixer released have this fixed. Good luck trying to configure the Xcode projects to compile for Intel only.

FB 0.22 Mac port[edit]

This article (or part thereof) is obsolete. It may have made sense in the past, but it does not make sense now. It is kept here only for historic curiosity and/or posterity.

This information about the original port of FB 0.22 to OSX is preserved here for the moment.

Build of unofficial Mac port of FreeBASIC 0.22: [4]

Lately only compiling on OS 10.7 with XCode 4.2/GCC 4.2 has been tested, though all other versions of Mac OS should work too (only with a recent GCC?). OS 10.6 and 10.5 have previously been used; 10.4 has never been tested. 10.3 and older are PPC-only.

Compiling with support for older versions of Mac OS[edit]

(This section is out of date or incorrect)

By default compiling C code on OS 10.6+ will produce binaries that won't run on OS 10.4 and 10.5. To rectify this, you need a compatible build of FB, a compatible build of Euphoria, and have the OS 10.4 (recommended) or 10.5 SDK installed. Sadly you can't install these SDKs via more recent XCode versions; officially they are no longer supported, though they still seem to work.

  • FB for OS 10.4+: fixme
  • Euphoria 4.0.5 for OS 10.4+: [5]
(Note: the euc in this Euphoria build assumes that the OS 10.4 SDK is installed at /Developer/SDKs/MacOSX10.4u.sdk. If you want to compile on an actual 10.4/5 system without the SDK, get euc to generate a makefile and remove the -isysroot flag in it.

Compile with scons macsdk=10.4 or other Mac OSX SDK.

Actually you can use this FB build on all Intel Macs, but it produces annoying warning messages if not used in combination with with macsdk argument, and might not link correctly?

GPL Compliance[edit]