qbittorrent - build process - incorrect linking to boost includes #11469

Closed
opened 2026-02-21 21:33:14 -05:00 by deekerman · 2 comments
Owner

Originally created by @userdocs on GitHub (Dec 23, 2020).

Please provide the following information

qBittorrent version and Operating System

4.3.1 linux debian based amd64

If on linux, libtorrent-rasterbar and Qt version

libtorrent 1.2.11 (github) and qt via apt or built from github

Introduction

This issue is twofold but the build process is required to understand the problem.

First, the scripted build process linked below demonstrates a streamlined build process where using boost 1.75, as documented for libtorrent, allows you to skip compiling boost dependencies. I believe that when this is properly appreciated and understood the documented process can be adjusted to match.

What is the problem

The bug itself is in how qbittorrent looks for and loads boost_system and the includes under these circumstances when using the refined build method.

Bug: qbittorrent will not honor defined include paths and instead use a system installed boost include when using the boost flags.

The short version is, I can make sure these vars are defined (config.log) but qbittorrent will still ignore these vars and load the first system instance of include/boost it finds

Example of correctly defined variables taken from the config.log on a build that linked to the wrong instance of boost 1.71 instead of 1.75.

BOOST_CPPFLAGS='-I/root/qbit/boost_1_75_0/include'
BOOST_LDFLAGS='-L/root/qbit/local/libtorrent/lib'
BOOST_SYSTEM_LIB='-lboost_system'

It can be solved by using this combination

CFLAGS="-I${BOOST_ROOT}" --with-boost="${BOOST_ROOT}" --with-boost-libdir="${lt_prefix}/lib"

Specifically CFLAGS="-I${BOOST_ROOT}"

But some things spring to mind as this is not correct.

1: These variables are correctly set but ignored and this defeats the purpose, forcing me to use CFLAGS="-I${BOOST_ROOT}"

If I have boost 1.69 or 1.72 installed via apt these will be used and my settings ignored. Even though the configure was successful based on my definitions.

2: You hardcode /include into the --with-boost="${BOOST_ROOT}" path.

This needs to be changed or more flexible as the installation method above needs to use boost_1_75_0/boost as this is the location in the source. I could symlink but there should be no need to workaround something that should not be hardcoded.

3: This would / should be the correctly defined variables in this example.

BOOST_CPPFLAGS='-I/root/qbit/boost_1_75_0/boost'
BOOST_LDFLAGS='-L/root/qbit/local/libtorrent/lib'
BOOST_SYSTEM_LIB='-lboost_system'

4: even if improperly configured but just enough to pass the boost_system tests, I can be successful by having no apt version of boost installed to get the desired outcome. This is not ideal but shows it was possible.

5: libtorrent builds the libboost_system.a and this works fine.

Examples via docker and a script.

I have made a script demonstrate the build process and bug - https://git.io/JLX0n

Note: the script installs these libboost-dev libboost-system-dev via apt to demonstrate the issue and bypass

To use it with docker please use these command.

bug - boost 1.71 linked

docker run -it -p 8080:8080 -v $HOME:/root ubuntu:latest /bin/bash -c 'apt-get update && apt-get install -y curl && cd && curl -sL git.io/JLX0n | bash -s bug && cd && bash'

No bug - boost 1.75 successfully linked

docker run -it -p 8080:8080 -v $HOME:/root ubuntu:latest /bin/bash -c 'apt-get update && apt-get install -y curl && cd && curl -sL git.io/JLX0n | bash && cd && bash'

Use this command to run qbittorrent-nox from inside the docker upon build completion.

./qbit/local/bin/qbittorrent-nox
Originally created by @userdocs on GitHub (Dec 23, 2020). **Please provide the following information** ### qBittorrent version and Operating System 4.3.1 linux debian based amd64 ### If on linux, libtorrent-rasterbar and Qt version libtorrent 1.2.11 (github) and qt via apt or built from github ### Introduction This issue is twofold but the build process is required to understand the problem. First, the scripted build process linked below demonstrates a streamlined build process where using boost 1.75, as documented for libtorrent, allows you to skip compiling boost dependencies. I believe that when this is properly appreciated and understood the documented process can be adjusted to match. ### What is the problem The bug itself is in how qbittorrent looks for and loads `boost_system` and the includes under these circumstances when using the refined build method. **Bug:** qbittorrent will not honor defined include paths and instead use a system installed boost include when using the boost flags. The short version is, I can make sure these vars are defined (config.log) but qbittorrent will still ignore these vars and load the first system instance of `include/boost` it finds Example of correctly defined variables taken from the `config.log` on a build that linked to the wrong instance of boost 1.71 instead of 1.75. ``` BOOST_CPPFLAGS='-I/root/qbit/boost_1_75_0/include' BOOST_LDFLAGS='-L/root/qbit/local/libtorrent/lib' BOOST_SYSTEM_LIB='-lboost_system' ``` It can be solved by using this combination ``` CFLAGS="-I${BOOST_ROOT}" --with-boost="${BOOST_ROOT}" --with-boost-libdir="${lt_prefix}/lib" ``` Specifically `CFLAGS="-I${BOOST_ROOT}"` But some things spring to mind as this is not correct. **1:** These variables are correctly set but ignored and this defeats the purpose, forcing me to use `CFLAGS="-I${BOOST_ROOT}"` If I have boost 1.69 or 1.72 installed via apt these will be used and my settings ignored. Even though the configure was successful based on my definitions. **2:** You hardcode `/include` into the `--with-boost="${BOOST_ROOT}"` path. This needs to be changed or more flexible as the installation method above needs to use `boost_1_75_0/boost` as this is the location in the source. I could symlink but there should be no need to workaround something that should not be hardcoded. **3:** This would / should be the correctly defined variables in this example. ``` BOOST_CPPFLAGS='-I/root/qbit/boost_1_75_0/boost' BOOST_LDFLAGS='-L/root/qbit/local/libtorrent/lib' BOOST_SYSTEM_LIB='-lboost_system' ``` 4: even if improperly configured but just enough to pass the `boost_system` tests, I can be successful by having no apt version of boost installed to get the desired outcome. This is not ideal but shows it was possible. 5: libtorrent builds the `libboost_system.a` and this works fine. ### Examples via docker and a script. I have made a script demonstrate the build process and bug - https://git.io/JLX0n **Note:** the script installs these `libboost-dev` `libboost-system-dev` via apt to demonstrate the issue and bypass To use it with docker please use these command. bug - boost 1.71 linked ``` docker run -it -p 8080:8080 -v $HOME:/root ubuntu:latest /bin/bash -c 'apt-get update && apt-get install -y curl && cd && curl -sL git.io/JLX0n | bash -s bug && cd && bash' ``` No bug - boost 1.75 successfully linked ``` docker run -it -p 8080:8080 -v $HOME:/root ubuntu:latest /bin/bash -c 'apt-get update && apt-get install -y curl && cd && curl -sL git.io/JLX0n | bash && cd && bash' ``` Use this command to run `qbittorrent-nox` from inside the docker upon build completion. ``` ./qbit/local/bin/qbittorrent-nox ```
deekerman 2026-02-21 21:33:14 -05:00
Author
Owner

@userdocs commented on GitHub (Dec 23, 2020):

What I want to happen?

I want to use just this:

--with-boost="${BOOST_ROOT}" --with-boost-libdir="${lt_prefix}/lib"

Have these vars defined

BOOST_CPPFLAGS='-I/root/qbit/boost_1_75_0/boost'
BOOST_LDFLAGS='-L/root/qbit/local/libtorrent/lib'
BOOST_SYSTEM_LIB='-lboost_system'

And have qbittorrent linked against the correct version of boost.

@userdocs commented on GitHub (Dec 23, 2020): ### What I want to happen? I want to use just this: ``` --with-boost="${BOOST_ROOT}" --with-boost-libdir="${lt_prefix}/lib" ``` Have these vars defined ``` BOOST_CPPFLAGS='-I/root/qbit/boost_1_75_0/boost' BOOST_LDFLAGS='-L/root/qbit/local/libtorrent/lib' BOOST_SYSTEM_LIB='-lboost_system' ``` And have qbittorrent linked against the correct version of boost.
Author
Owner

@luzpaz commented on GitHub (Jun 28, 2023):

Is this ticket still relevant ?

@luzpaz commented on GitHub (Jun 28, 2023): Is this ticket still relevant ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#11469
No description provided.