Fix wrong version conditional#15240
Conversation
It was done intentionally. We don't care about unsupported versions of libtorrent. So we can easily use only one condition for separating libtorrent-1.2 and libtorrent-2.0 branches. Although it would make sense not to use exact libtorrent version directly but provide special constant for this purpose, e.g. |
Previous discussion/context for this: #15093 (comment), #15093 (comment) |
This "intention" would only be valid if there are correct detection for libtorrent v2 versions. Currently there are none.
I don't mind having that macro but before having that I intend to fix the compile error at my hand. |
`torrent_file_with_hashes()` was introduced in libtorrent v2.0.3. https://github.com/arvidn/libtorrent/releases/tag/v2.0.3
You'd only get a compilation error if you're compiling with libtorrent < 2.0.3, which we explicitly don't support (the minimum 2.0.x version is now 2.0.4), so that is a non-issue. |
Don't forget that we don't REALLY care about unsupported libtorrent versions, so if you intend to use one of them, then you risk getting a logically incorrect application, even if it compiles successfully. So I would prefer to direct efforts to ensure that the build scripts correctly handle the minimum supported version of both libtorrent branches. |
This is really a gray area: neither INSTALL, cmake scripts, autotools script mentioned anything about the lower bound of libtorrent 2.x.
This is indeed an issue to fix. And since you suggested the new Also to mention, another solution is to correctly specify all the version conditionals such that the code would be correct even without the build system detection. |
Usage of libtorrent 2.0.x is considered an opt-in "experimental" feature that can be used if desired. This facilitates migration to 2.0.x and testing of it while we keep releasing with 1.2.x and recommending it to the majority of users. Whether you choose to compile with 1.2.x or 2.0.x, there is a lower bound of the latest stable point release for both branches. In the past, both me and @glassez have submitted PRs indicating these requirements (the 2.0.x requirement is mentioned in parens): #14673, #15093. Currently, the minimum requirements for building qBittorrent are libtorrent 1.2.14 or 2.0.4.
Just don't touch any of the conditionals until such a macro is implemented then. |
This commit will only lead to the fact that it will create a false impression that qBittorrent supports actually incompatible versions of libtorrent2 (i.e. <= 2.0.2). Why do you need it?
Well, I will try to do something in the next couple of days, although I do not believe that preventing these regressive changes (according to previously made decisions) requires this. |
I think I start understanding your viewpoint, let me explain mine.
The way you explain, it sounds like you are trying to enforce version requirements at c++ level. This concept itself is not wrong but it will become absurd when there are established build systems at hand. Furthermore, if you want to enforce it at c++ level, then you need more mechanisms than just detecting |
|
I do not deny the shortcomings in the handling of compatible versions of libtorrent2. Apparently, no one (including me) wanted to spend time on this while libtorrent2 support was in an experimental state, so we were content with only an in-project declaration of the minimally supported version of libtorrent2. |
|
@glassez's previous comment encompasses the essence of the problem. These are just temporary growing pains of the transition while we support both branches.
|
|
Superseded by PR #15297. |
torrent_file_with_hashes()was introduced in libtorrent v2.0.3.https://github.com/arvidn/libtorrent/releases/tag/v2.0.3
Don't use old style castMoved to Detect incompatible libtorrent v2 versions in build systems #15242.