OS X Compiling Notes

From brainsik
Jump to navigation Jump to search

These notes came from OS X 10.4 and Xcode 2.x.

Xcode Packages

  • gcc4.0 - duh
  • DevSDK - the main deal (note: creates the gcc symlink, and others)
  • BSDSDK - for libcurl, libssl, and more
  • CoreAudio - for building anything accessing audio (like libao)
  • QuickTimeSDK - for building mplayer
  • OpenGLSDK - for building mplayer
  • X11SDK - for Xlib / Xlib Xrender, etc. (needed by Cairo, etc)

Other Packages

Install Python using the Mac OS X installer from python.org.

Optimizations

Aluminum powerbooks:

CFLAGS='-O3 -mcpu=7450 -faltivec'

Fixes / Workarounds

MTR [v0.72] needs this for it's DNS stuff:

CPPFLAGS="${CPPFLAGS} -DBIND_8_COMPAT"

Flac [v1.1.2] needs this until the asm stuff is sorted out:

./configure --disable-asm-optimizations

XviD [v1.1.4] maybe same situation as Flac:

./configure --disable-assembly

libao [v0.8.6] won't load the macosx audio driver. This can be seen as ogg123 failing to load a default audio driver. Fix the libao ./configure script (patch from Fink's libao2.patch for v0.8.4):

                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
         *-darwin*)
                 PLUGIN_LDFLAGS="-module -avoid-version"
-                DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore"
-                CFLAGS="-D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore"
-                PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore" ;;
+                DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
+                CFLAGS="-D__NO_MATH_INLINES -fsigned-char"
+                LIBS="-Wl,-framework -Wl,CoreAudio"
+                PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
         *)
                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"

freetype [v2.2.1] cannot pass Carbon framework linker options to other building systems. This results in other packages failing to install (such as fontconfig). See X11 font interference on OS X 10.4.8 for more information. Example error during make install:

/usr/X11R6/lib/X11/fonts/100dpi: dyld: lazy symbol binding failed: Symbol not found: _FSPathMakeRef
  Referenced from: /usr/local/lib/libfreetype.6.dylib
  Expected in: flat namespace

dyld: Symbol not found: _FSPathMakeRef
  Referenced from: /usr/local/lib/libfreetype.6.dylib
  Expected in: flat namespace

Explicitly set some linker flags:

export LDFLAGS="${LDFLAGS} -Xlinker -framework -Xlinker CoreServices \
                           -Xlinker -framework -Xlinker ApplicationServices"

fontconfig [v2.4.2] tries to use a non-existing directory for the cache. Create a directory and tell fontconfig to use it:

sudo mkdir -p /var/local/cache/fontconfig
./configure --with-cache-dir=/var/local/cache/fontconfig

jpeg [v6b] needs to specifically be told to install the libraries and headers:

make install-lib

gtk+ [v2.10.7] fails to compile part way through when using make -j3. A bunch of errors like this show up:

...file.la does not export GTK+ IM module API: dlopen(...file.so, 10):
Symbol not found: __cg_TIFFSetErrorHandler
  Referenced from: .../Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libTIFF.dylib

Rerunning with make without the -j option completes fine.