Difference between revisions of "HowTo compile on Mac"

From AMule Project FAQ
Jump to: navigation, search
Line 6: Line 6:
 
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.
 
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.
  
'''ATTENTION:''' [[wxMac]] 2.5.3 has a bug which causes [[aMule]] 2.0.0-rc8 to crash just after starting up :-(. The only work-around to compile [[wxMac]] without this bug and to have [[aMule]] 2.0.0-rc8 running is to pull the wxWidgets sources from CVS! See http://wxwidgets.org/cvs.htm to see how to do that. Then cd to the newly created directory wxWidgets and continue with step 6 in the chapter "Installing [[wxMac]] form sources" below.
+
'''NOTE:''' This document explains how to download files using [http://curl.haxx.se curl]. However, [http://curl.haxx.se curl] might not be installed on your system: either install it (you can use [http://fink.sourceforge.net Fink] to instal 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.
  
'''NOTE:''' This document explains how to download files using [http://curl.haxx.se curl]. However, [http://curl.haxx.se curl] might not be installed on your system: either install it (you can use [http://fink.sourceforge.net Fink] to instal it) or download the files with whatever application you want (maybe your web browser), but place then 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 ==
  
== Compiling and installing [[aMule]] ==
+
These steps are one-time-only steps necessary for the steps in the following sections to work properly.
  
# Install [http://developer.apple.com/tools/xcode Xcode Tools] from http://developer.apple.com/tools/download
+
# Xcode
# "Getting ADC ID"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
+
## Install [http://developer.apple.com/tools/xcode Xcode Tools] from http://developer.apple.com/tools/download
# Install (or verify installation if already installed) [http://fink.sourceforge.net Fink], since [http://www.gnu.org/software/gettext gettext] and [[wxMac]] are installed along with [http://fink.sourceforge.net Fink], from http://fink.sourceforge.net/download
+
## "Getting ADC ID"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
# Install [http://www.gnu.org/software/gettext gettext] and [[wxMac]] ([[wxMac]] is only available through [http://fink.sourceforge.net Fink] [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable unstable] on [http://www.apple.com/macosx MacOS] 10.3. If you are using [http://fink.sourceforge.net Fink] stable or [http://www.apple.com/macosx MacOS] 10.2 or earlier, either [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable upgrade Fink to unstable] and/or [http://www.apple.com/macosx MacOS] to 10.3, or check the [[#Installing wxMac from sources|Installing wxMac from sources section]] of this document and then go on with this section) through [http://fink.sourceforge.net Fink]. Read [http://fink.sourceforge.net/download Fink's installation guide] to learn how to install applications through [http://fink.sourceforge.net Fink] (the [http://www.gnu.org/software/gettext gettext] package is ''gettext'' and the [[wxMac]] package is ''wxmac'' and ''wxmac-shlibs''),
+
# Fink
# Read the documentation at http://fink.sourceforge.net/download to learn how to install [[wxMac]].
+
## Install (or verify installation if already installed) [http://fink.sourceforge.net Fink] from http://fink.sourceforge.net/download
# Make ''amule'' dir in your home directory: ''mkdir ~/amule''
+
# gettext
# Enter the ''amule'' directory you just created: ''cd ~/amule''
+
## Using [http://fink.sourceforge.net Fink], install [http://www.gnu.org/software/gettext gettext].  Read [http://fink.sourceforge.net/download Fink's installation guide] to learn how to install applications through [http://fink.sourceforge.net Fink] (the [http://www.gnu.org/software/gettext gettext] package is ''gettext'').
# Get [[aMule]]'s latest source code (aMule 2.0.0-rc8 sourcecode: [http://download.berlios.de/amule/aMule-2.0.0rc8.tar.bz2 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''
+
# Working directories
# Extract it: ''tar -xjf aMule-2.0.0rc8.tar.bz2''
+
## Make ''amule'' dir in your home directory: ''mkdir ~/amule''
# Enter [[aMule]]'s sources directory: ''cd aMule-2.0.0rc8''
+
## Make ''wxmac'' dir in your home directory: ''mkdir ~/wxmac''
# Prepare the compilation (thanks to '''one_2_one''' and '''Babboia''' for his test&fix): ''./configure --disable-systray --disable-gtk --with-wx-config=/sw/bin/wx-config''
+
# And compile it: ''make''
+
# '''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 devs|aMule Team]] to make [[aMule]] a better program, which it is not recommended): ''strip src/amule''
+
# 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)
+
# And copy ''amule.app'' directory to your Applications folder: ''cp -R amule.app /Applications''
+
# If everything went OK, you can safely remove the downloaded packages:
+
## Remove [[aMule]]'s sources package: ''rm ~/amule/aMule-2.0.0rc8.tar.bz2''
+
## Optionally remove the extracted [[aMule]] sources (not recommended, since you might want to compile it again someday): ''rm -r ~/amule/aMule-2.0.0rc8''
+
## Optionally, if you if you decided to remove the extracted [[aMule]] sources, remove the ''~/amule'' directory (which should be empty by now): ''rmdir ~/amule''
+
  
== Installing [[wxMac]] from sources ==
+
== Obtaining [[wxMac]] sources ==
  
Only follow this part of the guide if [[wxMac]] is not available through your [http://fink.sourceforge.net Fink] installation or if you really know what you're doing. In any other case, just jump to the next section.
+
'''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!
  
# Create a directory where all the work will be done: ''mkdir ~/wxmac''
+
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.
# Enter that directory: ''cd ~/wxmac''
+
 
# Download [[wxMac]] sources: ''curl -O ftp://biolpc22.york.ac.uk/pub/2.5.3/wxMac-2.5.3.tar.gz''
+
=== '''Option 1:''' Obtaining [[wxMac]] sources from CVS snapshot ===
# Extract the file: ''tar -xzf wxMac-2.5.3.tar.gz''
+
 
# Enter the extracted sources' directory: ''cd wxMac-2.5.3''
+
These instructions were adapted from http://wxwidgets.org/cvs.htm
 +
 
 +
# Enter the ''wxmac'' directory: ''cd ~/wxmac''
 +
# Get the [[wxMac]] CVS snapshot (found at [http://wxwindows.sourceforge.net/snapshots/ 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''
 +
# Extract it: ''tar -xjf wx-cvs.tar.bz2''
 +
# '''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
 +
 
 +
# Enter the ''wxmac'' directory: ''cd ~/wxmac''
 +
# 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''
 +
# Checkout the [[wxMac]] sources from CVS: ''cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMac''
 +
 
 +
== Patching the [[wxMac]] sources ==
 +
 
 +
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.
 +
 
 +
# Enter the ''wxmac'' directory: ''cd ~/wxmac''
 +
# Patch the crashing bug 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''
 +
## Apply the patches: ''cat ctable.patch bitmap.patch | patch -p0 -d wxWidgets''
 +
 
 +
== Installing [[wxMac]] from sources ==
 +
 
 +
# Enter the directory containing the [[wxMac]] sources: ''cd ~/wxmac/wxWidgets''
 
# Directory ''build'' should already be there. If not, create it with: ''mkdir build''
 
# Directory ''build'' should already be there. If not, create it with: ''mkdir build''
 
# Now enter ''build'' directory: ''cd build''
 
# Now enter ''build'' directory: ''cd build''
Line 47: Line 67:
 
# Now install [[wxMac]] compilation: ''sudo make install''
 
# Now install [[wxMac]] compilation: ''sudo make install''
 
# Get back to your home directory, you're done: ''cd ~''
 
# Get back to your home directory, you're done: ''cd ~''
# If everything went ok, you can safely remove:
+
# '''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
## [[wxMac]]'s sources package: ''rm wxMac-2.5.3.tar.gz''
+
 
## Optionally remove the extracted [[wxMac]] sources (not recommended, since you might want to compile it again someday): ''rm -r ~/wxmac
+
== Compiling and installing [[aMule]] ==
 +
 
 +
# Enter the ''amule'' directory: ''cd ~/amule''
 +
# Get [[aMule]]'s latest source code (aMule 2.0.0-rc8 sourcecode: [http://download.berlios.de/amule/aMule-2.0.0rc8.tar.bz2 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''
 +
# Extract it: ''tar -xjf aMule-2.0.0rc8.tar.bz2''
 +
# Enter [[aMule]]'s sources directory: ''cd aMule-2.0.0rc8''
 +
# 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''
 +
# And compile it: ''make''
 +
# '''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 devs|aMule Team]] to make [[aMule]] a better program; so, it is not recommended): ''strip src/amule''
 +
# 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)
 +
# And copy ''amule.app'' directory to your Applications folder: ''cp -R amule.app /Applications''
 +
# Get back to your home directory, you're done: ''cd ~''
 +
# If everything went OK, you can safely remove the downloaded packages:
 +
## Remove [[aMule]]'s sources package: ''rm ~/amule/aMule-2.0.0rc8.tar.bz2''
 +
## Optionally remove the extracted [[aMule]] sources (not recommended, since you might want to compile it again someday): ''rm -r ~/amule''
  
'''NOTE:''' Since you're installing [[wxMac]] from sources instead of through [http://fink.sourceforge.net Fink], use ''./configure --disable-systray --disable-gtk --with-wx-config=/usr/local/bin/wx-config'' as your configure command at [[aMule]]'s compilation instead of ''./configure --disable-systray --disable-gtk --with-wx-config=/sw/bin/wx-config''
 
  
 
== Problems and solutions ==
 
== Problems and solutions ==

Revision as of 03:24, 15 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 instal 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 and patch them!

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.

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

Patching the wxMac sources

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.

  1. Enter the wxmac directory: cd ~/wxmac
  2. Patch the crashing bug in wxMac
    1. Download the patch file: curl "http://sourceforge.net/tracker/download.php?group_id=9863&atid=309863&file_id=114017&aid=1093852" -o doublefree.patch
    2. Apply the patch to the sources: patch -d wxWidgets -p0 <doublefree.patch
  3. Optional: 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