GemFAQ
View entire FAQ in full Up to Table of ContentsOS-X
How do I install GEM and Pd on Mac OS-X?
See the readme for installing Pd.
there is also an installer for macOS.
How do you compile Gem on OSX?
i want to compile Gem on my OSX machine, but wonder how to do? what are you (the upstream maintainer) using to compile Gem for the releases?
available build environemnts
you should be able to build Gem either using autoconf
or XCode
autoconf
coming from a linux background (and often running builds on remote machines), i personally prefer the "autoconf" build-system
this is also used for the Pd-extended autobuilds
setup for Gem-0.92.0
- PowerBook G4 running OSX 10.5.8
- FTGL/freetype2 have been compiled statically into a universal binary beforehand (by somebody; the URL is dead by now; i happen to have a local copy on my machine)
- all the rest seems to come with OSX
- i used autoconf (rather than XCode) with the following configure-line::
PKG_FTGL_CFLAGS="-I/Users/zmoelnig/Development/pd-gem/GemLibs/FTGL/freetype\ include/ -I/Users/zmoelnig/Development/pd-gem/GemLibs/FTGL/include/" PKG_FTGL_LIBS="/Users/zmoelnig/Development/pd-gem/GemLibs/FTGL/mac/build/Universal/libftgl.a" ./configure --with-pd=/Users/zmoelnig/Development/pure-data/pd --with-extension=d_fat --enable-fat-binary
notes on OSX-10.6 (aka "Snow Leopard")
- since i only have a PowerBook, i cannot upgrade to 10.6 (which has dropped support for PowerPC)
- users report that compilation works fine when forcing the build to be i386 only (OSX10.6 has no legacy support for ppc; Gem has no support for x86_64 on OSX yet).
for this to work you have to specify
--enable-fat-binary=i386
Xcode
in build/osx-xcode
you can find a xcode-project for Gem
font-support
you need FTGL (which in turn needs freetype)
for downloadable Gem-binaries it is better to have FTGL (and freetype) linked statically!
freetype
- get freetype-2.4.4 from e.g. sourceforge and unpack it
./configure --disable-shared --enable-biarch-config CFLAGS="-arch ppc -arch i386"
make && sudo make install
FTGL
- get FTGL from sourceforge (i did a checkout of the SVN trunk; today this was revision 1266)
./configure --without-x --disable-shared --disable-dependency-tracking CFLAGS="-arch i386 -arch ppc" CXXFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"
make && sudo make install
building Gem
these are the additional flags (rather environment variables) passed to Gem
./configure --disable-dependency-tracking --enable-fat-binary=ppc,i386 PKG_FTGL_CFLAGS="-I/usr/local/include/FTGL $(freetype-config --cflags)" PKG_FTGL_LIBS="-L/usr/local/lib/ -lftgl -lfreetype"
This FAQ applies to: 0.92.3, 0.92.0, 0.92svn, 0.92.2, 0.92.4
How do i make library dependencies local?
I want to ship dependencies side-by-side with my external and not have to install in the "correct" path (e.g. /sw/lib/)
OSX
on OSX you can change the path where a library is searched for with the install_name_tool
using the special path @loader_path
, the path where the external lives will be searched
here's a small script to make all /sw/lib/ dependencies "local":
for f in *.pd_darwin do otool -L ${f} | grep sw | awk '{print $1}' | while read i do j=@loader_path/${i##*/} echo $f $i $j install_name_tool -change ${i} ${j} ${f} done done
Here is the script that is used in the readanysf~ library for including lots of libraries using the above technique: embed-MacOSX-dependencies.sh
How do I make fat binaries?
I'd like to create multi-arch (aka: fat) binaries
multi-arch binaries (aka "fat" or "universal" binaries) are only possible on OSX.
super simple solution:
- pass the
--enable-fat-binary
flag to Gem's configure. by default, this will create fat binaries for PowerPC (ppc) and MacIntel (i386) - you can also specify the architectures, e.g.
--enable-fat-binary=x86_64
will create a "fat" binary with one architecture (MacIntel 64bit)
using compiler/linker flags:
- add "-arch
" (multiple times, if you need multiple architectures) to your compiler & linker flags; really, the super simple solution does exactly that behind the scenes - e.g. adding
-arch i386 -arch x86_64
to your CXXFLAGS and LDFLAGS will create fat binaries to run on MacIntel 32bit and 64bit
generating fat binaries from non-fat binaries:
- sometimes it is simpler to merge a number of non-fat binaries into a single fat binary
- using lipo for this:
lipo -create <file1> <file2> <...> -output <file>
- e.g.:
lipo -create ppc/Gem.pd_darwin i386/Gem.pd_darwin ia64/Gem.pd_darwin -output Gem.d_fat