Difference between revisions of "HowTo compile on Win32 with MinGW"

From AMule Project FAQ
Jump to: navigation, search
m (moved HowTo compile on Win32 to HowTo compile on Win32 with MinGW: There is a more general page now)
 
(81 intermediate revisions by 27 users not shown)
Line 1: Line 1:
<center><h2>Originally by '''Madcat'''</h2></center>
+
<center>
 +
'''English''' |
 +
[[HowTo compile on Win32-de|Deutsch]] |
 +
[[HowTo compile on Win32-fr|Fran&ccedil;ais]]
 +
</center>
  
This wiki page only supports the latest [[aMule_CVS|CVS]] version of [[aMule]].
+
This wiki page only covers the latest [[aMule SVN|SVN]] version of [[aMule]], not releases in the 1.x.x or 2.x.x branches.
 +
 
 +
''For those of you that don't want to compile [[aMule]] from source, there is also the option of the [[Win32_binary|aMule Windows Installer]].''
  
 
== Requirements for compiling [[aMule]] ==
 
== Requirements for compiling [[aMule]] ==
  
'''Note:''' Some of these require manually moving includes and libraries into their correct directories.
+
You will need the following packages:
  
[http://www.microsoft.com/windows Windows] port of [http://gcc.gnu.org GNU C compiler] -> [http://prdownloads.sf.net/mingw/MinGW-3.1.0-1.exe?download Download]
+
*[http://www.microsoft.com/windows Windows] port of [http://gcc.gnu.org GNU C compiler], [http://www.mingw.org MinGW] -> [http://prdownloads.sourceforge.net/mingw/MinGW-5.1.3.exe?download Download (5.1.3)]
 +
*Minimal [http://www.gnu.org GNU] shell for [http://www.microsoft.com/windows Windows], [http://www.mingw.org/msys.shtml MSys] -> [http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download Download (1.0.10)]
 +
*Developer toolkit for [http://www.mingw.org/msys.shtml MSys] (for [http://www.gnu.org/software/cvs CVS] & co) -> [http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download Download (1.0.1)]
 +
*[http://www.gnu.org/software/libiconv LibIConv] (required by [http://www.gnu.org/software/gettext gettext]) -> [http://prdownloads.sf.net/mingw/libiconv-1.8.0-2003.02.01-1.exe?download Download (1.8)]
 +
*[http://www.gnu.org/software/gettext GetText] (for [http://www.gnu.org/software/gettext po files], [http://www.gnu.org/software/automake/automake.html autogen.sh], etc) -> [http://prdownloads.sf.net/mingw/gettext-0.11.5-2003.02.01-1.exe?download Download (0.11.5)]
 +
*[http://www.zlib.org zlib] compression library -> [http://www.zlib.net/zlib-1.2.3.tar.gz Download (1.2.3)]
 +
*The [[wxWidgets]] library (do not use the wxMSW port, as it used to fail to build) -> [http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.8.zip Download (2.8.8)]
 +
* [http://www.cryptopp.com/ Crypto++] library -> [http://prdownloads.sourceforge.net/cryptopp/cryptopp552.zip Download(5.5.2)]
 +
*[[aMule]]'s latest release sources or [[aMule SVN]] -> [http://www.hirnriss.net/?area=cvs Download aMule]
 +
* ActivePerl -> [http://www.activestate.com/store/activeperl/download/ Download]
  
Minimal [http://www.gnu.org GNU] shell for [http://www.microsoft.com/windows Windows] -> [http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download Download]
+
Also, 800MB-1500MB free space on your hard disk (around 40MB to download the above packages and the rest for temporary compilation files and installations. The amount of space needed will largely depend on the configuration flags you use).
  
Developer toolkit for [http://www.mingw.org/msys.shtml MSys] (for [http://www.gnu.org/software/cvs CVS] & co) -> [http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download Download]
+
As a reference, the whole compilation process will take around 3 hours on a medium-high resourced computer.
  
[http://www.gnu.org/software/libiconv LibIConv] (required by [http://www.gnu.org/software/gettext gettext]) ->
+
== Installing the Minimal System ==
[http://prdownloads.sf.net/mingw/libiconv-1.8.0-2003.02.01-1.exe?download Download]
+
  
[http://www.gnu.org/software/gettext GetText] (for [http://www.gnu.org/software/gettext po files], [http://www.gnu.org/software/automake/automake.html autogen.sh], etc) ->
+
The first step is to create a [http://www.kernel.org Linux]-like environment, which is required in order to be able to perform the build. This can be done by following these steps '''in this order''':
[http://prdownloads.sf.net/mingw/gettext-0.11.5-2003.02.01-1.exe?download Download]
+
  
[http://www.zlib.org zlib] compression library ->
+
#Install [http://www.mingw.org MinGW]. Select ''Compact installation'' unless you know what you are doing. When it prompts you for a folder, the default (''C:\mingw'') is slightly messy but the safer selection.
[http://www.zlib.net/zlib-1.2.2.tar.gz Download]
+
#Install [http://www.mingw.org/msys.shtml MSys]. When it prompts you for the [http://www.mingw.org MinGW] folder, it's very important to specify it correctly. Failure on this step will stop any compilation attempts. If for some reason you fail, install [http://www.mingw.org/msys.shtml MSys] again, or edit the file ''/etc/fstab'' in your [http://www.mingw.org/msys.shtml MSys] environment.
 +
#Install the [http://www.mingw.org/msys.shtml MSys] developer toolkit.
 +
#Install [http://www.gnu.org/software/libiconv LibIConv].
 +
#Install [http://www.gnu.org/software/gettext GetText].
 +
#Install ActivePerl.
  
[http://www.microsoft.com/windows Windows] port of [[wxWidgets]] library ->
+
== Compiling the libraries ==
[http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.6.0.zip Download]
+
  
== Common guidelines, issues, solutions ==
+
There are three libraries that [[aMule]] will need compiled: [http://www.zlib.org zlib] [[libcrypto]] and [[wxWidgets]].
  
When compiling [[wxWidgets]], you should make use of the following configure flags:
+
''Edit Tof 2008-24-02 : I've personnally had to copy the 'exe' files in 'C:/MinGW/libexec/gcc/mingw32/3.4.5' to 'C:/mingw/bin' in order to work !''
''--disable-shared --without-checklistbox''
+
  
Link statically against ''[http://www.zlib.org zlib]'' to avoid distributing extranous DLLs (and generally make life simpler).  
+
We will compile them from [http://www.mingw.org/msys.shtml MSys], so just run it. Once you are running [http://www.mingw.org/msys.shtml MSys], you'll be on your home folder. Copy the [http://www.zlib.org zlib] and [[wxWidgets]] files you downloaded above into this folder (something like ''C:\msys\1.0\home\'''user''''').
 +
 
 +
The steps for compiling them is as follow:
 +
(Hint: If you are using a multi-core system, you can speed up compiling by adding "-jX" after the make command, where X is the number of cores in your system plus one. For instance, ''./configure --prefix=/mingw && make -j3 && make install'')
 +
 
 +
#[http://www.zlib.org zlib]: Uncompress [http://www.zlib.org zlib], cd to the newly created directory and run ''./configure --prefix=/mingw && make && make install''
 +
#[[wxWidgets]]: Uncompress [[wxWidgets]], cd to the newly created directory and run ''./configure --with-msw --enable-unicode --disable-shared --without-checklistbox && make && make install''
 +
#[[Libcrypto]]: Uncompress the Crypto++ libraries (you'll need to create a directory yourself!), cd to the newly created directory and run ''make && PREFIX=/mingw/ make install''
 +
 
 +
If you want to help us developers, you can add ''--enable-debug'' flag to the [[wxWidgets]] configure command, right after ''--disable-shared'', but be warned it will result into an ''aMule.exe'' file bigger than 100MB.
  
 
== Compilation ==
 
== Compilation ==
  
The compilation itself is actually just a matter of following the usual method: ''./configure && make''
+
Ok, we're all done with the compilation environment. Let's do the last step: compiling [[aMule]].
 +
 
 +
First of all, extract [[aMule]]'s sources and enter the newly created folder.
 +
 
 +
The compilation itself is actually just a matter of following the usual method: ''./configure --with-crypto-prefix=/mingw && make''. Use your favorite flags on ''./configure'', for example, ''--disable-debug'' will remove debug info, but will also make it harder for us developers to understand the bugs you might find.
 +
 
 +
You might want to compile just the remote GUI: the flags would be ''--disable-monolithic --disable-ed2k --enable-amule-gui''
 +
 
 +
'''Beware:''' The following programs do not work yet on [http://www.microsoft.com/windows Windows]:
 +
*[[aMuled|aMule Daemon]]: Doesn't even compile.
 +
*[[CAS]]: Fails to find the [[signature]] file.
 +
 
 +
'''Note:''' To keep the size of the binaries down, you can run ''strip'' from within [http://www.mingw.org/msys.shtml MSys], e.g. ''find . -name '*.exe' -print | xargs -r strip''.
 +
 
 +
== Running ==
 +
 
 +
To run the binaries we've created you need ''mingwm10.dll''. This file can be found in ''C:\MinGW\bin\mingwm10.dll'' (or whatever path you used to install [http://www.mingw.org MinGW]).
 +
 
 +
You now have to place this file in some place so that the binaries find it when they are executed. Here you have three options:
 +
 
 +
#Place it in the same folder where the binaries are (if you have them spread in several different folders, copy this file once into each folder. Since it is a very small file, it is not much of a loss).
 +
#Place it in ''C:\windows'' or some other any other path where [http://www.microsoft.com/windows Windows] might look for libraries (such as ''C:\Windows\System'' or ''C:\Windows\System32'').
 +
#Add ''C:\MinGW\bin'' (or whatever path you used to install [http://www.mingw.org MinGW]) to your ''PATH'' environment variable.
 +
 
 +
Now... just run your binaries and have fun with [[aMule]] on your [http://www.microsoft.com/windows Windows] box!
 +
 
 +
'''Note:''' By default, the binaries are compiled to ''C:\MSys\1.0\home\'''user'''\amule-2.0.3\src\''.
 +
 
 +
== Having different languages ==
 +
 
 +
Now [[aMule]] will be successfully running, but you will not be able to use any other language but default english.
 +
 
 +
TO be able to choose between any of the lot of languages [[aMule]] is shipped with, from [http://www.mingw.org/msys.shtml MSys] go to [[aMule]]'s extracted folder and then into ''po/'' folder. Something like the following should do it:
 +
 
 +
cd
 +
cd amule-2.0.3/po
 +
 
 +
Now install the languages:
 +
 
 +
make install-data-yes
 +
 
 +
This language files are now in ''C:\MSys\1.0\local\share\locale'', so exit [http://www.mingw.org/msys.shtml MSys], go to ''C:\msys\1.0\local\share\locale'' and copy that folder to the folder were you are keeping your compiled ''amule.exe'' and ''amulegui.exe'' files.
 +
 
 +
== Downloading precompiled win32 version ==
  
However, [http://www.zlib.org zlib] detection might fail. If that's the case, you need to add ''--with-zlib=/local/'' to your configure flags.
 
  
==  Compiling with [http://www.parinya.ca/mingwstudio.html MinGW Studio]  ==
+
'''Keep in mind this is a user contributed build. Install it at your own risk'''
  
'''NOTE:''' The compilation with [http://www.parinya.ca/mingwstudio.html MinGW Studio] is deprecated right now and currently does not function. It might function again in the future.
 
  
As of  2004/07/17, you can find, in [http://www.gnu.org/software/cvs CVS], the file ''amule.msp'' which is the project file relative to the [http://www.parinya.ca/mingwstudio.html MinGW Studio] IDE ([http://www.gnu.org/philosophy/free-sw.html Free] and under [http://www.gnu.org/copyleft/gpl.html GPL] at http://www.parinya.ca/ and shipped with precompiled [[wxWidgets|wxMSW]]).
 
  
Install [http://www.parinya.ca/mingwstudio.html MinGW Studio], add [http://www.zlib.org Zlib] and [http://curl.haxx.se Curl] compiled libs in The [http://www.parinya.ca/mingwstudio.html MinGW Studio] tree.
 
  
Then, open ''amule.msp'' with [http://www.parinya.ca/mingwstudio.html MinGW Studio], press '''F7''', and [[aMule]] "should" be compiled :)
+
If you prefer a stable (and more recent) build, you can grab amulegui from the stable 2.1.1 sources here:
 +
http://conrausch.elise.no-ip.com/aMuleGUI-2.1.1-all_lang.zip
  
Yes, I know, "compile" is not the same as "work" ... But it is a great begining
+
Again, this is a user contributed build, which you should not trust ;). It works pretty well though. It is a little big (almost 3MB), but it contains the .dll plus all language packs that were available with the release. For problems with this one, please contact conrausch [at] gmx de

Latest revision as of 21:33, 3 March 2011

English | Deutsch | Français

This wiki page only covers the latest SVN version of aMule, not releases in the 1.x.x or 2.x.x branches.

For those of you that don't want to compile aMule from source, there is also the option of the aMule Windows Installer.

Requirements for compiling aMule

You will need the following packages:

Also, 800MB-1500MB free space on your hard disk (around 40MB to download the above packages and the rest for temporary compilation files and installations. The amount of space needed will largely depend on the configuration flags you use).

As a reference, the whole compilation process will take around 3 hours on a medium-high resourced computer.

Installing the Minimal System

The first step is to create a Linux-like environment, which is required in order to be able to perform the build. This can be done by following these steps in this order:

  1. Install MinGW. Select Compact installation unless you know what you are doing. When it prompts you for a folder, the default (C:\mingw) is slightly messy but the safer selection.
  2. Install MSys. When it prompts you for the MinGW folder, it's very important to specify it correctly. Failure on this step will stop any compilation attempts. If for some reason you fail, install MSys again, or edit the file /etc/fstab in your MSys environment.
  3. Install the MSys developer toolkit.
  4. Install LibIConv.
  5. Install GetText.
  6. Install ActivePerl.

Compiling the libraries

There are three libraries that aMule will need compiled: zlib libcrypto and wxWidgets.

Edit Tof 2008-24-02 : I've personnally had to copy the 'exe' files in 'C:/MinGW/libexec/gcc/mingw32/3.4.5' to 'C:/mingw/bin' in order to work !

We will compile them from MSys, so just run it. Once you are running MSys, you'll be on your home folder. Copy the zlib and wxWidgets files you downloaded above into this folder (something like C:\msys\1.0\home\user).

The steps for compiling them is as follow: (Hint: If you are using a multi-core system, you can speed up compiling by adding "-jX" after the make command, where X is the number of cores in your system plus one. For instance, ./configure --prefix=/mingw && make -j3 && make install)

  1. zlib: Uncompress zlib, cd to the newly created directory and run ./configure --prefix=/mingw && make && make install
  2. wxWidgets: Uncompress wxWidgets, cd to the newly created directory and run ./configure --with-msw --enable-unicode --disable-shared --without-checklistbox && make && make install
  3. Libcrypto: Uncompress the Crypto++ libraries (you'll need to create a directory yourself!), cd to the newly created directory and run make && PREFIX=/mingw/ make install

If you want to help us developers, you can add --enable-debug flag to the wxWidgets configure command, right after --disable-shared, but be warned it will result into an aMule.exe file bigger than 100MB.

Compilation

Ok, we're all done with the compilation environment. Let's do the last step: compiling aMule.

First of all, extract aMule's sources and enter the newly created folder.

The compilation itself is actually just a matter of following the usual method: ./configure --with-crypto-prefix=/mingw && make. Use your favorite flags on ./configure, for example, --disable-debug will remove debug info, but will also make it harder for us developers to understand the bugs you might find.

You might want to compile just the remote GUI: the flags would be --disable-monolithic --disable-ed2k --enable-amule-gui

Beware: The following programs do not work yet on Windows:

Note: To keep the size of the binaries down, you can run strip from within MSys, e.g. find . -name '*.exe' -print | xargs -r strip.

Running

To run the binaries we've created you need mingwm10.dll. This file can be found in C:\MinGW\bin\mingwm10.dll (or whatever path you used to install MinGW).

You now have to place this file in some place so that the binaries find it when they are executed. Here you have three options:

  1. Place it in the same folder where the binaries are (if you have them spread in several different folders, copy this file once into each folder. Since it is a very small file, it is not much of a loss).
  2. Place it in C:\windows or some other any other path where Windows might look for libraries (such as C:\Windows\System or C:\Windows\System32).
  3. Add C:\MinGW\bin (or whatever path you used to install MinGW) to your PATH environment variable.

Now... just run your binaries and have fun with aMule on your Windows box!

Note: By default, the binaries are compiled to C:\MSys\1.0\home\user\amule-2.0.3\src\.

Having different languages

Now aMule will be successfully running, but you will not be able to use any other language but default english.

TO be able to choose between any of the lot of languages aMule is shipped with, from MSys go to aMule's extracted folder and then into po/ folder. Something like the following should do it:

cd
cd amule-2.0.3/po

Now install the languages:

make install-data-yes

This language files are now in C:\MSys\1.0\local\share\locale, so exit MSys, go to C:\msys\1.0\local\share\locale and copy that folder to the folder were you are keeping your compiled amule.exe and amulegui.exe files.

Downloading precompiled win32 version

Keep in mind this is a user contributed build. Install it at your own risk



If you prefer a stable (and more recent) build, you can grab amulegui from the stable 2.1.1 sources here: http://conrausch.elise.no-ip.com/aMuleGUI-2.1.1-all_lang.zip

Again, this is a user contributed build, which you should not trust ;). It works pretty well though. It is a little big (almost 3MB), but it contains the .dll plus all language packs that were available with the release. For problems with this one, please contact conrausch [at] gmx de