【C++】Windows编译FileZilla Client

按照Compiling FileZilla 3 under Windows - FileZilla Wiki (filezilla-project.org)操作即可。

1.下载安装MSYS2

msys2-x86_64-20220118.exe

2.更新MSYS2

进入MSYS2 MinGW 64-bit shell,运行

pacman -Syu

重复退出shell,更新MSYS2。直到没有可更新的。

3.安装工具

进入MSYS2 MinGW 64-bit shell,运行

pacman -S autoconf automake libtool make mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git svn

解决在工具链中一些bug,就是修复windres工具缺少平台前缀的问题。

[ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
[ -f /mingw32/bin/i686-w64-mingw32-windres.exe  ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe

4.设置环境

进入MSYS2 MinGW 64-bit shell,运行

mkdir ~/prefix
echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.profile
echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.profile
echo 'export PATH="$HOME/prefix/bin:$HOME/prefix/lib:/mingw64/bin:/mingw32/bin:$PATH"' >> ~/.bash_profile
echo 'export PKG_CONFIG_PATH="$HOME/prefix/lib/pkgconfig"' >> ~/.bash_profile
echo 'export LC_ALL=C' >> ~/.bash_profile

5.编译安装依赖

(1)编译安装GMP

cd ~
curl -O https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
tar xf gmp-6.2.1.tar.xz
cd gmp-6.2.1
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make
make install

(2)编译安装Nettle

cd ~
wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz
tar xf nettle-3.7.3.tar.gz
cd nettle-3.7.3
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-fat
make
make install

(3)编译安装zlib

cd ~
wget https://zlib.net/fossils/zlib-1.2.13.tar.gz
tar xf zlib-1.2.13.tar.gz
cd zlib-1.2.13
LDSHAREDLIBC= ./configure --prefix="$HOME/prefix" -u=GNU
make
make install

(4)编译安装GnuTLS

cd ~
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz
tar xf gnutls-3.7.2.tar.xz
cd gnutls-3.7.2
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --build=x86_64-w64-mingw32 --with-included-libtasn1 --disable-doc --disable-guile --without-p11-kit --enable-local-libopts --disable-nls --with-included-unistring --disable-tests
make
make install

(5)编译安装SQLite

cd ~
wget https://sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
tar xf sqlite-autoconf-3250300.tar.gz
cd sqlite-autoconf-3250300
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static
make
make install

(6)编译安装wxWidgets

cd ~
git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
cd wx3
./configure --build=x86_64-w64-mingw32 --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
make
make install

如果github的git clone速度慢,可以用其他方法试一下,比如用gitee。

(7)编译安装libfilezilla

cd ~
svn co https://svn.filezilla-project.org/svn/libfilezilla/trunk libfilezilla
cd libfilezilla
autoreconf -i 
./configure --prefix="$HOME/prefix" --enable-shared --disable-static
make
make install

6.编译打包Filezilla

(1)下载FileZilla

cd ~
svn co https://svn.filezilla-project.org/svn/FileZilla3/trunk filezilla

(2)编译FileZilla

cd ~/filezilla
autoreconf -i
./configure --with-pugixml=builtin
make

如果遇到问题:

checking for Boost Regex... configure: error: in '/c/SPB_Data/filezilla':
configure: error: Boost Regex 1.76 or higher not found.

解决方法:

pacman -S mingw-w64-x86_64-boost

(3)裁剪debug符号

strip src/interface/.libs/filezilla.exe
strip src/putty/.libs/fzsftp.exe
strip src/putty/.libs/fzputtygen.exe
strip src/fzshellext/64/.libs/libfzshellext-0.dll
strip src/fzshellext/32/.libs/libfzshellext-0.dll
strip data/dlls/*.dll

(4)打包

安装NSIS

NSIS Wiki下载并安装NSIS 3。

编译打包脚本

文件资源管理器,右键 data/install.nsi文件,使用 "Compile NSIS Script"。

7.相关链接

Client Compile - FileZilla Wiki (filezilla-project.org)

Cross Compiling FileZilla 3 for Windows under Ubuntu or Debian GNU/Linux - FileZilla Wiki (filezilla-project.org)

Compiling FileZilla 3 under Windows - FileZilla Wiki (filezilla-project.org)

另,在Ubuntu下编译Windows版本的FileZilla 3,生成GnuTLS的Makefile文件时,出错,不推荐用linux交叉编译Windows应用。

相关推荐

  1. 编译器 编译原理

    2023-12-30 11:16:01       19 阅读
  2. Pangolin编译

    2023-12-30 11:16:01       37 阅读
  3. Opencv 编译

    2023-12-30 11:16:01       37 阅读
  4. AOSP 编译

    2023-12-30 11:16:01       33 阅读
  5. 交叉编译

    2023-12-30 11:16:01       16 阅读
  6. Conda编译

    2023-12-30 11:16:01       8 阅读
  7. GUN编译器(gcc/g++)- 编译过程

    2023-12-30 11:16:01       28 阅读
  8. openharmony 编译LLVM编译器基础架构

    2023-12-30 11:16:01       35 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-30 11:16:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-30 11:16:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-30 11:16:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-30 11:16:01       18 阅读

热门阅读

  1. 【python】可变变量与不可变变量

    2023-12-30 11:16:01       39 阅读
  2. MIUI解BL锁+刷系统教程

    2023-12-30 11:16:01       37 阅读
  3. 基于SpringBoot的新能源充电系统

    2023-12-30 11:16:01       41 阅读
  4. Redis主从切换(单点故障)解决源码

    2023-12-30 11:16:01       37 阅读
  5. PB 按Excel动态创建对应字段

    2023-12-30 11:16:01       28 阅读
  6. Flutter 三点三:Dart Stream

    2023-12-30 11:16:01       31 阅读
  7. 神经网络分类与回归任务

    2023-12-30 11:16:01       32 阅读