Editing Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux

From FileZilla Wiki
Jump to navigationJump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
This documentation explains how to setup a build environment for [[FileZilla 3]] '''for Windows''' and how to compile it under [https://debian.org Debian] using [https://mingw-w64.org/ Mingw-w64]. It will take less time and is more simple than [[Compiling FileZilla 3 under Windows]].
+
This documentation explains how to setup a build environment for [[FileZilla 3]] '''for Windows''' and how to compile it under [http://ubuntu.com Ubuntu] or [http://debian.org Debian] using [http://www.mingw.org/ MinGW]. It will take less time and simple than [[Compiling FileZilla 3 under Windows]].
  
 
== OS version ==
 
== OS version ==
 +
* [http://ubuntu.com Ubuntu] 10.04 ('''recommended''')
 +
* [http://debian.org Debian] 5.0.3
 +
* [http://colinux.org coLinux] with [http://sourceforge.net/projects/colinux/files/Images%202.6.x%20Debian/Debian%205.0%20Lenny/Debian-5.0r2-lenny.7z/download Debian-5.0r2-lenny]
  
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
+
== Setting up the build environment ==
 +
 
 +
=== Ubuntu ===
 +
 
 +
Required packages
 +
sudo apt-get install -y mingw32 make g++ libtool bzip2 automake gettext wx-common
  
We strongly recommend to use [http://debian.org Debian '''12''' (Bookworkm)] or later ('''recommended''')
+
=== Debian ===
  
== Setting up the build environment ==
+
Do works as root
 +
su -
 +
 
 +
Required packages
 +
apt-get install -y mingw32 make g++ libtool bzip2 automake gettext wx-common
 +
 
 +
== Patch mingw32-runtime (only Debian) ==
  
As root, execute:
+
If you are using Ubuntu, go to the next [[#Make libraries]] section. In Ubuntu, the patch is applied.
dpkg --add-architecture i386
 
apt update
 
apt install automake autoconf libtool make gettext lzip xz-utils
 
apt install mingw-w64 pkg-config wx-common wine wine64 wine32 wine-binfmt subversion git
 
  
Back as normal user, execute:
+
Because the version of mingw32-runtime in Debian 5 is [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452977 broken] - Thanks [[CodeSquid]], patch mingw32-runtime package.
mkdir ~/prefix
 
mkdir ~/src
 
export PATH="$HOME/prefix/bin:$PATH"
 
export LDFLAGS="-L$HOME/prefix/lib:$LDFLAGS"
 
export LD_LIBRARY_PATH="$HOME/prefix/lib:$LD_LIBRARY_PATH"
 
export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
 
export TARGET_HOST=x86_64-w64-mingw32
 
  
  wine reg add HKCU\\Environment /f /v PATH /d "`x86_64-w64-mingw32-g++ -print-search-dirs | grep ^libraries | sed 's/^libraries: =//' | sed 's/:/;z:/g' | sed 's/^\\//z:\\\\\\\\/' | sed 's/\\//\\\\/g'`"
+
=== Get source package ===
 +
  cd /tmp
 +
apt-get install dpkg-dev debhelper
 +
apt-get source mingw32-runtime
 +
cd mingw32-runtime-3.13/
 +
debian/rules unpack-stamp
  
<!--
+
=== Patch snprintf bug ===
<p style="font-size:150%;color:#ff0000">'''Beware:''' You need to patch your MinGW runtime!</p>
+
pushd build_dir/src/mingw-runtime-3.13-20070825-1/mingwex/gdtoa/
Note: This does not affect mingw-w64 >= v4.0.6, mingw-w64 v4.0.6 is available in Ubuntu 16.10.
+
diff -u mingw_snprintf.c.org mingw_snprintf.c
 +
--- mingw_snprintf.c.org        2009-09-21 02:41:31.000000000 +0000
 +
+++ mingw_snprintf.c    2009-09-21 02:41:54.000000000 +0000
 +
@@ -465,7 +465,7 @@
 +
                                    len = LEN_LL;
 +
                                  }
 +
                                else
 +
-                                 len = LEN_LL;
 +
+                                len = LEN_L;
 +
                                goto fmtloop;
 +
                        case 'L':
 +
                                flag_ld++;
 +
@@ -617,6 +617,7 @@
 +
                                        break;
 +
                                  case LEN_S:
 +
                                        *(short*)ip = c;
 +
+                                      break;
 +
                                  case LEN_LL:
 +
                                        *(long long*) ip = c;
 +
                                        break;
 +
popd
  
The version of the MinGW runtime ships with Debian based distributions has broken string conversion functions. You need to fetch the source of the mingw-64 packet and apply the following two patches:
+
=== Build & Install ===
  https://sourceforge.net/p/mingw-w64/mingw-w64/ci/2474f3904a1fbce19d96383a9633e6c2eeb427ea/
+
  debian/rules build
  https://sourceforge.net/p/mingw-w64/mingw-w64/ci/bca09678e3bfd67b2d445127280ee5a1d9d0453a/
+
  debian/rules install
  
Without these patches, FileZilla will not work properly and will fail in obscure ways.
+
=== Copy new library ===
-->
+
mv $/usr/i586-mingw32msvc/lib/libmingwex.a $/usr/i586-mingw32msvc/lib/libmingwex.a.old
 +
cp debian/mingw32-runtime/usr/i586-mingw32msvc/lib/libmingwex.a $/usr/i586-mingw32msvc/lib/
  
== GMP ==
+
== Make libraries ==
 +
Do works as normal user in Debian.
 +
exit
  
  cd ~/src
+
=== Make working & install directory ===
  wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.lz
+
Check available space of storage.
tar xf gmp-6.3.0.tar.lz
+
  mkdir ~/mingw32
  cd gmp-6.3.0
+
  mkdir /tmp/fz3
CC_FOR_BUILD=gcc ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
+
  cd /tmp/fz3
make
 
make install
 
  
== Nettle ==
+
=== Setting up environment variables ===
 +
export CFGPRE=~/mingw32
 +
export CFGOPT="--prefix=$CFGPRE --host=i586-mingw32msvc --disable-shared --enable-static"
  
cd ~/src
+
=== iconv ===
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz
+
  wget ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
  tar xf nettle-3.9.1.tar.gz
+
  tar zxvf libiconv-1.14.tar.gz
  cd nettle-3.9.1
+
  cd libiconv-1.14
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
+
  ./configure $CFGOPT
  make
+
  make install clean
  make install
+
  cd ..
  
== GnuTLS ==
+
=== libidn ===
 +
wget http://ftp.gnu.org/gnu/libidn/libidn-1.26.tar.gz
 +
tar zxvf libidn-1.26.tar.gz
 +
cd libidn-1.26
 +
./configure $CFGOPT
 +
make install clean
 +
cd ..
  
cd ~/src
+
=== libgpg-error ===
  wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.1.tar.xz
+
  wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.10.tar.bz2
  tar xvf gnutls-3.8.1.tar.xz
+
  tar jxvf libgpg-error-1.10.tar.bz2
  cd gnutls-3.8.1
+
  cd libgpg-error-1.10
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --without-p11-kit --with-included-libtasn1 --with-included-unistring --disable-srp-authentication --disable-dtls-srtp-support --disable-heartbeat-support --disable-psk-authentication --disable-anon-authentication --disable-openssl-compatibility --without-tpm --without-brotli --disable-cxx --disable-doc --enable-threads=windows --disable-tools
+
  ./configure $CFGOPT --disable-nls
  make
+
  make install clean
  make install
+
  cd ..
  
== Compile SQLite ==
+
=== libgcrypt ===
 +
wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2
 +
tar jxvf libgcrypt-1.5.0.tar.bz2
 +
cd libgcrypt-1.5.0
 +
./configure $CFGOPT --disable-asm --with-gpg-error-prefix=$CFGPRE
 +
make install clean
 +
cd ..
  
cd ~/src
+
=== gmplib ===
  wget https://sqlite.org/2018/sqlite-autoconf-32600-00.tar.gz
+
  wget ftp://ftp.gmplib.org/pub/gmp-5.1.1/gmp-5.1.1.tar.bz2
  tar xvzf sqlite-autoconf-3260000.tar.gz
+
  tar jxvf gmp-5.1.1.tar.bz2
  cd sqlite-autoconf-3260000
+
  cd gmp-5.1.1
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
+
  ./configure $CFGOPT
  make
+
  make install clean
  make install
+
  cd ..
  
== NSIS ==
+
=== libnettle ===
 +
wget ftp://ftp.lysator.liu.se/pub/security/lsh/nettle-2.6.tar.gz
 +
tar zxvf nettle-2.6.tar.gz
 +
cd nettle-2.6
 +
./configure $CFGOPT --with-include-path=$CFGPRE/include --with-lib-path=$CFGPRE/lib
 +
make install clean
 +
cd ..
  
cd ~/src
+
=== GnuTLS ===
  wget https://prdownloads.sourceforge.net/nsis/nsis-3.09-setup.exe
+
  wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.9.tar.xz
  wine nsis-3.09-setup.exe /S
+
tar Jxvf gnutls-3.1.9.tar.xz
 +
  cd gnutls-3.1.9
 +
./configure $CFGOPT --disable-nls --disable-cxx --disable-guile --with-libnettle-prefix=$CFGPRE
 +
make install clean
 +
cd ..
  
The above may print a lot of errors and warnings. Ignore them, check for success this way:
+
=== libsqlite3 ===
  [ -f "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" ] && echo "Success!"
+
  wget http://www.sqlite.org/2013/sqlite-autoconf-3071602.tar.gz
 +
tar zxvf sqlite-autoconf-3071602.tar.gz
 +
cd sqlite-autoconf-3071602
 +
./configure $CFGOPT
 +
make install clean
 +
cd ..
  
== Compile wxWidgets ==
+
=== wxWidgets ===
 +
wget http://downloads.sourceforge.net/wxwindows/wxWidgets-2.8.12.tar.bz2
 +
tar jxvf wxWidgets-2.8.12.tar.bz2
 +
cd wxWidgets-2.8.12
 +
mkdir compile
 +
cd compile
 +
../configure $CFGOPT --enable-unicode
 +
make install clean
 +
cd ../..
  
cd ~/src
+
== Compiling FileZilla 3 ==
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
+
  wget http://downloads.sourceforge.net/filezilla/FileZilla_3.5.3_src.tar.bz2
cd wx3
+
  tar jxvf FileZilla_3.5.3_src.tar.bz2
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
+
   
  make
+
  cd filezilla-3.5.3
  make install
+
  ./autogen.sh
  cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin
 
  
== Compile libfilezilla ==
+
mkdir compile
 +
cd compile
  
cd ~/src
+
autogen.sh of FileZilla 3 use old libgnutls-config. GnuTLS does not use libgnutls-config anymore.
svn co https://svn.filezilla-project.org/svn/libfilezilla/tags/0.33.0 lfz
 
cd lfz
 
autoreconf -i
 
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
 
make
 
make install
 
  
== Compile Boost Regex ==
+
Dowload http://filezilla-project.org/codesquid/libgnutls-config to $CFGPRE/bin. Edit prefix value.
  
cd ~/src
+
  wget -O $CFGPRE/bin/libgnutls-config http://filezilla-project.org/codesquid/libgnutls-config
  wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2
+
   
  tar xf boost_1_85_0.tar.bz2
+
  echo $CFGPRE
  cd boost_1_85_0
+
  /home/fz/mingw32 # remember the path
  echo "using gcc :  : x86_64-w64-mingw32-g++ ;" > user-config.jam
+
   
  ./bootstrap-sh
+
  vi $CFGPRE/bin/libgnutls-config
  ./b2 --user-config=./user-config.jam --build-type=minimal --with-regex --prefix=$HOME/prefix install
+
prefix=/home/fz/mingw32 # edit this line.
 +
 +
chmod +x $CFGPRE/bin/libgnutls-config
  
== Compile FileZilla ==
+
Configure and builld.
  
  cd ~/src
+
  CFLAGS="-I$CFGPRE/include" CXXFLAGS="-I$CFGPRE/include" LDFLAGS="-L$CFGPRE/lib" ../configure $CFGOPT --with-wx-prefix=$CFGPRE --with-libgnutls-prefix=$CFGPRE
svn co https://svn.filezilla-project.org/svn/FileZilla3/tags/3.56.0/ fz
+
cd fz
 
autoreconf -i
 
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
 
 
  make
 
  make
  # strip debug symbols
+
  strip src/interface/filezilla.exe
$TARGET_HOST-strip src/interface/.libs/filezilla.exe
 
$TARGET_HOST-strip src/putty/.libs/fzsftp.exe
 
$TARGET_HOST-strip src/putty/.libs/fzputtygen.exe
 
$TARGET_HOST-strip src/fzshellext/64/.libs/libfzshellext-0.dll
 
$TARGET_HOST-strip src/fzshellext/32/.libs/libfzshellext-0.dll
 
$TARGET_HOST-strip data/dlls/*.dll
 
cd data
 
wine "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" install.nsi
 
 
 
Voila, there's now FileZilla_3_setup.exe in the current directory.
 

Please note that all contributions to FileZilla Wiki are considered to be released under the GNU Free Documentation License 1.2 (see FileZilla Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)