安装编译环境:
apt install build-essential pkg-config automake libtool
编译libtorrent-rasterbar-1.2.18:
apt install libboost-system-dev libssl-dev
#也可使用git clone最新代码
#git clone --branch RC_1_2 --depth=1 --recurse-submodules https://github.com/arvidn/libtorrent.git
wget https://github.com/arvidn/libtorrent/releases/download/v1.2.18/libtorrent-rasterbar-1.2.18.tar.gz
tar zxf libtorrent-rasterbar-1.2.18.tar.gz
cd libtorrent-rasterbar-1.2.18/
./configure --prefix=/usr/local/libtorrent-1.2.18 CXXFLAGS=-std=c++14
make -j$(nproc) && make install
编译qbittorrent-nox4.5.0:
apt install qtbase5-dev qttools5-dev libqt5svg5-dev zlib1g-dev
#也可使用git clone最新代码
#git clone --branch v4_5_x --depth=1 https://github.com/qbittorrent/qBittorrent.git
wget https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-4.5.0.tar.gz
tar zxf release-4.5.0.tar.gz
cd qBittorrent-release-4.5.0/
export CPLUS_INCLUDE_PATH=/usr/local/libtorrent-1.2.18/include/
export PKG_CONFIG_PATH=/usr/local/libtorrent-1.2.18/lib/pkgconfig
./configure --prefix=/usr/local/qbittorrent-4.5.0 --disable-gui
make -j$(nproc) && make install
qbittorrent 4.5.0版本web不能显示中文解决:
sed -i 's/value="zh">/value="zh_CN">/' src/webui/www/private/views/preferences.html
如只安装一个版本的libtorren启动qbittorrent:
echo '/usr/local/libtorrent/lib' > /etc/ld.so.conf.d/libtorrent-x86_64.conf
ldconfig
/usr/local/qbittorrent-4.5.0/bin/qbittorrent-nox
多个版本libtorren:
LD_LIBRARY_PATH=/usr/local/libtorrent-1.2.18/lib/ /usr/local/qbittorrent-4.5.0/bin/qbittorrent-nox
systemd service添加:
Environment="LD_LIBRARY_PATH=/usr/local/libtorrent-1.2.18/lib/"
用cmake编译libtorrent-2.0版本及qbittorrent4.5.0:
apt install cmake ninja-build
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/libtorrent-2.0.8 -DCMAKE_CXX_STANDARD=14
cmake --build build
cmake --install build
export CPLUS_INCLUDE_PATH=/usr/local/libtorrent-2.0.8/include/
export PKG_CONFIG_PATH=/usr/local/libtorrent-2.0.8/lib/pkgconfig
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/qbittorrent-4.5.0-lt20 -DGUI=OFF -DSTACKTRACE=OFF
cmake --build build
cmake --install build
debian11使用qt6编译qbittorrent,需开启bullseye-backports源:
apt install qt6-base-dev qt6-tools-dev zlib1g-dev -t bullseye-backports
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/qbittorrent-4.5.1 -DGUI=OFF -DSTACKTRACE=OFF -DQT6=ON
如要在其它机器上运行需安装依赖:
apt install libqt6network6 libqt6sql6 libqt6xml6 libqt6core6 -t bullseye-backports
libtorrent-2.0.8使用注意,默认磁盘io类型为内存映射文件,qbittorrent占用shr内存很大,且关闭系统缓存后下载上传很慢。
将磁盘io更改为posix无此问题。
经典版本4.3.9:
#wget https://github.com/arvidn/libtorrent/releases/download/v1.2.14/libtorrent-rasterbar-1.2.14.tar.gz
#tar zxf libtorrent-rasterbar-1.2.14.tar.gz
#cd libtorrent-rasterbar-1.2.14/
git clone --branch RC_1_2 https://github.com/arvidn/libtorrent.git
cd libtorrent
#qbittorrent4.39发布时使用的libtorrent版本
git checkout 28ebc276224021d93d958e2f2de445c35898a23e
git submodule update --init --recursive
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/libtorrent-1.2.14 -DCMAKE_CXX_STANDARD=14
cmake --build build
cmake --install build
git clone --branch v4_3_x --depth=1 https://github.com/qbittorrent/qBittorrent.git
cd qBittorrent/
export CPLUS_INCLUDE_PATH=/usr/local/libtorrent-1.2.14/include/
export PKG_CONFIG_PATH=/usr/local/libtorrent-1.2.14/lib/pkgconfig
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/qbittorrent-4.3.9 -DGUI=OFF -DSTACKTRACE=OFF
cmake --build build
cmake --install build
https://web.archive.org/web/20211102073721/https://www.qbittorrent.org/download.php
https://github.com/qbittorrent/qBittorrent/wiki#compilation
https://github.com/qbittorrent/qBittorrent/wiki/Compilation:-Debian-and-Ubuntu
https://github.com/qbittorrent/qBittorrent/wiki/Compilation-with-CMake:-common-information
https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst#building-with-cmake
标签:qbittorrent