Difference between revisions of "HowTo compile on Mac"

From AMule Project FAQ
Jump to: navigation, search
Line 25: Line 25:
 
== Obtaining [[wxMac]] sources ==
 
== 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 and patch them!
+
'''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 Mac OS X.
 
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 Mac OS X.
 +
 +
'''NOTE:''' As of 2005-01-18, the wxMac developers have approved the patch for the last of these crashing bugs.  Therefore, it is no longer necessary for you to apply any patches yourself.  A checkout from the CVS server will include the fix.  The CVS snapshot won't include the fix until 2005-01-19, so until then use the CVS server checkout method.
  
 
=== '''Option 1:''' Obtaining [[wxMac]] sources from CVS snapshot ===
 
=== '''Option 1:''' Obtaining [[wxMac]] sources from CVS snapshot ===
Line 46: Line 48:
 
# Checkout the [[wxMac]] sources from CVS: ''cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMac''
 
# Checkout the [[wxMac]] sources from CVS: ''cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMac''
  
== Patching the [[wxMac]] sources ==
+
== '''Optional:''' Patching the [[wxMac]] sources ==
 +
 
 +
'''NOTE:''' As explained above, it is no longer necessary to patch the [[wxMac]] sources to avoid crashing bugs.  This section remains for those adventurous souls willing to apply the as-yet-unapproved patches for some memory leaks.
  
The [[wxMac]] sources still contain some bugs which affect aMule.  One causes aMule to crash at random times.  Others 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.  However, since the crashing bug seriously hampers the use of aMule, and several Mac aMule users have successfully tested the patch, you are strongly encouraged to apply it.  You should exercise judgment in applying the other patches.
+
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.
  
 
# Enter the ''wxmac'' directory: ''cd ~/wxmac''
 
# Enter the ''wxmac'' directory: ''cd ~/wxmac''
# Patch the crashing bug in [[wxMac]]
+
# Patch some memory leaks in [[wxMac]].
## Download the patch file: ''curl "http://sourceforge.net/tracker/download.php?group_id=9863&atid=309863&file_id=114017&aid=1093852" -o doublefree.patch''
+
## Apply the patch to the sources: ''patch -d wxWidgets -p0 <doublefree.patch''
+
# '''Optional:''' Patch some memory leaks in [[wxMac]].
+
 
## 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''
 
## 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''
 
## Apply the patches: ''cat ctable.patch bitmap.patch | patch -p0 -d wxWidgets''
 
## Apply the patches: ''cat ctable.patch bitmap.patch | patch -p0 -d wxWidgets''

Revision as of 17:43, 18 January 2005

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

You can get also the most recent binnary of aMule for MacOS X dowloading this: http://download.berlios.de/amule/aMule.zip


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. "Getting ADC ID"->"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 Mac OS X.

NOTE: As of 2005-01-18, the wxMac developers have approved the patch for the last of these crashing bugs. Therefore, it is no longer necessary for you to apply any patches yourself. A checkout from the CVS server will include the fix. The CVS snapshot won't include the fix until 2005-01-19, so until then use the CVS server checkout method.

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

NOTE: As explained above, it is no longer necessary to patch the wxMac sources to avoid crashing bugs. This section remains for those adventurous souls willing to apply the as-yet-unapproved patches for some memory leaks.

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