Whats the benefit of compiling your own qbittorrent?

Windows specific questions, problems.
Post Reply
user637745

Whats the benefit of compiling your own qbittorrent?

Post by user637745 »

Im on windows, you can "compile from source" - https://github.com/qbittorrent/qBittorr ... c-linkage)

why would anyone do this, whats the benefit?
trying to learn

thanks
FranciscoPombal

Re: Whats the benefit of compiling your own qbittorrent?

Post by FranciscoPombal »

There are many reasons for compiling from source. Some of them are:

- Compiling with different flags than the official releases (e.g. enabling more optimization flags/CPU specific instruction flags to get more performance).
- Compiling any commit, including the very latest one, thereby opening up the possibility of enjoying new features even before they make it into an official release
- Making sure the resulting binary is trustworthy. Since you've built it yourself in your machine, you can be sure there were no modifications made to the sources other than those you made yourself. Ultimately, the only way to fully fully trust binaries built by others is if the build is 100% reproducible.

On Windows/macOS, you typically don't have the opportunity to do this very often, due to the nature of those proprietary software ecosystems and the incentives there.

Check out these resources to learn more:

https://www.wired.com/2010/02/Compile_S ... urce_Code/
https://www.makeuseof.com/tag/binary-so ... kages-use/
https://unix.stackexchange.com/question ... ll-package
https://www.reddit.com/r/linuxquestions ... s_package/
https://reproducible-builds.org/

I'm in the process of writing an easier guide for Windows, following the build system improvements that I made a while ago. Stay tuned!
user637745

Re: Whats the benefit of compiling your own qbittorrent?

Post by user637745 »

FranciscoPombal wrote: Tue Sep 29, 2020 3:39 pm There are many reasons for compiling from source. Some of them are:

- Compiling with different flags than the official releases (e.g. enabling more optimization flags/CPU specific instruction flags to get more performance).
- Compiling any commit, including the very latest one, thereby opening up the possibility of enjoying new features even before they make it into an official release
- Making sure the resulting binary is trustworthy. Since you've built it yourself in your machine, you can be sure there were no modifications made to the sources other than those you made yourself. Ultimately, the only way to fully fully trust binaries built by others is if the build is 100% reproducible.

On Windows/macOS, you typically don't have the opportunity to do this very often, due to the nature of those proprietary software ecosystems and the incentives there.

Check out these resources to learn more:

https://www.wired.com/2010/02/Compile_S ... urce_Code/
https://www.makeuseof.com/tag/binary-so ... kages-use/
https://unix.stackexchange.com/question ... ll-package
https://www.reddit.com/r/linuxquestions ... s_package/
https://reproducible-builds.org/

I'm in the process of writing an easier guide for Windows, following the build system improvements that I made a while ago. Stay tuned!
Thank you

your 2nd and 3rd point i was guessing aswell, would it be possible to compile with different libtorrent settings? As there are many things you can change in libtorrent, but u cant access them in qbittorrent?

EDIT: It seems this is exactly what i want, i will go on this compile journey :), i always wondered how to apply the "settings_pack" that is mentioned on libtorrent website.
One question, how/in what format do i enter values in settings_pack?

For example: (i dont know how to edit text in a good way, sorry for this)

// This controls which IP address outgoing TCP peer connections are bound
// to, in addition to controlling whether such connections are also
// bound to a specific network interface/adapter (*bind-to-device*).
// This string is a comma-separated list of IP addresses and
// interface names. An empty string will not bind TCP sockets to a
// device, and let the network stack assign the local address. A
// list of names will be used to bind outgoing TCP sockets in a
// round-robin fashion. An IP address will simply be used to `bind()`
// the socket. An interface name will attempt to bind the socket to
// that interface. If that fails, or is unsupported, one of the IP
// addresses configured for that interface is used to `bind()` the
// socket to. If the interface or adapter doesn't exist, the
// outgoing peer connection will fail with an error message suggesting
// the device cannot be found. Adapter names on Unix systems are of
// the form "eth0", "eth1", "tun0", etc. This may be useful for
// clients that are multi-homed. Binding an outgoing connection to a
// local IP does not necessarily make the connection via the
// associated NIC/Adapter.
outgoing_interfaces,
Last edited by user637745 on Wed Sep 30, 2020 2:00 pm, edited 1 time in total.
user637745

Re: Whats the benefit of compiling your own qbittorrent?

Post by user637745 »

Im making another reply because the time it took for mods to approve my reply, i have new information and question :)

I tried following https://github.com/qbittorrent/qBittorr ... linkage%29 but get an error on last step when tryring to build qbittorrent:

:-1: error: dependent 'C:\QBIT_COMPILE\install_msvc64\qt5\lib\Qt5Svgd.lib' does not exist.

I was gonna first try and compile it without changing anything, then later try to find out how to compile it with "high_performance_seed", maybe you know how?

Thanks alot for answers and help
FranciscoPombal

Re: Whats the benefit of compiling your own qbittorrent?

Post by FranciscoPombal »

The new compilation guide for static builds on Windows with MSVC 2019 is up:

https://github.com/qbittorrent/qBittorr ... c-linkage)

It is much easier to follow, less work overall, and less error-prone.
FranciscoPombal

Re: Whats the benefit of compiling your own qbittorrent?

Post by FranciscoPombal »

user637745 wrote: Wed Sep 30, 2020 1:24 pm Thank you

your 2nd and 3rd point i was guessing aswell, would it be possible to compile with different libtorrent settings? As there are many things you can change in libtorrent, but u cant access them in qbittorrent?

EDIT: It seems this is exactly what i want, i will go on this compile journey :), i always wondered how to apply the "settings_pack" that is mentioned on libtorrent website.
One question, how/in what format do i enter values in settings_pack?

For example: (i dont know how to edit text in a good way, sorry for this)

// This controls which IP address outgoing TCP peer connections are bound
// to, in addition to controlling whether such connections are also
// bound to a specific network interface/adapter (*bind-to-device*).
// This string is a comma-separated list of IP addresses and
// interface names. An empty string will not bind TCP sockets to a
// device, and let the network stack assign the local address. A
// list of names will be used to bind outgoing TCP sockets in a
// round-robin fashion. An IP address will simply be used to `bind()`
// the socket. An interface name will attempt to bind the socket to
// that interface. If that fails, or is unsupported, one of the IP
// addresses configured for that interface is used to `bind()` the
// socket to. If the interface or adapter doesn't exist, the
// outgoing peer connection will fail with an error message suggesting
// the device cannot be found. Adapter names on Unix systems are of
// the form "eth0", "eth1", "tun0", etc. This may be useful for
// clients that are multi-homed. Binding an outgoing connection to a
// local IP does not necessarily make the connection via the
// associated NIC/Adapter.
outgoing_interfaces,
If you just want to hard-code some libtorrent setiings, you just set them to a certain value when configuring the "settings_pack" object. But this is all done in qBittorrent, no need to alter libtorrent code at all.

Check out the change made in this PR, for example: https://github.com/qbittorrent/qBittorr ... 3319/files. Here, a new setting is exposed to be user-configurable at runtime in the advanced settings. This is slightly more work than simply hard-coding a value, so if you just want to do that, you don't need to do all the things that are done in that PR (e.g. creating the input in the GUI, WeBUI, etc).

By the way, the "outgoing_interfaces" setting is already configurable in qBittorrent under the name "Network Interfaces" in the advanced settings.
FranciscoPombal

Re: Whats the benefit of compiling your own qbittorrent?

Post by FranciscoPombal »

It is known that it is easier to change arbitrary libtorrent settings in Deluge than in qBittorrent. Deluge has a plugin that enables you to change any setting in text format, even it is not exposed in the GUI, meaning you don't have to patch and compile the source to change an option that is not exposed in the GUI.
user637745

Re: Whats the benefit of compiling your own qbittorrent?

Post by user637745 »

FranciscoPombal wrote: Mon Oct 05, 2020 2:52 pm If you just want to hard-code some libtorrent setiings, you just set them to a certain value when configuring the "settings_pack" object. But this is all done in qBittorrent, no need to alter libtorrent code at all.

Check out the change made in this PR, for example: https://github.com/qbittorrent/qBittorr ... 3319/files. Here, a new setting is exposed to be user-configurable at runtime in the advanced settings. This is slightly more work than simply hard-coding a value, so if you just want to do that, you don't need to do all the things that are done in that PR (e.g. creating the input in the GUI, WeBUI, etc).

By the way, the "outgoing_interfaces" setting is already configurable in qBittorrent under the name "Network Interfaces" in the advanced settings.
"If you just want to hard-code some libtorrent setiings, you just set them to a certain value when configuring the "settings_pack" object. But this is all done in qBittorrent"
I havent been able to understand how to "configure the settings_pack" object, i was under the impression you had to compile qbittorrent from scratch to enable for example "high_performance_seed", thats all i want really.
I dont know how to do that but i thought if i start with being able to compile my own qbittorrent , i can learn how to enable high_performance_seed later

"Check out the change made in this PR, for example: https://github.com/qbittorrent/qBittorr ... 3319/files"
- Files that are mentioned in there like:
src/base/bittorrent/session.cpp, src/base/bittorrent/session.h and so on, is not available in the windows version of qbittorrent?
FranciscoPombal

Re: Whats the benefit of compiling your own qbittorrent?

Post by FranciscoPombal »

user637745 wrote: Tue Oct 06, 2020 7:05 am
I havent been able to understand how to "configure the settings_pack" object, i was under the impression you had to compile qbittorrent from scratch to enable for example "high_performance_seed", thats all i want really.
https://github.com/qbittorrent/qBittorr ... 3319/files shows you how to do that. You have to have a basic knowledge of C++ to understand what's going on though.

The default value is set here: https://github.com/qbittorrent/qBittorr ... 3d5559R321
The initial setup into settings_pack happens here: https://github.com/qbittorrent/qBittorr ... d5559R1285

However, in the case of that PR, since the value is configurable, the value passed to the setting is the result of a getter function: https://github.com/qbittorrent/qBittorr ... 3d5559R321
In your case, you would just hard-code the initial value instead. Since you don't need the value to change, you don't need the setter either: https://github.com/qbittorrent/qBittorr ... d5559R3390

The remainder of the code is all about creating the GUI/WebUI controls used to change the value, which you would also not need.
user637745 wrote: Tue Oct 06, 2020 7:05 am I dont know how to do that but i thought if i start with being able to compile my own qbittorrent , i can learn how to enable high_performance_seed later
Yes, that's a good starting point.
user637745 wrote: Tue Oct 06, 2020 7:05 am - Files that are mentioned in there like:
src/base/bittorrent/session.cpp, src/base/bittorrent/session.h and so on, is not available in the windows version of qbittorrent?
Those are source code files. They are the same for all platforms. Some code is platform specific, some isn't (in this case, that PR doesn't touch any platform specific code). The compilation process automatically uses the correct platform-specific code when you compile.

---

Note that you might not need to patch qBittorrent to enable high_performance_seed, if that's all that you want to do. From the libtorrent documentation about high_performance_seed:

> high_performance_seed returns settings optimized for a seed box, serving many peers and that doesn't do any downloading. It has a 128 MB disk cache and has a limit of 400 files in its file pool. It support fast upload rates by allowing large send buffers.

If you take a closer look at the source code: https://github.com/arvidn/libtorrent/bl ... n.cpp#L169

You'll notice that most of the important settings that enabling high_performance_seed actually changes are also already configurable in qBittorrent. In fact, IMO some of the values that high_performance_seed sets don't go far enough; for example, if you have an SSD, I'd set async I/O threads to 4x the number of CPU cores, not the fixed value of 8 (which is optimal for HDDs). For high performance seeding, you mostly need a good amount of async I/O threads, disk cache, and send buffers. On the hardware side, an SSD will also perform much better than an HDD, due to much higher random read performance.
user637745

Re: Whats the benefit of compiling your own qbittorrent?

Post by user637745 »

FranciscoPombal wrote: Tue Oct 06, 2020 9:43 am Note that you might not need to patch qBittorrent to enable high_performance_seed, if that's all that you want to do. From the libtorrent documentation about high_performance_seed:

> high_performance_seed returns settings optimized for a seed box, serving many peers and that doesn't do any downloading. It has a 128 MB disk cache and has a limit of 400 files in its file pool. It support fast upload rates by allowing large send buffers.

If you take a closer look at the source code: https://github.com/arvidn/libtorrent/bl ... n.cpp#L169

You'll notice that most of the important settings that enabling high_performance_seed actually changes are also already configurable in qBittorrent. In fact, IMO some of the values that high_performance_seed sets don't go far enough; for example, if you have an SSD, I'd set async I/O threads to 4x the number of CPU cores, not the fixed value of 8 (which is optimal for HDDs). For high performance seeding, you mostly need a good amount of async I/O threads, disk cache, and send buffers. On the hardware side, an SSD will also perform much better than an HDD, due to much higher random read performance.
Thanks for the indepth answers.
Yes ive seen some of the settings from high_performance_seed already exists, but not all of them and its fun to tinker :)

From the documentation "high_performance_seed returns settings optimized for a seed box, serving many peers and that doesn't do any downloading. It has a 128 MB disk cache and has a limit of 400 files in its file pool. It support fast upload rates by allowing large send buffers." doesnt really tell me how to "activate it" :( i understand though, I must have some knowledge coming in to understand most of this :) and even though i consider myself "IT savvy" this isnt my area of expertise hehe.

But yeah maybe the advancedsettings in qbittorrent by default is what really matters in terms of "high performance seeding".
I realize now, this rabbithole is maybe to deep ;)
Post Reply