Difference between revisions of "HowTo Compile In Debian/Ubuntu"

From AMule Project FAQ
Jump to: navigation, search
Line 52: Line 52:
 
<br>
 
<br>
 
<i><b>Note 5:</b> This can all be done in a single command line, which might be more handy for users using <code>"sudo"</code> to gain root priviledges:  <code>apt-get install g++ libwxbase2.4-dev libcurl2-dev libgtk1.2-dev libcrypto++-dev libgd2-xpm-dev gettext</code></i><br>
 
<i><b>Note 5:</b> This can all be done in a single command line, which might be more handy for users using <code>"sudo"</code> to gain root priviledges:  <code>apt-get install g++ libwxbase2.4-dev libcurl2-dev libgtk1.2-dev libcrypto++-dev libgd2-xpm-dev gettext</code></i><br>
<i><b>Note 6:</b> Woody users will most probably be unable to get libgd2-xpm-dev  since that package isn't available for Woody. At the moment, there is no backport available but, since this library is only used by CAS, it won't give any problems on compilation time. Just be aware that <code>cas -o</code> won't work.</i><br>
+
<i><b>Note 6:</b> You don't need to install libgd2-xpm-dev if you don't plan to compile CAS. Even if you plan to compile CAS, this library is only used by CAS for creating images on the current aMule status (by running <code>cas -o</cas). If you don't plan to use this feature of CAS, then again, you don't need to install LibGD2. CAS will compile perfectly well, since it detects, on compilation time, if this library is installed.<br>
 +
<i><b>Note 7:</b> Woody users will most probably be unable to get libgd2-xpm-dev  since that package isn't available for Woody. At the moment, there is no backport available but, since this library is only used by CAS, it won't give any problems on compilation time. Just be aware that <code>cas -o</code> won't work.</i><br>
 
<br>
 
<br>
 
2) Download the latest released aMule source code from http://download.berlios.de/amule (mirror at http://download.gna.org/amule/ )<br>
 
2) Download the latest released aMule source code from http://download.berlios.de/amule (mirror at http://download.gna.org/amule/ )<br>
 
<br>
 
<br>
<i><b>Note 7:</b> From now on, I will suppose we are installing aMule 2.0.0-rc3</i><br>
+
<i><b>Note 8:</b> From now on, I will suppose we are installing aMule 2.0.0-rc3</i><br>
 
<br>
 
<br>
 
3) Fix Crypto++ Library 5.1<br>
 
3) Fix Crypto++ Library 5.1<br>
Line 63: Line 64:
 
<code>ln -s /usr/include/crypto++/cryptopp_config.h /usr/include/crypto++/config.h</code><br>
 
<code>ln -s /usr/include/crypto++/cryptopp_config.h /usr/include/crypto++/config.h</code><br>
 
<br>
 
<br>
<i><b>Note 8:</b> Since this link needs write permissions in /usr/lib, super-user (root) priviledges are needed. Again, this can be done easily with <code>"su"</code> or <code>"sudo"</code>.</i><br>
+
<i><b>Note 9:</b> Since this link needs write permissions in /usr/lib, super-user (root) priviledges are needed. Again, this can be done easily with <code>"su"</code> or <code>"sudo"</code>.</i><br>
 
<br>
 
<br>
 
<br>
 
<br>
Line 71: Line 72:
 
<code>mkdir ~/aMule-compilation/ && tar xzfv aMule-2.0.0rc3.tar.gz -C ~/aMule-compilation/ && cd ~/aMule-compilation/</code><br>
 
<code>mkdir ~/aMule-compilation/ && tar xzfv aMule-2.0.0rc3.tar.gz -C ~/aMule-compilation/ && cd ~/aMule-compilation/</code><br>
 
<br>
 
<br>
<i><b>Note 9:</b> Remember I'm supposing you are extracting aMule 2.0.0-rc3. Change the file name if it doesn't correspond to the actual packed source code filename.</i><br>
+
<i><b>Note 10:</b> Remember I'm supposing you are extracting aMule 2.0.0-rc3. Change the file name if it doesn't correspond to the actual packed source code filename.</i><br>
 
<br>
 
<br>
 
5) Compile aMule! The following command will actually switch to the directory containing aMule 2.0.0rc3 and compile it:<br>
 
5) Compile aMule! The following command will actually switch to the directory containing aMule 2.0.0rc3 and compile it:<br>
Line 77: Line 78:
 
<code>cd ~/aMule-compilation/aMule-2.0.0rc3/ && ./configure && make</code><br>
 
<code>cd ~/aMule-compilation/aMule-2.0.0rc3/ && ./configure && make</code><br>
 
<br>
 
<br>
<i><b>Note 10:</b> You should check <code>"./configure --help | more"</code> to see if there is any configure switch which might be of your interest, such as --disable-debug --enable-optimise or --bindir= </i><br>
+
<i><b>Note 11:</b> You should check <code>"./configure --help | more"</code> to see if there is any configure switch which might be of your interest, such as --disable-debug --enable-optimise or --bindir= </i><br>
<i><b>Note 11:</b> if you get an error message, while compiling, similar to: "In file included from /usr/include/wx/***:***, [...] /usr/include/wx/******:***: internal compiler error: Segmentation fault", then you most probably have problems with wxWidgets. Try with <code>"apt-get install --reinstall wxwin2.4-headers libwxbase2.4 libwxgtk2.4-dev"</code>, which will reinstall wxWidgets and will most probably fix the compilation error.</i>
+
<i><b>Note 12:</b> if you get an error message, while compiling, similar to: "In file included from /usr/include/wx/***:***, [...] /usr/include/wx/******:***: internal compiler error: Segmentation fault", then you most probably have problems with wxWidgets. Try with <code>"apt-get install --reinstall wxwin2.4-headers libwxbase2.4 libwxgtk2.4-dev"</code>, which will reinstall wxWidgets and will most probably fix the compilation error.</i>
 
<br>
 
<br>
 
<br>
 
<br>

Revision as of 08:05, 3 May 2004

HowTo compile aMule in Debian


by Jacobo221


Very special thanks to darknox, Arathornz, guest234, parasito, maya and klando for their tests!



Notes before starting


Important: Have in mind that this HowTo was done having in mind aMule 2.0.0 or greater in Debian 3.0 (Woody/Sarge/Sid).

This HowTo is based on using the apt-get package installer tool, which means you'll have to be able to get super-user (root) access. Also, apt-get requires a perfect packet dependencies installed system. If you usually use apt-get for installing any application, skip this and go to the next section. If you rarely use apt-get but, instead, use dpkg, you can

A) (Recommended) Solve all the dependencies problems on your system. This can be done by taking a look at the "dpkg -C" output and installing/removing/updating the packages it mentions depending on what's required. This option is the recommended since it will not only ensure your aMule compilation will be most surely correct, but it will also make your system the most stable it can possibly be and from now on you'll be able to use apt-get to not only make easier installations, but also to easily upgrade your system.

B) Force apt-get to ignore the dependencies problems using the -f or --fix-broken switches (just one of them, since they're exactly the same, so that'd be, for example, "apt-get install -f ..."). This option may cause a corrupt installation of some packages which may cause the apps not to work. Also have in mind that using this switch in a system with dependencies problems may cause the system to completely brake if the package being installed is a base package (although this is not the case).

C) Follow this instructions but, instead of using "apt-get install foo", use "dpkg -i foo" where foo is the package to install. Remember the packages must be already on the system when installing packages with dpkg. Remember also to download any "Depends" package since it most-surely will be necessary for successfully compiling aMule. Avoid using whichever of the following dpkg switches: --force-all --force-depends-version --force-depends --force-conflicts

If you usually install applications from source, read deltaHF's "aMule compilation / installation HowTo" (at http://www.amule.org/wiki/index.php/Compilation_Installation ) since your system might not be complying the Debian aMule package dependencies although "dpkg -C" shows no errors.


The easiest: Preparing the system


Once you decided to use apt-get, you must make sure you'll be downloading the latest versions of the packages (aMule team has discovered bugs in some deb packages that would make aMule impossible to compile on Debian without compiling some other libraries too. This bugs have been mostly fixed in those affected debian packages, so it is very important to be sure to have the packages up to date). This is done by

apt-get update && apt-get dist-upgrade

Note 1: You must be root user to do this. Log in as root or "su" or use "sudo" ("sudo" must be specified on both apt-get commands, that is "sudo apt-get update && sudo apt-get dist-upgrade"). "sudo" is not a base command, so it may not be installed on your system, although it most probably will. Be aware that following this HowTo entirely as root may bring some problems later such as being unable to delete certain files as a normal user, so please only use tooy priviledges when necessary.
Note 2: Woody users (that is, people stuck in the stable Debian 3.0 branch) will be unable to install the wxGTK, wxbase and Crypto++ libraries since they were not available in the current version (2.4.2) when Woody was released.
The best for Woody users is to switch to the Sarge or Sid branch. That can be done with the following command (again, you must be root) "sed s/stable/testing/g /etc/apt/sources.list > /etc/apt/sources.list" or "sed s/woody/sarge/g /etc/apt/sources.list > /etc/apt/sources.list" to switch to the Sarge/testing branch, or with "sed s/unstable/testing/g /etc/apt/sources.list > /etc/apt/sources.list" or "sed s/woody/sid/g /etc/apt/sources.list > /etc/apt/sources.list" to switch to the Sid/unstable branch.
But Woody users might not be interested in switching to Sarge. Such users will have to download Woody-backported debian packages by adding the following line to /etc/apt/sources.list (remember to "apt-get update" after adding this line):
deb http://debian.thermoman.de/ woody wxwindows2.4
Note 3: Sarge users won't be able yet to download some packages from the official repositories, so they'll need to update their spurces.list file by adding the following line (remember to "apt-get update" after adding this line):
deb http://debian.thermoman.de/ woody libcrypto++
Note 4: Sid users (that is, people holding the cutting-edge unstable Debian 3.0 branch) could suffer problems from packages not completely implemented or with broken dependencies (both are normal issues in the unstable branch). It is very important to keep this in mind since a compiler (g++) will be installed so it could also be broken and, with it, most applications compiled with it (once upgraded, of course). If a package was broken, to downgrade you can use the --force-downgrade switch with dpkg.

If for whatever reason you think this is too much of a complication, you can just wait a few days until the aMule binary version comes out for your architecture (that is, a .deb file).


The fastest: Installing the necessary packages


Remember you need to be root to install applications using apt-get, since apt-get installs system-wide applications. So, log in as root, use "su" or add "sudo" before every command shown here.

The following are the packages which must be installed:

1) Install the latest stable g++ compiler and the C++ Standard Library

apt-get install g++

the required libraries for compiling aMule (wxbase is not really a requiered packet to compile aMule but, unless you know what you're doing, be sure you install it. I won't show in this this guide how to force aMule's compilation without wxbase):

apt-get install libwxbase2.4-dev libcurl2-dev libgtk1.2-dev libwxgtk2.4-dev libcrypto++-dev libgd2-xpm-dev

and the required utilities for compiling aMule, at the moment only gettext (necessary for internationalization support):

apt-get install gettext

Note 5: This can all be done in a single command line, which might be more handy for users using "sudo" to gain root priviledges: apt-get install g++ libwxbase2.4-dev libcurl2-dev libgtk1.2-dev libcrypto++-dev libgd2-xpm-dev gettext
Note 6: You don't need to install libgd2-xpm-dev if you don't plan to compile CAS. Even if you plan to compile CAS, this library is only used by CAS for creating images on the current aMule status (by running cas -o</cas). If you don't plan to use this feature of CAS, then again, you don't need to install LibGD2. CAS will compile perfectly well, since it detects, on compilation time, if this library is installed.
<i>Note 7: Woody users will most probably be unable to get libgd2-xpm-dev since that package isn't available for Woody. At the moment, there is no backport available but, since this library is only used by CAS, it won't give any problems on compilation time. Just be aware that <code>cas -o
won't work.


2) Download the latest released aMule source code from http://download.berlios.de/amule (mirror at http://download.gna.org/amule/ )

Note 8: From now on, I will suppose we are installing aMule 2.0.0-rc3

3) Fix Crypto++ Library 5.1
Since aMule 2.0.0 this library is required because aMule is now supporting SecureIdent, but the Crypto++ Debian package has had lots of compiling bugs and still has one (although the rest have been fixed after aMule team's reports). Remember you should have update and dist-upgraded apt-get before installing any Debian package in this HowTo, otherwise, you could be instaling (or already have installed) a buggy Crypto++ package and this fix will not suit your needs. To fix the latest crypto++ Debian package only a symbolic link is needed:

ln -s /usr/include/crypto++/cryptopp_config.h /usr/include/crypto++/config.h

Note 9: Since this link needs write permissions in /usr/lib, super-user (root) priviledges are needed. Again, this can be done easily with "su" or "sudo".


The hardest: Compiling aMule


4) Extract the sources. The following will create a folder on your user's home directory where it will extract the sources with the -C switch into it (the following command understands that aMule's sources are on the current directory):

mkdir ~/aMule-compilation/ && tar xzfv aMule-2.0.0rc3.tar.gz -C ~/aMule-compilation/ && cd ~/aMule-compilation/

Note 10: Remember I'm supposing you are extracting aMule 2.0.0-rc3. Change the file name if it doesn't correspond to the actual packed source code filename.

5) Compile aMule! The following command will actually switch to the directory containing aMule 2.0.0rc3 and compile it:

cd ~/aMule-compilation/aMule-2.0.0rc3/ && ./configure && make

Note 11: You should check "./configure --help | more" to see if there is any configure switch which might be of your interest, such as --disable-debug --enable-optimise or --bindir=
Note 12: if you get an error message, while compiling, similar to: "In file included from /usr/include/wx/***:***, [...] /usr/include/wx/******:***: internal compiler error: Segmentation fault", then you most probably have problems with wxWidgets. Try with "apt-get install --reinstall wxwin2.4-headers libwxbase2.4 libwxgtk2.4-dev", which will reinstall wxWidgets and will most probably fix the compilation error.

Meeting satisfaction: Installing aMule!


8) What's left? Install aMule (remember you must be root, so log in as root or use "su" or "sudo"):

make install

Now you can remove the sources so you free up space in your hard disk by running:

rm -rf ~/aMule-compilation/


The end: Final checks


If you have sometime installed aMule from the Debian packages (no matter if the package came from http://gunnm.org/~soda ), you will have aMule binaries installed in /usr/bin. But "make install" installs binnaries in /usr/local/bin (unless --prefix= is set in configure). This leads us to the point that when typing "amule" anyone of the two installed aMule versions might be invoked (which one is executed will depend on the $PATH environment variable. You can check it by typing "type amule"). The walk around is very easy: remove the aMule installed through Debian package. You can do this with the command "apt-get remove amule" (do not use "apt-get remove --purge" or you might loose your aMule settings) or with "dpkg --remove amule" (again, never ever use "dpkg --purge" or you might loose your aMule settings). apt-get will remove aMule-utils if you have them installed (only available as a separate package in Sid, in Sarge and Woody aMule utils are included in the base aMule package) while dpkg will leave aMule-utils installed on the system (which, in general, is a bad idea).
Also, if you installed xmule sometime or you are planing to install it, have in mind that the file ed2k exists both in aMule and eMule. You might want to run `type ed2k` to see which ed2k command will be executed and rename the other so you make sure it's never executed by mistake.


You're done...


That's it! Your own compiled aMule is installed on your system and ready to go.
To run aMule, just type "amule". You can check if everything worked by typing "amule -v" and check if the displayed version corresponds with the one you were compiling/installing.
If this HowTo didn't help, you have a rare problem on your system ;-) Take a look at http://www.amule.org (aMule Forums at http://www.amule.org/amule/ ) or visit us in #amule on irc.freenode.net and (don't doubt) we'll try to do our best to help you.