qBittorrent icon indicating copy to clipboard operation
qBittorrent copied to clipboard

Release 5.0 Beta 1 compiling error

Open jriker1 opened this issue 1 year ago • 13 comments

qBittorrent & operating system versions

Trying to compile qBittorrent 5.0 beta 1 in windows with CMake but with VS 2022 like I have prior releases. I get thru everything until I do a

cmake --build build

Gets thru everything then errors out linking. Seems like conflicting values perhaps in different parts of the code?

What is the problem?

C:\qbittorrent\qBittorrent-release-5.0.0beta1>cmake --build build [1/1] Linking CXX executable qbittorrent.exe FAILED: qbittorrent.exe C:\Windows\system32\cmd.exe /C "cd . && C:\qbittorrent\cmake\bin\cmake.exe -E vs_link_exe --intdir=src\app\CMakeFiles\qbt_app.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests C:\qbittorrent\qBittorrent-release-5.0.0beta1\src\qbittorrent.exe.manifest -- C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\qbt_app.rsp /out:qbittorrent.exe /implib:src\app\qbittorrent.lib /pdb:qbittorrent.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:windows /DEBUG /PDBALTPATH:qbittorrent.pdb /guard:cf /OPT:REF /OPT:ICF && C:\Windows\system32\cmd.exe /C "cd /D C:\qbittorrent\qBittorrent-release-5.0.0beta1\build\src\app && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/qbittorrent/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/qbittorrent/qBittorrent-release-5.0.0beta1/build/qbittorrent.exe -installedDir C:/qbittorrent/vcpkg/installed/x64-windows-static/bin -OutVariable out"" LINK: command "C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\qbt_app.rsp /out:qbittorrent.exe /implib:src\app\qbittorrent.lib /pdb:qbittorrent.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:windows /DEBUG /PDBALTPATH:qbittorrent.pdb /guard:cf /OPT:REF /OPT:ICF /MANIFEST:EMBED,ID=1 /MANIFESTINPUT:C:\qbittorrent\qBittorrent-release-5.0.0beta1\src\qbittorrent.exe.manifest" failed (exit code 1169) with the following output: qwindows.lib(qwindowsintegration.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) qwindows.lib(qwindowscontext.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) qwindows.lib(qwindowstheme.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) qnetworklistmanager.lib(qnetworklistmanagernetworkinformationbackend.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) qnetworklistmanager.lib(qnetworklistmanagerevents.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) qnetworklistmanager.lib(mocs_compilation.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) Qt6Core.lib(removed_api.cpp.obj) : error LNK2005: "public: __cdecl QLocale::QLocale(class QString const &)" (??0QLocale@@QEAA@AEBVQString@@@Z) already defined in qbt_gui.lib(optionsdialog.cpp.obj) Qt6Core.lib(removed_api.cpp.obj) : error LNK2005: "public: bool __cdecl QByteArray::isNull(void)const " (?isNull@QByteArray@@QEBA_NXZ) already defined in mocs_compilation.cpp.obj Qt6Core.lib(removed_api.cpp.obj) : error LNK2005: "public: void __cdecl QBasicTimer::start(int,class QObject *)" (?start@QBasicTimer@@QEAAXHPEAVQObject@@@Z) already defined in qbt_base.lib(rss_autodownloader.cpp.obj) Qt6Core.lib(removed_api.cpp.obj) : error LNK2005: "public: __int64 __cdecl QString::toLongLong(bool *,int)const " (?toLongLong@QString@@QEBA_JPEA_NH@Z) already defined in qbt_webui.lib(torrentscontroller.cpp.obj) Qt6Core.lib(qfactorycacheregistration.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) Qt6Core.lib(qlocale_win.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj) Creating library src\app\qbittorrent.lib and object src\app\qbittorrent.exp qbittorrent.exe : fatal error LNK1169: one or more multiply defined symbols found ninja: build stopped: subcommand failed.

Steps to reproduce

No response

Additional context

No response

Log(s) & preferences file(s)

No response

jriker1 avatar May 04 '24 21:05 jriker1

Maybe unclean build directory?

glassez avatar May 05 '24 00:05 glassez

I just built it for the first time. Removed cmake, removed the vcpkg folder and obviously new install of this beta build. Then started from scratch. Not sure but guessing some conflict with Qt6 libraries and something? The conflicting values for example:

qwindows.lib(qwindowsintegration.cpp.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '1' doesn't match value '2' in qbt_base.lib(sessionimpl.cpp.obj)

Show that two libraries or what I see have different values for the same thing or something.

jriker1 avatar May 05 '24 02:05 jriker1

So maybe there are different values of -std flag are used when building Qt and qBittorrent (or other its dependencies)?

glassez avatar May 05 '24 12:05 glassez

Beyond my knowledge. I basically just followed the cmake steps on the Wiki to build it other than i had to change or add

.\vcpkg install qtbase:x64-windows-static qtsvg:x64-windows-static qttools:x64-windows-static

to the supported libraries since qBittorrent now uses qt6 vs qt5.

jriker1 avatar May 05 '24 14:05 jriker1

i had to change or add

.\vcpkg install qtbase:x64-windows-static qtsvg:x64-windows-static qttools:x64-windows-static

to the supported libraries since qBittorrent now uses qt6 vs qt5.

Did I understand correctly that you are trying to build the current qBittorrent with Qt5?

glassez avatar May 05 '24 14:05 glassez

No. The current Wiki article says it's using Qt5. I modified the vcpkg line per above to use Qt6.

Note I just blew away the whole qbittorrent folder and did the following:

  1. Download the latest cmake also tried the one built into VS
  2. Put ninja in my path
  3. All the tools and features are installed with VS
  4. Opened the VS cmd prompt
  5. git clone https://github.com/microsoft/vcpkg
  6. cd .\vcpkg
  7. .\bootstrap-vcpkg.bat -disableMetrics
  8. .\vcpkg integrate install
  9. .\vcpkg install boost-circular-buffer:x64-windows-static boost-stacktrace:x64-windows-static openssl:x64-windows-static qtbase:x64-windows-static qtsvg:x64-windows-static qttools:x64-windows-static
  10. .\vcpkg install libtorrent:x64-windows-static
  11. Go into the C:\qbittorrent\qBittorrent-release-5.0.0beta1 folder
  12. cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="C:\qbittorrent\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows-static" -DMSVC_RUNTIME_DYNAMIC=OFF
  13. cmake --build build

Get the above errors.

jriker1 avatar May 05 '24 14:05 jriker1

@jriker1 So why do you need to compile it yourself?

glassez avatar May 05 '24 15:05 glassez

Probably not the right path to go down for the question unless you are eliminating manual compiling but I usually modify a few things to work with some custom scripts with Sonarr. Minor tweaks. Right now just trying to deal with compiling it at all.

jriker1 avatar May 05 '24 15:05 jriker1

Probably not the right path to go down for the question unless you are eliminating manual compiling

Manual compilation requires some competence, because no one will provide you with instructions that would work under any conditions. If you cannot check the assumptions about the cause of the compilation problem because it is "Beyond my knowledge", then only someone who compiles it himself under exactly the same conditions can help you to provide you with detailed instructions. I'm not using the wiki method, so I won't be able to help you with it.

glassez avatar May 05 '24 16:05 glassez

Yeah, problem is conceptually very obvious. The libraries and code being used is mixing code that is using experimental coroutines with code that uses standard coroutines and they can't interoperate

jriker1 avatar May 05 '24 21:05 jriker1

Yeah, problem is conceptually very obvious. The libraries and code being used is mixing code that is using experimental coroutines with code that uses standard coroutines and they can't interoperate

Yes. That's why I assumed that different compilation flags are used for Qt and qBittorrent, namely a different version of the C++ standard. qBittorrent v5.0 requires C++20, so it is forced in the build configuration. Qt most likely uses C++17 (or earlier) by default.

glassez avatar May 06 '24 03:05 glassez

Qt most likely uses C++17 (or earlier) by default.

As of Qt 6, (C++17 compatible compiler is now required) see: https://www.qt.io/blog/qt-6.0-released

C++20 is still opt-in, see: https://www.qt.io/blog/qt-6.7-released (Qt 6.7 also has better support for Windows 11 23H2/macOS 14 - Sonoma)

@jriker1 What changes are you trying to make in the code/why don't you use GitHub Actions? (you can then also use/test Qt 6.7.1 etc.) vcpkg have only just recently updated to Qt 6.6.3, there's a PR open for Qt 6.7.0

xavier2k6 avatar May 06 '24 09:05 xavier2k6

BTW, I don't see any mention in the wiki of zlib or in your comments & it may have no bearing on this issue either but just as an FYI for vcpkg it's zlib:x64-windows-static

xavier2k6 avatar May 06 '24 10:05 xavier2k6

Closing - No response from OP.

xavier2k6 avatar Aug 13 '24 15:08 xavier2k6