Difference between revisions of "Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux"

From FileZilla Wiki
Jump to navigationJump to search
(minor updates)
m (Reverted edits by 2600:387:2:803:0:0:0:72 (talk) to last revision by CodeSquid)
Tag: Rollback
 
(178 intermediate revisions by 39 users not shown)
Line 1: Line 1:
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]].
+
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]].
  
 
== 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]
 
  
== Setting up the build environment ==
+
Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.
  
=== Ubuntu ===
+
We strongly recommend to use [http://debian.org Debian '''12''' (Bookworkm)] or later ('''recommended''')
  
Required packages
+
== Setting up the build environment ==
sudo apt-get install -y mingw32 make g++ libtool bzip2 automake gettext wx-common
 
  
=== Debian ===
+
As root, execute:
 +
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
  
Do works as root
+
Back as normal user, execute:
  su -
+
  mkdir ~/prefix
 +
mkdir ~/src
 +
export PATH="$HOME/prefix/bin:$PATH"
 +
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
  
Required packages
+
  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'`"
  apt-get install -y mingw32 make g++ libtool bzip2 automake gettext wx-common
 
  
== Patch mingw32-runtime (only Debian) ==
+
<!--
 +
<p style="font-size:150%;color:#ff0000">'''Beware:''' You need to patch your MinGW runtime!</p>
 +
Note: This does not affect mingw-w64 >= v4.0.6, mingw-w64 v4.0.6 is available in Ubuntu 16.10.
  
If you are using Ubuntu, go to the next [[#Make libraries]] section. In Ubuntu, the patch is applied.
+
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:
 +
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/2474f3904a1fbce19d96383a9633e6c2eeb427ea/
 +
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/bca09678e3bfd67b2d445127280ee5a1d9d0453a/
  
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.
+
Without these patches, FileZilla will not work properly and will fail in obscure ways.
 +
-->
  
=== Get source package ===
+
== GMP ==
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 ===
+
cd ~/src
  pushd build_dir/src/mingw-runtime-3.13-20070825-1/mingwex/gdtoa/
+
  wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.lz
diff -u mingw_snprintf.c.org mingw_snprintf.c
+
  tar xf gmp-6.3.0.tar.lz
  --- mingw_snprintf.c.org        2009-09-21 02:41:31.000000000 +0000
+
  cd gmp-6.3.0
  +++ mingw_snprintf.c    2009-09-21 02:41:54.000000000 +0000
+
  CC_FOR_BUILD=gcc ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
  @@ -465,7 +465,7 @@
+
  make
                                    len = LEN_LL;
+
  make install
                                  }
 
                                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
 
  
=== Build & Install ===
+
== Nettle ==
debian/rules build
 
debian/rules install
 
  
=== Copy new library ===
+
cd ~/src
  mv $/usr/i586-mingw32msvc/lib/libmingwex.a $/usr/i586-mingw32msvc/lib/libmingwex.a.old
+
  wget https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz
  cp debian/mingw32-runtime/usr/i586-mingw32msvc/lib/libmingwex.a $/usr/i586-mingw32msvc/lib/
+
tar xf nettle-3.9.1.tar.gz
 +
cd nettle-3.9.1
 +
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
 +
make
 +
make install
  
== Make libraries ==
+
== GnuTLS ==
Do works as normal user in Debian.
 
exit
 
  
=== Make working & install directory ===
+
  cd ~/src
Check available space of storage.
+
  wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.1.tar.xz
  mkdir ~/mingw32
+
tar xvf gnutls-3.8.1.tar.xz
  mkdir /tmp/fz3
+
  cd gnutls-3.8.1
  cd /tmp/fz3
+
./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
 +
make
 +
make install
  
=== Setting up environment variables ===
+
== Compile SQLite ==
export CFGPRE=~/mingw32
 
export CFGOPT="--prefix=$CFGPRE --host=i586-mingw32msvc --disable-shared --enable-static"
 
  
=== iconv ===
+
cd ~/src
  wget ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
+
  wget https://sqlite.org/2018/sqlite-autoconf-32600-00.tar.gz
  tar zxvf libiconv-1.14.tar.gz
+
  tar xvzf sqlite-autoconf-3260000.tar.gz
  cd libiconv-1.14
+
  cd sqlite-autoconf-3260000
  ./configure $CFGOPT
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
  make install clean
+
  make
  cd ..
+
  make install
  
=== libidn ===
+
== NSIS ==
wget ftp://alpha.gnu.org/gnu/libidn/libidn2-0.8.tar.gz
 
tar zxvf libidn2-0.8.tar.gz
 
cd libidn2-0.8
 
./configure $CFGOPT
 
make install clean
 
cd ..
 
  
=== libgpg-error ===
+
cd ~/src
  wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.10.tar.bz2
+
  wget https://prdownloads.sourceforge.net/nsis/nsis-3.09-setup.exe
  tar jxvf libgpg-error-1.10.tar.bz2
+
  wine nsis-3.09-setup.exe /S
cd libgpg-error-1.10
 
./configure $CFGOPT --disable-nls
 
make install clean
 
cd ..
 
  
=== libgcrypt ===
+
The above may print a lot of errors and warnings. Ignore them, check for success this way:
  wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2
+
  [ -f "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" ] && echo "Success!"
tar jxvf libgcrypt-1.5.0.tar.bz2
 
cd libgcrypt-1.5.0
 
./configure $CFGOPT --disable-nls --disable-asm --with-gpg-error-prefix=$CFGPRE
 
make install clean
 
cd ..
 
  
=== GnuTLS ===
+
== Compile wxWidgets ==
wget ftp://ftp.gnu.org/pub/gnu/gnutls/gnutls-3.0.19.tar.xz
 
tar Jxvf gnutls-3.0.19.tar.xz
 
cd gnutls-3.0.19
 
./configure $CFGOPT --disable-nls --disable-cxx --disable-guile --with-libgcrypt-prefix=$CFGPRE
 
make install clean
 
cd ..
 
  
=== wxWidgets ===
+
cd ~/src
  wget http://downloads.sourceforge.net/wxwindows/wxWidgets-2.8.12.tar.bz2
+
  git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
tar jxvf wxWidgets-2.8.12.tar.bz2
+
  cd wx3
  cd wxWidgets-2.8.12
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
mkdir compile
+
make
cd compile
+
  make install
  ../configure $CFGOPT --enable-unicode
+
  cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin
  make install clean
 
  cd ../..
 
  
== Compiling FileZilla 3 ==
+
== Compile libfilezilla ==
wget http://downloads.sourceforge.net/filezilla/FileZilla_3.5.3_src.tar.bz2
 
tar jxvf FileZilla_3.5.3_src.tar.bz2
 
 
cd filezilla-3.5.3
 
./autogen.sh
 
  
  mkdir compile
+
  cd ~/src
  cd compile
+
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
  
autogen.sh of FileZilla 3 use old libgnutls-config. GnuTLS does not use libgnutls-config anymore.
+
== Compile FileZilla ==
  
Dowload http://filezilla-project.org/codesquid/libgnutls-config to $CFGPRE/bin. Edit prefix value.
+
cd ~/src
 
+
  svn co https://svn.filezilla-project.org/svn/FileZilla3/tags/3.56.0/ fz
  wget -O $CFGPRE/bin/libgnutls-config http://filezilla-project.org/codesquid/libgnutls-config
+
  cd fz
+
  autoreconf -i
echo $CFGPRE
+
  ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --with-pugixml=builtin
/home/fz/mingw32 # remember the path
 
   
 
  vi $CFGPRE/bin/libgnutls-config
 
  prefix=/home/fz/mingw32 # edit this line.
 
 
chmod +x $CFGPRE/bin/libgnutls-config
 
 
 
Configure and builld.
 
 
 
CFLAGS="-I$CFGPRE/include" CXXFLAGS="-I$CFGPRE/include" LDFLAGS="-L$CFGPRE/lib" ../configure $CFGOPT --with-wx-prefix=$CFGPRE --with-libgnutls-prefix=$CFGPRE
 
 
 
  make
 
  make
  strip src/interface/filezilla.exe
+
  # strip debug symbols
 
+
$TARGET_HOST-strip src/interface/.libs/filezilla.exe
== 5 Principles for Inner Transformation at Work ==
+
  $TARGET_HOST-strip src/putty/.libs/fzsftp.exe
 
+
$TARGET_HOST-strip src/putty/.libs/fzputtygen.exe
People go to work to sustain themselves and produce value in the world. Yet work environments can also be stressful, filled with challenging responsibilities and personalities, and feel misaligned with our most deeply cherished values. Instead of sustaining us, the workplace can sometimes feel simply draining, and at worst, unwholesome for both ourselves and the world.
+
  $TARGET_HOST-strip src/fzshellext/64/.libs/libfzshellext-0.dll
 
+
$TARGET_HOST-strip src/fzshellext/32/.libs/libfzshellext-0.dll
  [[http://goodvillenews.com/5-Principles-for-Inner-Transformation-at-Work-TTklKV.html 5 Principles for Inner Transformation at Work]]
+
  $TARGET_HOST-strip data/dlls/*.dll
 
+
cd data
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
+
  wine "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" install.nsi
 
 
== 10 Ways to Love Where You Live ==
 
 
 
Community is not just for extroverts.For thousands of years, our ancestors lived in barrios, hamlets, neighborhoods, and villages. Yet in the time since our parents and grandparents were young, privacy has become so valued that many neighborhoods are not much more than houses in proximity.
 
 
 
  [[http://goodvillenews.com/10-Ways-to-Love-Where-You-Live-FT4yRy.html 10 Ways to Love Where You Live]]
 
 
 
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 
 
 
== A Young Girl with a Big Heart and an Old Man with a Lot of Flowers ==
 
 
 
When I was very young (about ten or eleven years old), I heard that our neighbor, a retired physician, had lost his wife after a long illness. He was such a dear soul, and he had the most spectacular gardens in his backyard. The whole neighborhood could see his glorious flowers from the street. The backyard was a profusion of daisies and roses, snapdragons and lilies, hyacinths and columbines. I used to think there wasnt a flower in the world that he didnt grow.
 
 
 
  [[http://goodvillenews.com/A-Young-Girl-with-a-Big-Heart-and-an-Old-Man-with-a-Lot-of-F-lg9.html A Young Girl with a Big Heart and an Old Man with a Lot of Flowers]]
 
 
 
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 
 
 
== Nintendo Unveils Wii U Console ==
 
 
 
Nintendo Co. on Tuesday unveiled details of its Wii U videogame console to be launched late this year, featuring a tablet computer-like controller with touch-sensitive panel.
 
 
 
  [[http://goodvillenews.com/Nintendo-Unveils-Wii-U-Console-mGg2T2.html Nintendo Unveils Wii U Console]]
 
 
 
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 
 
 
== Why Have Good When You Can Have Better? ==
 
 
 
As I look back on my life, I realize that every time I thought I was being rejected from something good, I was actually being re-directed to something better. Steve Maraboli
 
 
 
[[http://goodvillenews.com/Why-Have-Good-When-You-Can-Have-Better-PdMtIo.html Why Have Good When You Can Have Better?]]
 
  
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
+
Voila, there's now FileZilla_3_setup.exe in the current directory.

Latest revision as of 08:45, 12 October 2023

This documentation explains how to setup a build environment for FileZilla 3 for Windows and how to compile it under Debian using Mingw-w64. It will take less time and is more simple than Compiling FileZilla 3 under Windows.

OS version[edit]

Any recent Linux should do the trick. For the sake of simplicity, this guide focuses on Debian(-based) distributions.

We strongly recommend to use Debian 12 (Bookworkm) or later (recommended)

Setting up the build environment[edit]

As root, execute:

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:

mkdir ~/prefix
mkdir ~/src
export PATH="$HOME/prefix/bin:$PATH"
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'`"


GMP[edit]

cd ~/src
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.lz
tar xf gmp-6.3.0.tar.lz
cd gmp-6.3.0
CC_FOR_BUILD=gcc ./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --disable-static --enable-shared --enable-fat
make
make install

Nettle[edit]

cd ~/src
wget https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz
tar xf nettle-3.9.1.tar.gz
cd nettle-3.9.1
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make
make install

GnuTLS[edit]

cd ~/src
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.1.tar.xz
tar xvf gnutls-3.8.1.tar.xz
cd gnutls-3.8.1
./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
make
make install

Compile SQLite[edit]

cd ~/src
wget https://sqlite.org/2018/sqlite-autoconf-32600-00.tar.gz
tar xvzf sqlite-autoconf-3260000.tar.gz
cd sqlite-autoconf-3260000
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static --disable-dynamic-extensions
make
make install

NSIS[edit]

cd ~/src
wget https://prdownloads.sourceforge.net/nsis/nsis-3.09-setup.exe
wine nsis-3.09-setup.exe /S

The above may print a lot of errors and warnings. Ignore them, check for success this way:

[ -f "$HOME/.wine/drive_c/Program Files/NSIS/makensis.exe" ] && echo "Success!"

Compile wxWidgets[edit]

cd ~/src
git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
cd wx3
./configure --host=$TARGET_HOST --prefix="$HOME/prefix" --enable-shared --disable-static
make
make install
cp $HOME/prefix/lib/wx*.dll $HOME/prefix/bin

Compile libfilezilla[edit]

cd ~/src
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 FileZilla[edit]

cd ~/src
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
# strip debug symbols
$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.