Qt 5.6.2 ignores additional libraries, while building it from source
-
'm trying to build telegram from source on windows 10, with visual studio 2017, following the official manual from github:
https://github.com/telegramdesktop/tdesktop/blob/dev/docs/building-msvc.md
Telegram uses qt 5.6.2 But i stuck on almost last step, qt build. I have built all dependencies prior to that, lzma, zlib,ffmeg etc. The first trouble i ran into, zlib was not found by qt, but i managed to fix with -system-zlib switch. So i have ended up with a command like this
q:\tg_build\Libraries\qt5_6_2\qtbase>configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "%cd%\..\openssl\Release\include Q:\tg_build\Libraries\lzma\C" -L "Q:\tg_build\Libraries\lzma\C\Util\LzmaLib\Debug" -l "LzmaLib.lib" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%cd%\..\openssl\Debug\lib\ssleay32.lib %cd%\..\openssl\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="%cd%\..\openssl\Release\lib\ssleay32.lib %cd%\..\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015
After compilation command with jom -j4, i get errors, while linking:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:..\..\..\bin\moc.exe @C:\Users\q\AppData\Local\Temp\moc.exe.10616.2937.jom QtBootstrapd.lib(qbytearray.obj) : error LNK2019: ссылка на неразрешенный внешний символ _z_compress2 в функции "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z) QtBootstrapd.lib(qbytearray.obj) : error LNK2019: ссылка на неразрешенный внешний символ _z_uncompress в функции "class QByteArray __cdecl qUncompress(unsigned char const *,int)" (?qUncompress@@YA?AVQByteArray@@PBEH@Z) ..\..\..\bin\moc.exe : fatal error LNK1120: неразрешенных внешних элементов: 2
So qt doesn't pick up LZMA. Even though, the configure outputs me:
Additional libraries........-LQ:\tg_build\Libraries\lzma\C\Util\LzmaLib\Debug -lLzmaLib.lib
How can i tell qt to pick up and link lzma library then?
-
'm trying to build telegram from source on windows 10, with visual studio 2017, following the official manual from github:
https://github.com/telegramdesktop/tdesktop/blob/dev/docs/building-msvc.md
Telegram uses qt 5.6.2 But i stuck on almost last step, qt build. I have built all dependencies prior to that, lzma, zlib,ffmeg etc. The first trouble i ran into, zlib was not found by qt, but i managed to fix with -system-zlib switch. So i have ended up with a command like this
q:\tg_build\Libraries\qt5_6_2\qtbase>configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "%cd%\..\openssl\Release\include Q:\tg_build\Libraries\lzma\C" -L "Q:\tg_build\Libraries\lzma\C\Util\LzmaLib\Debug" -l "LzmaLib.lib" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%cd%\..\openssl\Debug\lib\ssleay32.lib %cd%\..\openssl\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="%cd%\..\openssl\Release\lib\ssleay32.lib %cd%\..\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015
After compilation command with jom -j4, i get errors, while linking:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:..\..\..\bin\moc.exe @C:\Users\q\AppData\Local\Temp\moc.exe.10616.2937.jom QtBootstrapd.lib(qbytearray.obj) : error LNK2019: ссылка на неразрешенный внешний символ _z_compress2 в функции "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z) QtBootstrapd.lib(qbytearray.obj) : error LNK2019: ссылка на неразрешенный внешний символ _z_uncompress в функции "class QByteArray __cdecl qUncompress(unsigned char const *,int)" (?qUncompress@@YA?AVQByteArray@@PBEH@Z) ..\..\..\bin\moc.exe : fatal error LNK1120: неразрешенных внешних элементов: 2
So qt doesn't pick up LZMA. Even though, the configure outputs me:
Additional libraries........-LQ:\tg_build\Libraries\lzma\C\Util\LzmaLib\Debug -lLzmaLib.lib
How can i tell qt to pick up and link lzma library then?
@SourCreamAndOnion Is the lib built using exact same compiler?
-
Well, i have built lzma using this same compiler, according to instructions prior to qt.
git clone https://github.com/telegramdesktop/lzma.git cd lzma\C\Util\LzmaLib msbuild LzmaLib.sln /property:Configuration=Debug msbuild LzmaLib.sln /property:Configuration=Release cd ..\..\..\..
This produce lzma lib compiled by msvc2017.
But if you look at their build manual, it is suggested to clone this first:
git clone https://github.com/Microsoft/Range-V3-VS2015 range-v3
And in a qt installation, suggets this commands (its all done from a visual studio 2017 x86 native command prompt ):
git clone git://code.qt.io/qt/qt5.git qt5_6_2
cd qt5_6_2
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.6.2
cd qtimageformats
git checkout v5.6.2
cd ..\qtbase
git checkout v5.6.2
git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff
cd ..configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "%cd%..\openssl\Release\include" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%cd%..\openssl\Debug\lib\ssleay32.lib %cd%..\openssl\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="%cd%..\openssl\Release\lib\ssleay32.lib %cd%..\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015
jom -j4
jom -j4 install
cd ..So even though the compiler is msvc2017, they instruct to configure qt with win32-msvc2015. But i assume msvc2017/2015 have the same runtime version, plus i do not have any runtime incompability errors during compile time