Difference between revisions of "HowTo compile on Mac"

From AMule Project FAQ
Jump to: navigation, search
Line 51: Line 51:
 
[[wxWidgets|wxMac]] is the port of the [[wxWidgets]] library for [http://macos.apple.com Mac OSX]. This library is used to make [[aMule]] 'multi-platform'.
 
[[wxWidgets|wxMac]] is the port of the [[wxWidgets]] library for [http://macos.apple.com Mac OSX]. This library is used to make [[aMule]] 'multi-platform'.
  
# Get the source from: http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.0.tar.gz
+
# Get the source from: http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.1.tar.gz
 
# Extract the archive (just double-click it)
 
# Extract the archive (just double-click it)
  
Line 68: Line 68:
 
=== Compile the sources ===
 
=== Compile the sources ===
  
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. (if using another location, ensure that there are no spaces in the path as this can lead to file not found errors with [[wxMac]])
  
 
'''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:
 
'''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:
Line 82: Line 82:
 
''cd'' into the ''wxMac'' folder, ''configure'' and ''make'':
 
''cd'' into the ''wxMac'' folder, ''configure'' and ''make'':
  
  bash: cd ~/Desktop/wxMac-2.6.0/build
+
  bash: cd ~/Desktop/wxMac-2.6.1/build
 
  bash: ../configure --disable-shared --enable-unicode  
 
  bash: ../configure --disable-shared --enable-unicode  
 
  bash: make
 
  bash: make
Line 96: Line 96:
 
  bash: cd ~/Desktop/aMule
 
  bash: cd ~/Desktop/aMule
 
  bash: ./configure --disable-systray --disable-gtk    \
 
  bash: ./configure --disable-systray --disable-gtk    \
             --with-wx-config=../wxMac-2.6.0/build/wx-config \
+
             --with-wx-config=../wxMac-2.6.1/build/wx-config \
 
             --disable-debug --enable-optimize    '''''<font color="red">OPTIONAL</font>'''''
 
             --disable-debug --enable-optimize    '''''<font color="red">OPTIONAL</font>'''''
 
            
 
            

Revision as of 13:57, 4 September 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 installer for lots of open source tools ported to Mac OSX. We need it to install the open source 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 open source 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.1.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. (if using another location, ensure that there are no spaces in the path as this can lead to file not found errors with wxMac)

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.1/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 3 lines for ./configure in one go.

bash: cd ~/Desktop/aMule
bash: ./configure --disable-systray --disable-gtk     \
           --with-wx-config=../wxMac-2.6.1/build/wx-config \
           --disable-debug --enable-optimize    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.