Compiling FileZilla 3 under Windows

From FileZilla Wiki

Revision as of 14:47, 1 November 2009 by 84.136.73.60 (Talk)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This documentation explains how to setup a build environment for FileZilla 3 and how to compile it under Windows using MinGW. It will take some time to get everything working, but you will be able to use the build environment for other programs too.

For this guide we assume c:\dev as root directory where we install everything into.

Note to wiki contributors: Do not change version numbers on your own. The MinGW build process is extremely fragile and does break if you change things

Contents


[edit] Setting up the build environment

This includes the compiler and the required tools to build FileZilla 3 and its dependancies. For all packages we download, you will have to download the binary version, not the source version.

[edit] MinGW

Download latest MinGW version and install it: http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download Choose c:\dev\mingw as installation directory. Select "candidate" package version and check the g++ option on the packages list.

[edit] MSYS

Download latest MSYS and install it: http://prdownloads.sourceforge.net/mingw/MSYS-1.0.11.exe?download Chose c:\dev\msys as installation directory. Leave all other options unchanged. During the postinstall script, please carefully answer all questions. Important: Do not skip questions with enter.

Note: Users of 64-bit Windows variants have to change the startmenu shortcut. Change it to c:\WINDOWS\SysWOW64\cmd.exe /C c:\dev\msys\msys.bat (adjust path to Windows directory as needed)

[edit] MSYS Developer Toolkit

Download and install MSYS Developer Toolkit executable: http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe Install to c:\dev\msys as well.

[edit] Compilation flags

Start msys. Type in the following commands:

echo "export LDFLAGS=-L/local/lib" > ~/.profile
echo "export CPPFLAGS=-I/local/include" >> ~/.profile
exit

Double check what you entered. It will save you a few hours of frustration. If you make a typo here, everything will go fine until you try to compile FileZilla.

[edit] Autotools

[edit] Downloading

Download the following files to c:\dev\download:

ftp://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz

ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.bz2

ftp://ftp.gnu.org/gnu/automake/automake-1.10.2.tar.bz2

http://filezilla-project.org/codesquid/m4.exe

Start msys again and enter the following commands:

mkdir /usr/src

[edit] M4

Enter the following commands:

cp /c/dev/download/m4.exe /bin

[edit] Libtool

Start msys and enter the following commands:

cd /usr/src
tar -xvzf /c/dev/download/libtool-2.2.6a.tar.gz
cd libtool-2.2.6
./configure --disable-ltdl-install --prefix=
make -j3
make install

If windows 16bit error message occurs while "checking whether gcc and cc understand -c and -o together...", close the process, don't ignore it.

[edit] Autoconf

Enter the following commands:

cd /usr/src
tar -xvjf /c/dev/download/autoconf-2.64.tar.bz2
cd autoconf-2.64
./configure --prefix=
make
make install

[edit] Automake

Enter the following commands:

cd /usr/src
tar -xvjf /c/dev/download/automake-1.10.2.tar.bz2
cd automake-1.10.2
./configure --prefix=
make
make install

[edit] Libiconv

Compile and install libiconv. Download from ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.11.1.tar.gz to c:\dev\download

cd /usr/src
tar -xvzf /c/dev/download/libiconv-1.11.1.tar.gz
cd libiconv-1.11.1
./configure --disable-shared --enable-static
make -j3
make install

[edit] Libidn

Download ftp://alpha.gnu.org/gnu/libidn/libidn-1.8.tar.gz to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvzf /c/dev/download/libidn-1.8.tar.gz
cd libidn-1.8
mkdir compile
cd compile
../configure --disable-shared --enable-static --disable-nls
cd lib
make -j3

Ignore errors and proceed with:

cd gl
make -j3
cd ..
make -j3
make install

[edit] gettext

Download ftp://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvzf /c/dev/download/gettext-0.17.tar.gz
cd gettext-0.17
./configure --disable-shared --enable-static
make -j3
make install

If windows 16bit error message occurs while "checking whether gcc and cc understand -c and -o together...", close the process, don't ignore it.

[edit] Libgpg-error

Download ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.7.tar.bz2 to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvjf /c/dev/download/libgpg-error-1.7.tar.bz2
cd libgpg-error-1.7
./configure --disable-shared --enable-static --disable-nls
make -j3
make install

[edit] Libgcrypt

Download ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.4.tar.bz2 to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvjf /c/dev/download/libgcrypt-1.4.4.tar.bz2
cd libgcrypt-1.4.4
./configure --disable-shared --enable-static --disable-nls --disable-asm
make
make install

[edit] GnuTLS

Download ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.8.3.tar.bz2 and http://filezilla-project.org/codesquid/libgnutls-config to c:\dev\download. Type the following inside msys:

cd /usr/src
tar -xvjf /c/dev/download/gnutls-2.8.3.tar.bz2
cd gnutls-2.8.3
./configure --disable-shared --enable-static --disable-nls --disable-cxx
make
make install
cp /c/dev/download/libgnutls-config /usr/local/bin/libgnutls-config

[edit] Cleanup

cd /
rm -rf /usr/src

And now you're done, you've successfully setup a build environment which can be used to compile FileZilla 3. Only dependency missing is wxWidgets, which is the topic for the next section.

[edit] Installing wxWidgets

[edit] Downloading

Download latest wxWidgets version from http://www.wxwidgets.org

[edit] Installing

We might upgrade wxWidgets often, so we will install it into it's own prefix:

mkdir -p /opt/wxWidgets
mkdir ~/source
cd ~/source
tar -xvjf /c/dev/download/wxWidgets-2.8.10.tar.bz2
cd wxWidgets-2.8.10
mkdir compile
cd compile
../configure --prefix=/opt/wxWidgets --enable-unicode --disable-shared
make
make install

Remark: If you want to run FZ3 on Windows ME or older, you have to replace --enable-unicode with --disable-unicode. But there is no guarantee that FileZilla will work properly without unicode support.

[edit] Setting environment variables

Type the following inside msys:

echo 'export PATH="$PATH:/opt/wxWidgets/bin"' >> ~/.profile
echo 'export LD_LIBRARY_PATH=/opt/wxWidgets/lib' >> ~/.profile
source ~/.profile 

And that finishes the wxWidgets installation. Lets move on to installing NSIS.

[edit] Installing NSIS

Download and install Unicode NSIS from http://www.scratchpaper.com

Make sure you get the Unicode version and not the Ansi one.

[edit] Installing Subversion

Download http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.0/svn-win32-1.4.5.zip

Extract the archive using Explorer to c:\dev\download

Copy the contents of c:\dev\download\svn-win32-1.4.5 to c:\dev\msys

Use the following command inside msys to check if it's working:

svn --version

[edit] Compiling FileZilla 3

[edit] Download FZ3 from SVN

Type the following inside msys:

cd ~/source
svn co http://filezilla.svn.sourceforge.net/svnroot/filezilla/FileZilla3/trunk FileZilla3

[edit] Generate configure

Type the following inside msys:

cd FileZilla3
./autogen.sh

[edit] Compile FileZilla 3

Type the following inside msys:

mkdir compile
cd compile
../configure --prefix=/opt/FileZilla3
make

The resulting executable will be quite big due to debugging information. You can remove the debug info with the strip command:

strip src/interface/.libs/filezilla.exe
strip src/putty/.libs/fzsftp.exe
strip src/putty/.libs/fzputtygen.exe

[edit] Generate installer

If using the Unicode version of NSIS, you need to convert the file COPYING into UTF-16:

cat COPYING | iconv -f utf-8 -t utf-16 > COPYING~
mv COPYING~ COPYING

Rightclick compile/data/install.nsi in Explorer and use "Compile NSIS Script" from context menu.

[edit] Troubleshooting

If you run into problems, please make sure you've followed each step exactly how it is explained and that you haven't missed any steps along the way.

If step "make -j3" of building of gettext fails with error "ar.exe: hash.o: No such file or directory" (the file gets deleted while building libxml), delete file "/usr/src/gettext-0.17/gettext-tools/libgettextpo/hash.lo" and run "make -j3" again. The same goes for error "ar.exe: error.o: No such file or directory": delete file "/usr/src/gettext-0.17/gettext-tools/libgettextpo/error.lo" and run "make -j3" again.