Difference between revisions of "HowTo compile on Mac"

From AMule Project FAQ
Jump to: navigation, search
(Get and install the aMule binary release or compile it from source on Mac OSX)
Line 1: Line 1:
The following steps will lead you to install [[aMule]] in your [http://www.apple.com/macosx MacOS X] box.
+
How to get and install [[aMule]] on [http://www.apple.com/macosx/ Apple Mac OSX].
  
Alternatively, you can get recent ready-to-use binaries of [[aMule]] for [http://www.apple.com/macosx MacOS X] from the following thread on the forum: http://forum.amule.org/thread.php?threadid=5051
+
# You can simply download the finished application ('binary release') or
 +
# you compile it from a cvs source snapshot.
  
 +
''The preceding version of this page covering aMule 2.0.0rc8 and earlier is archived [[HowTo_compile_on_Mac_v200rc8|here]].
  
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.
+
== Binary releases ==
  
'''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 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.
+
If you don't want to bother with installing and compiling all those tools and sources, then get one of the pre-compiled aMule applications. The official release is considered 'stable', but every now and then applications are built from the current source to allow more people to test new features or the like.  
  
== Setting up the required environment ==
+
# latest official binary release: [http://www.amule.org/files/download.php?file=72 aMule-2.0.0-Mac]
 +
# periodically compiled binary from cvs: [http://forum.amule.org/thread.php?threadid=5051 amule forum]
  
These steps are one-time-only steps necessary for the steps in the following sections to work properly.
+
== Compiling from source ==
  
# [http://developer.apple.com/tools/xcode Xcode]
+
Compiling from source allows most current bug reports, because you can compile and test the cvs snapshot of the very day.
## Install [http://developer.apple.com/tools/xcode Xcode Tools] from http://developer.apple.com/tools/download
+
## "Member Site"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
+
# [http://fink.sourceforge.net Fink]
+
## Install (or verify installation if already installed) [http://fink.sourceforge.net Fink] from http://fink.sourceforge.net/download
+
# [http://www.gnu.org/software/gettext gettext]
+
## 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'').
+
# Working directories
+
## Make ''amule'' dir in your home directory: ''mkdir ~/amule''
+
## Make ''wxmac'' dir in your home directory: ''mkdir ~/wxmac''
+
  
== Obtaining [[wxMac]] sources ==
+
To compile aMule from source you need some development tools, the wxWidgets library and the aMule source.
  
# Enter the ''wxmac'' directory: ''cd ~/wxmac''
+
=== Get the sources and development tools ===
# Get the [[wxMac]] source tarball and place it in your ''~/wxmac'' directory: ''curl -O http://dl.sourceforge.net/wxwindows/wxMac-2.5.4.tar.gz''
+
# Extract it: ''tar -xzf wxMac-2.5.4.tar.gz''
+
# '''Optional:''' You may delete the archive after extracting its contents: ''rm wxMac-2.5.4.tar.gz''
+
  
== Installing [[wxMac]] from sources ==
+
==== [http://developer.apple.com/tools/xcode Xcode] ====
  
# Enter the directory containing the [[wxMac]] sources: ''cd ~/wxmac/wxMac-2.5.4''
+
'XCode' is Apple's development environment. We need it for the gcc compiler. You may have XCode on CD/DVD, e.g. it is on the OSX10.4 DVD.
# Directory ''build'' should already be there. If not, create it with: ''mkdir build''
+
Else you can download it from Apple, but you must sign up for a free-of-charge developer account first.
# Now enter ''build'' directory: ''cd build''
+
# Get XCode from http://developer.apple.com/tools/download
# Prepare the compilation: ''../configure''
+
# "Member Site"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"
# And compile: ''make''
+
# Now install [[wxMac]] compilation: ''sudo make install''
+
# Get back to your home directory, you're done: ''cd ~''
+
# '''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]] ==
 
  
# Enter the ''amule'' directory: ''cd ~/amule''
+
==== [http://fink.sourceforge.net Fink] ====
# 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). You should check the [[configure]] article: ''./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''
+
  
== Problems and solutions ==
+
'Fink' is an open source (OS) installer for lots of OS tools ported to Mac OSX. We need it to install the OS tool 'gettext'.
 +
# Get Fink from http://fink.sourceforge.net/download
 +
# Read [http://fink.sourceforge.net/download Fink's installation guide] to learn how to install applications through Fink.
  
*If [http://fink.sourceforge.net Fink] reports something like: ''After unpacking 11.2GB will be freed'', don't be afraid. [http://fink.sourceforge.net 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.
+
==== [http://www.gnu.org/software/gettext gettext] ====
  
== Older releases ==
+
'gettext' is an OS library for text internationalization. This library is used to make aMule multi-lingual.
 +
# get and install the 'gettext' library with 'Fink'. The package name is 'gettext'.
  
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:
 
  
*Download the latest [[aMule]] sources and get the app container from there (recommended option).
+
==== [http://www.wxwidgets.org/ wxMac] ====
*Download [http://download.berlios.de/amule/aMule-App-Container.tar.bz2 aMule's app-Container]: ''curl -O http://download.berlios.de/amule/aMule-App-Container.tar.bz2''
+
  
You must extract the app container in your ''amule'' directory: possible ''~/amule''
+
'wxMac' is the port of the 'wxWidgets' library for Mac OSX. This library is used to make aMule 'multi-platform'.
To extract it: ''tar -xjf aMule-App-Container.tar.bz2''
+
# Get the source from: http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.0.tar.gz
 +
# Extract the archive. (just double-click it.)
  
'''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''
+
Or get the current cvs snapshot. Warning: the wxMac cvs is frequently in a bad condition.
  
Once the installation is finished, you can safely remove the app-Container package: ''rm aMule-App-Container.tar.bz2''
+
<pre>    bash: cd ~/Desktop
 +
    bash: cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets login
 +
    Note: password is 'anoncvs'
 +
    bash: cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMac
 +
</pre>
 +
 
 +
 
 +
==== [http://www.amule.org aMule itself] ====
 +
 
 +
# Get latest daily cvs source snapshot: [http://www.amule.org/files/download.php?file=5 aMule CVS]
 +
# Extract the archive. (just double-click it.)
 +
 
 +
 
 +
=== Compile the sources ===
 +
 
 +
Put the amule folder and the wxMac folder at the same place, e.g. on the desktop.
 +
 
 +
'''Important:''' If you use XCode 2.0 then your default compiler is gcc 4.0. Currently (2005-05-09) wxMac then only compiles with patches, and the CryptoPP library does not compile at all. Therefore, if you use XCode 2.0 then you must switch back to gcc 3.3 first. First check the version of your current default gcc with ''gcc --version'' and then switch to version 3.3 if required:
 +
 
 +
<pre>    bash: gcc --version
 +
    bash: sudo gcc_select 3.3
 +
</pre>
 +
 
 +
 
 +
 
 +
==== Compile wxMac ====
 +
 
 +
This step is only needed once, even if you later download and compile a newer version of the aMule cvs source.
 +
 
 +
The following assumes that you have placed the above packages on your Desktop.<br>
 +
'cd' into the wxMac folder, 'configure' and 'make':
 +
 
 +
<pre>    bash: cd ~/Desktop/wxMac-2.6.0/build
 +
    bash: ../configure --disable-shared --enable-unicode
 +
    bash: make
 +
</pre>
 +
 
 +
This took approx. 30 minutes on my G4 at 1 GHz.
 +
 
 +
==== Compile aMule ====
 +
 
 +
Now 'cd' into the amule folder, 'configure' and 'make':<br>
 +
((note: you can copy&paste the 4 lines for './configure' in one go))
 +
 
 +
<pre>    bash: cd ~/Desktop/aMule
 +
    bash: ./configure --disable-systray --disable-gtk    \
 +
            --with-wx-prefix=../wxMac-2.6.0/build/lib/    \
 +
            --with-wx-config=../wxMac-2.6.0/build/wx-config \
 +
            --enable-debug --disable-optimise                    <-- OPTIONAL
 +
         
 +
    bash: make
 +
    bash: strip src/amule                                        <-- OPTIONAL
 +
    bash: mv src/amule aMule.app/Contents/MacOS/
 +
</pre>
 +
 
 +
the two lines marked as OPTIONAL are optional, that is, the last two options to ./configure and the strip command. They result in a dramatically reduced file size (approx. 3 MB instead of 50 MB) but disable all possibilities to submit a helpful stacktrace if amule crashes or a sample if it hangs to the [[aMule devs|aMule developers]].
 +
 
 +
 
 +
 
 +
 
 +
 
 +
=== Problems and solutions ===
 +
 
 +
*If [http://fink.sourceforge.net Fink] reports something like: ''After unpacking 11.2GB will be freed'', don't be afraid. [http://fink.sourceforge.net 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.

Revision as of 22:39, 9 May 2005

How to get and install aMule on Apple Mac OSX.

  1. You can simply download the finished application ('binary release') or
  2. you compile it from a cvs source snapshot.

The preceding version of this page covering aMule 2.0.0rc8 and earlier is archived here.

Binary releases

If you don't want to bother with installing and compiling all those tools and sources, then get one of the pre-compiled aMule applications. The official release is considered 'stable', but every now and then applications are built from the current source to allow more people to test new features or the like.

  1. latest official binary release: aMule-2.0.0-Mac
  2. periodically compiled binary from cvs: amule forum

Compiling from source

Compiling from source allows most current bug reports, because you can compile and test the cvs snapshot of the very day.

To compile aMule from source you need some development tools, the wxWidgets library and the aMule source.

Get the sources and development tools

Xcode

'XCode' is Apple's development environment. We need it for the gcc compiler. You may have XCode on CD/DVD, e.g. it is on the OSX10.4 DVD. Else you can download it from Apple, but you must sign up for a free-of-charge developer account first.

  1. Get XCode from http://developer.apple.com/tools/download
  2. "Member Site"->"Log In"->"Download Software"->"Developer Tools"->"Download Xcode Tools last release">"Install"


Fink

'Fink' is an open source (OS) installer for lots of OS tools ported to Mac OSX. We need it to install the OS tool 'gettext'.

  1. Get Fink from http://fink.sourceforge.net/download
  2. Read Fink's installation guide to learn how to install applications through Fink.


gettext

'gettext' is an OS library for text internationalization. This library is used to make aMule multi-lingual.

  1. get and install the 'gettext' library with 'Fink'. The package name is 'gettext'.


wxMac

'wxMac' is the port of the 'wxWidgets' library for Mac OSX. This library is used to make aMule 'multi-platform'.

  1. Get the source from: http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.0.tar.gz
  2. Extract the archive. (just double-click it.)

Or get the current cvs snapshot. Warning: the wxMac cvs is frequently in a bad condition.

    bash: cd ~/Desktop
    bash: cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets login
    Note: password is 'anoncvs'
    bash: cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMac


aMule itself

  1. Get latest daily cvs source snapshot: aMule CVS
  2. Extract the archive. (just double-click it.)


Compile the sources

Put the amule folder and the wxMac folder at the same place, e.g. on the desktop.

Important: If you use XCode 2.0 then your default compiler is gcc 4.0. Currently (2005-05-09) wxMac then only compiles with patches, and the CryptoPP library does not compile at all. Therefore, if you use XCode 2.0 then you must switch back to gcc 3.3 first. First check the version of your current default gcc with gcc --version and then switch to version 3.3 if required:

    bash: gcc --version
    bash: sudo gcc_select 3.3


Compile wxMac

This step is only needed once, even if you later download and compile a newer version of the aMule cvs source.

The following assumes that you have placed the above packages on your Desktop.
'cd' into the wxMac folder, 'configure' and 'make':

    bash: cd ~/Desktop/wxMac-2.6.0/build
    bash: ../configure --disable-shared --enable-unicode 
    bash: make

This took approx. 30 minutes on my G4 at 1 GHz.

Compile aMule

Now 'cd' into the amule folder, 'configure' and 'make':
((note: you can copy&paste the 4 lines for './configure' in one go))

    bash: cd ~/Desktop/aMule
    bash: ./configure --disable-systray --disable-gtk     \
            --with-wx-prefix=../wxMac-2.6.0/build/lib/     \
            --with-wx-config=../wxMac-2.6.0/build/wx-config \
            --enable-debug --disable-optimise                    <-- OPTIONAL
          
    bash: make
    bash: strip src/amule                                        <-- OPTIONAL
    bash: mv src/amule aMule.app/Contents/MacOS/

the two lines marked as OPTIONAL are optional, that is, the last two options to ./configure and the strip command. They result in a dramatically reduced file size (approx. 3 MB instead of 50 MB) but disable all possibilities to submit a helpful stacktrace if amule crashes or a sample if it hangs to the aMule developers.



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.