Difference between revisions of "HowTo compile on Mac"

From AMule Project FAQ
Jump to: navigation, search
(changed binary info from rc8 to cvs thread on forum)
Line 14: Line 14:
 
# [http://developer.apple.com/tools/xcode Xcode]
 
# [http://developer.apple.com/tools/xcode Xcode]
 
## Install [http://developer.apple.com/tools/xcode Xcode Tools] from http://developer.apple.com/tools/download
 
## Install [http://developer.apple.com/tools/xcode Xcode Tools] from http://developer.apple.com/tools/download
## "Getting ADC ID"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
+
## "Member Site"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
 
# [http://fink.sourceforge.net Fink]
 
# [http://fink.sourceforge.net Fink]
 
## Install (or verify installation if already installed) [http://fink.sourceforge.net Fink] from http://fink.sourceforge.net/download
 
## Install (or verify installation if already installed) [http://fink.sourceforge.net Fink] from http://fink.sourceforge.net/download

Revision as of 02:58, 11 February 2005

The following steps will lead you to install aMule in your MacOS X box.

Alternatively, you can get recent ready-to-use binaries of aMule for MacOS X from the following thread on the forum: http://forum.amule.org/thread.php?threadid=5051&sid=


This HowTo is written to compile and install aMule 2.0.0-rc8. It will not work for older versions. Please note that you should always download the latest aMule version available.

NOTE: This document explains how to download files using curl. However, curl might not be installed on your system: either install it (you can use Fink to install it) or download the files with whatever application you want (maybe your web browser), but place them in the directory that's being used on each part of the guide, otherwise the commands that are shown here will not work.

Setting up the required environment

These steps are one-time-only steps necessary for the steps in the following sections to work properly.

  1. Xcode
    1. Install Xcode Tools from http://developer.apple.com/tools/download
    2. "Member Site"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
  2. Fink
    1. Install (or verify installation if already installed) Fink from http://fink.sourceforge.net/download
  3. gettext
    1. Using Fink, install gettext. Read Fink's installation guide to learn how to install applications through Fink (the gettext package is gettext).
  4. Working directories
    1. Make amule dir in your home directory: mkdir ~/amule
    2. Make wxmac dir in your home directory: mkdir ~/wxmac

Obtaining wxMac sources

ATTENTION: wxMac 2.5.3 has a couple of bugs which cause aMule 2.0.0-rc8 to crash. One bug causes aMule to crash just after starting up, the other causes it to crash at a random later time :-(. The only work-around is to pull the wxWidgets sources from CVS!

You have two options, downloading a CVS snapshot or performing a checkout through the wxWidgets CVS server. The snapshot may be faster to download; the CVS server will give you the most up-to-date sources and the most flexibility if you need sources from a previous day (for example, to avoid bugs that may crop up in the ever-changing source). On the other hand, the sources from the snapshot, once extracted, take nearly 6 times as much disk space as those checked out from the CVS server because they include files not necessary for compiling on MacOS X.

Option 1: Obtaining wxMac sources from CVS snapshot

These instructions were adapted from http://wxwidgets.org/cvs.htm

  1. Enter the wxmac directory: cd ~/wxmac
  2. Get the wxMac CVS snapshot (found at http://wxwindows.sourceforge.net/snapshots as wx-cvs.tar.bz2) and place it in your ~/wxmac directory: curl -O http://biolpc22.york.ac.uk/pub/CVS_HEAD/wx-cvs.tar.bz2
  3. Extract it: tar -xjf wx-cvs.tar.bz2
  4. Optional: You may delete the archive after extracting its contents: rm wx-cvs.tar.bz2

Option 2: Obtaining wxMac sources from CVS server

These instructions were adapted from http://wxwidgets.org/cvs.htm

  1. Enter the wxmac directory: cd ~/wxmac
  2. Login (anonymously) to the wxWidgets CVS server (when prompted, enter anoncvs as the password): cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets login
  3. Checkout the wxMac sources from CVS: cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMac

Optional: Patching the wxMac sources

The wxMac sources still contain some bugs which cause aMule to leak memory. Patches to fix wxMac have been submitted to the wxWidgets team. These patches have not yet been approved by the wxWidgets developers and so should be considered experimental and approached with caution.

  1. Enter the wxmac directory: cd ~/wxmac
  2. Patch some memory leaks in wxMac.
    1. Download the patch files: curl "http://sourceforge.net/tracker/download.php?group_id=9863&atid=309863&file_id=112952&aid=1088052" -o ctable.patch "http://sourceforge.net/tracker/download.php?group_id=9863&atid=309863&file_id=112949&aid=1088038" -o bitmap.patch
    2. Apply the patches: cat ctable.patch bitmap.patch | patch -p0 -d wxWidgets

Installing wxMac from sources

  1. Enter the directory containing the wxMac sources: cd ~/wxmac/wxWidgets
  2. Directory build should already be there. If not, create it with: mkdir build
  3. Now enter build directory: cd build
  4. Prepare the compilation: ../configure
  5. And compile: make
  6. Now install wxMac compilation: sudo make install
  7. Get back to your home directory, you're done: cd ~
  8. Optional: If everything went ok, you can safely remove the wxMac sources (not recommended, since you might want to compile it again someday): rm -r ~/wxmac

Compiling and installing aMule

  1. Enter the amule directory: cd ~/amule
  2. Get aMule's latest source code (aMule 2.0.0-rc8 sourcecode: http://download.berlios.de/amule/aMule-2.0.0rc8.tar.bz2) and place it in your ~/amule directory: curl -O http://download.berlios.de/amule/aMule-2.0.0rc8.tar.bz2
  3. Extract it: tar -xjf aMule-2.0.0rc8.tar.bz2
  4. Enter aMule's sources directory: cd aMule-2.0.0rc8
  5. Prepare the compilation (thanks to one_2_one and Babboia for his test&fix): ./configure --disable-systray --disable-gtk --with-wx-config=/usr/local/bin/wx-config
  6. And compile it: make
  7. Optional: You can reduce the size of aMule from 44MB to 3MB by doing the following (anyway, this will make the aMule binary lose debug info, so you'll be unable to report problems to the aMule Team to make aMule a better program; so, it is not recommended): strip src/amule
  8. Copy the amule binary to the app-Container directory: cp src/amule aMule.app/Contents/MacOS/ (NOTE: If the MacOS directory is missing in aMule.app, create it by typing mkdir aMule.app/Contents/MacOS before executing the previous command. Thanks to dan for the tip)
  9. And copy aMule.app directory to your Applications folder: cp -R aMule.app /Applications
  10. Get back to your home directory, you're done: cd ~
  11. If everything went OK, you can safely remove the downloaded packages:
    1. Remove aMule's sources package: rm ~/amule/aMule-2.0.0rc8.tar.bz2
    2. Optionally remove the extracted aMule sources (not recommended, since you might want to compile it again someday): rm -r ~/amule

Problems and solutions

  • If Fink reports something like: After unpacking 11.2GB will be freed, don't be afraid. Fink has evolved into a different way of managing packet's size and some old ("old": at least some months old) packages' sizes aren't handled correctly on the output. If this is your case, devide the number by 1024. So, what the above example really means is: After unpacking 11.2MB will be freed.
  • If you get an error like this: You cannot open the application "amule" because it may be damaged or incomplete, right click on amule, then click on Show Packages Contents, go to "Contents">"MacOS"> and double click on amule. Next time you start from aMule.app it will run fine. If you still get the same error, move aMule.app to the desktop and run it from there.

Older releases

In older releases (aMule 2.0.0-rc7 and earlier), the app container wasn't included with the sources. If you are compiling any of this older releases and do not whish to upgrade (remember it is strongly recommended to upgrade to the latest release), you can:

You must extract the app container in your amule directory: possible ~/amule To extract it: tar -xjf aMule-App-Container.tar.bz2

NOTE: If the app-Container failed to extract try running this command instead of the app-Container extraction step: mkdir -p aMule.app/Contents/MacOS

Once the installation is finished, you can safely remove the app-Container package: rm aMule-App-Container.tar.bz2