• Home
  • What's Tribler
  • Download
  • FAQ
  • Forum
Tribler

Wiki Navigation


Universal Binary

A universal binary is a Mac executable which contains native code for both PPC and i386 platforms.

This page contains an incomplete guide on how Tribler was made Universal. It is incomplete because for some odd reason, I didn't have to recompile bsddb?

Prerequisites

You need:

  • The Mac OS/X 10.4u (Universal) SDK, found with XCode 2.2.1 or higher.
  • A universal version of Python (see http://www.python.org/download/releases/2.4.4/). You can check this with the file command:
    $ file -L `which python2.4` 
    /usr/local/bin/python2.4: Mach-O fat file with 2 architectures
    /usr/local/bin/python2.4 (for architecture i386):       Mach-O executable i386
    /usr/local/bin/python2.4 (for architecture ppc):        Mach-O executable ppc
    
  • A universal version of wxPython (http://prdownloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.1.1-universal10.4-py2.4.dmg).

Global picture

  1. Make sure you're always using the Universal Binary version of Python. Default install puts python at /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python.
  2. Follow the instructions below to build OpenSSL.
  3. Build M2Crypto. Make sure you wipe the old building dir first.
  4. Build Tribler.

OpenSSL

OpenSSL needs to be compiled twice: once for each platform. The following script can be used, following instructions http://developer.apple.com/opensource/buildingopensourceuniversal.html:

#!/bin/bash
mkdir -p build-ppc build-i386

# build PPC version
make clean
./Configure darwin-ppc-cc
make build_libs
mv *.a build-ppc

# build i386 version
make clean
./Configure 386 darwin-i386-cc
make build_libs "CC=cc -arch i386"
mv *.a build-i386

# merge them
for i in libssl.a libcrypto.a
do
  lipo -create -output $i build-ppc/$i build-i386/$i
  ranlib $i
done

You can verify that the created libraries are indeed fat:

$ file *.a
libcrypto.a: Mach-O fat file with 2 architectures
libcrypto.a (for architecture ppc):     current ar archive
libcrypto.a (for architecture i386):    current ar archive random library
libssl.a:    Mach-O fat file with 2 architectures
libssl.a (for architecture ppc):        current ar archive
libssl.a (for architecture i386):       current ar archive random library

M2Crypto

M2Crypto should compile correctly. Make sure you use the universal version of Python:

rm -rf build
python2.4 setup.py build

To verify the result:

$ file build/lib.macosx-*-fat-*/M2Crypto/__m2crypto.so 
build/lib.macosx-10.3-fat-2.4/M2Crypto/__m2crypto.so: Mach-O fat file with 2 architectures
build/lib.macosx-10.3-fat-2.4/M2Crypto/__m2crypto.so (for architecture i386):   Mach-O bundle i386
build/lib.macosx-10.3-fat-2.4/M2Crypto/__m2crypto.so (for architecture ppc):    Mach-O bundle ppc

Tribler

Finally we can build Tribler:

python2.4 setuptriblermac.py build

Verify the resulting application on both platforms to be sure :)

Latest news

29 April 2008

Tribler Team organized a successful course on Advanced P2P Technology
Read More

17 February 2008

19 Million Euro for P2P research
Read More

Please contact us if you have found a news item that's not listed here.


  • News
  • Developers
  • Business
  • Research
  • Jobs
  • About Us
  • Press
  • Contact
Login