Difference between revisions of "HowTo compile on Mac"

From AMule Project FAQ
Jump to: navigation, search
(Changed warning about Xcode 2.0's gcc4 to recommend upgrading to Xcode 2.1)
Line 1: Line 1:
How to get and install [[aMule]] on [http://www.apple.com/macosx/ Apple Mac OSX].
+
How to get and install [[aMule]] on [http://www.apple.com/macosx/ Apple Mac OS X].
  
 
# You can simply download the finished application ('binary release') or  
 
# You can simply download the finished application ('binary release') or  
Line 23: Line 23:
 
==== [http://developer.apple.com/tools/xcode Xcode] ====
 
==== [http://developer.apple.com/tools/xcode Xcode] ====
  
[http://developer.apple.com/tools/xcode Xcode] is [http://www.apple.com Apple]'s development environment. We need it for the [http://gcc.gnu.org GCC] compiler. You may have [http://developer.apple.com/tools/xcode Xcode] on CD/DVD, e.g. it is on the [http://macos.apple.com OSX]10.4 DVD.
+
[http://developer.apple.com/tools/xcode Xcode] is [http://www.apple.com Apple]'s development environment. We need it for the [http://gcc.gnu.org GCC] compiler. You may have [http://developer.apple.com/tools/xcode Xcode] on CD/DVD, e.g. it is on the [http://www.apple.com/macosx/ OS X] 10.4 DVD.
  
Else you can download it from [http://www.apple.com Apple], but you must sign up for a free-of-charge developer account first.
+
Otherwise, you can download it from [http://www.apple.com Apple], but you must sign up for a free-of-charge developer account first.
  
 
# Get XCode from http://developer.apple.com/tools/download
 
# Get XCode from http://developer.apple.com/tools/download
Line 31: Line 31:
  
 
==== [http://fink.sourceforge.net Fink] ====
 
==== [http://fink.sourceforge.net Fink] ====
 +
 +
'''Optional:''' Fink and gettext are not strictly required to compile aMule, but without them aMule will only appear in English.
  
 
[http://fink.sourceforge.net Fink] is an open source (OS) installer for lots of OS tools ported to [http://macos.apple.com Mac OSX]. We need it to install the OS tool [http://www.gnu.org/software/gettext gettext].
 
[http://fink.sourceforge.net Fink] is an open source (OS) installer for lots of OS tools ported to [http://macos.apple.com Mac OSX]. We need it to install the OS tool [http://www.gnu.org/software/gettext gettext].
Line 39: Line 41:
  
 
==== [http://www.gnu.org/software/gettext gettext] ====
 
==== [http://www.gnu.org/software/gettext gettext] ====
 +
 +
'''Optional:''' gettext and Fink are not strictly required to compile aMule, but without them aMule will only appear in English.
  
 
[http://www.gnu.org/software/gettext gettext] is an OS library for text internationalization. This library is used to make [[aMule]] multi-lingual.
 
[http://www.gnu.org/software/gettext gettext] is an OS library for text internationalization. This library is used to make [[aMule]] multi-lingual.
Line 66: Line 70:
 
Put the ''amule'' folder and the ''wxMac'' folder in the same place, e.g. on the desktop.
 
Put the ''amule'' folder and the ''wxMac'' folder in the same place, e.g. on the desktop.
  
'''Important:''' If you use [http://developer.apple.com/tools/xcode Xcode] 2.0 then your default compiler is [http://gcc.gnu.org gcc] 4.0. Currently (2005-05-09) [[wxMac]] then only compiles with patches (and [http://www.eskimo.com/~weidai/cryptlib.html CryptoPP] doesn't compile at all). Therefore, if you use [http://developer.apple.com/tools/xcode Xcode] 2.0 then you should switch back to [http://gcc.gnu.org gcc] 3.3 first. First check the version of your current default [http://gcc.gnu.org gcc] with ''gcc --version'' and then switch to version 3.3 if required:
+
'''Important:''' If you use [http://developer.apple.com/tools/xcode Xcode] 2.0 then the [http://gcc.gnu.org gcc] 4.0 that comes with it is somewhat broken and can't compile aMule.  There are two solution: upgrade to [http://developer.apple.com/tools/xcode Xcode] 2.1 by [[#Xcode|downloading]] it from [http://www.apple.com Apple] for free, or switch your system to use [http://gcc.gnu.org gcc] 3.3.  If your prefer to switch to [http://gcc.gnu.org gcc] 3.3, first check the version of your current default [http://gcc.gnu.org gcc] with ''gcc --version'' and then switch to version 3.3 if required:
  
 
  bash: gcc --version
 
  bash: gcc --version

Revision as of 05:09, 31 July 2005

How to get and install aMule on Apple Mac OS X.

  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 OS X 10.4 DVD.

Otherwise, 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

Optional: Fink and gettext are not strictly required to compile aMule, but without them aMule will only appear in English.

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

Optional: gettext and Fink are not strictly required to compile aMule, but without them aMule will only appear in English.

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 in the same place, e.g. on the desktop.

Important: If you use Xcode 2.0 then the gcc 4.0 that comes with it is somewhat broken and can't compile aMule. There are two solution: upgrade to Xcode 2.1 by downloading it from Apple for free, or switch your system to use gcc 3.3. If your prefer to switch to gcc 3.3, 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

NOTE: This took approx. 30 minutes on a G4 at 1 GHz.

Compile aMule

Now cd into the amule folder, configure and make:

NOTE: You can copy'n'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.