Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1892|回复: 4
打印 上一主题 下一主题

qt5.6.2源码编译

[复制链接]

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
跳转到指定楼层
楼主
发表于 2020-2-23 07:20:40 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Qter 于 2020-3-13 14:24 编辑
  1. git clone git://code.qt.io/qt/qt5.git qt5_6_2
  2. cd qt5_6_2
  3. perl init-repository --module-subset=qtbase,qtimageformats
  4. git checkout v5.6.2
  5. cd qtimageformats
  6. git checkout v5.6.2
  7. cd ..\qtbase
  8. git checkout v5.6.2
  9. git apply ../../../longchat-tdesktop/Telegram/Patches/qtbase_5_6_2.diff
  10. cd ..

  11. 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

  12. jom -j4
  13. jom -j4 install
复制代码
https://code.qt.io/cgit/
搜索 qt/qt5.git
进入 https://code.qt.io/cgit/qt/qt5.git/

执行  jom -j4 时报如下错误:
  1. F:\TBuild\Libraries\qt5_6_2>jom -j4

  2. jom 1.1.3 - empower your cores

  3.         cd qtbase\ && ( if not exist Makefile F:\TBuild\Libraries\qt5_6_2\qtbase\bin\qmake F:\TBuild\Libraries\qt5_6_2\qtbase\qtbase.pro -o Makefile ) && F:\TBuild\ThirdParty\jom\jom.exe -f Makefile
  4. F:/TBuild/Libraries/qt5_6_2/qtbase/mkspecs/qconfig.pri:20: Extra characters after test expression.
  5. ...............
  6. rcc.cpp
  7.         cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MTd -D_HAS_EXCEPTIONS=0 -MP -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 /Fd.obj\debug\rcc.vc.pdb -DUNICODE -DWIN32 -DQT_RCC -DQT_NO_CAST_FROM_ASCII -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -DQT_BOOTSTRAP_LIB -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NO_TRANSLATION -DQT_NO_DYNAMIC_CAST -I. -I. -I..\..\..\include -I..\..\..\include\QtCore -I..\..\..\include\QtCore\5.6.2 -I..\..\..\include\QtCore\5.6.2\QtCore -I..\..\..\include\QtXml -I..\..\..\include\QtXml\5.6.2 -I..\..\..\include\QtXml\5.6.2\QtXml -IF:\TBuild\Libraries\openssl\Release\include -I..\..\..\mkspecs\win32-msvc2015 -Fo.obj\debug\ @C:\Users\ADMINI~1\AppData\Local\Temp\main.obj.18992.15.jom
  8. main.cpp
  9.         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\rcc.exe @C:\Users\ADMINI~1\AppData\Local\Temp\rcc.exe.18992.1125.jom
  10. QtBootstrapd.lib(qbytearray.obj) : error LNK2019: 无法解析的外部符号 _z_compress2,该符号在函数 "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z) 中被引用
  11. QtBootstrapd.lib(qbytearray.obj) : error LNK2019: 无法解析的外部符号 _z_uncompress,该符号在函数 "class QByteArray __cdecl qUncompress(unsigned char const *,int)" (?qUncompress@@YA?AVQByteArray@@PBEH@Z) 中被引用
  12. ..\..\..\bin\rcc.exe : fatal error LNK1120: 2 个无法解析的外部命令
  13. :/TBuild/Libraries/qt5_6_2/qtbase/mkspecs/qconfig.pri:20: Extra characters after test expression.
  14. ....
  15. F:/TBuild/Libraries/qt5_6_2/qtbase/mkspecs/qconfig.pri:68: Extra characters after test expression.
  16. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\src\tools\rcc\Makefile.Debug [..\..\..\bin\rcc.exe] Error 1120
  17. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\src\tools\rcc\Makefile [debug] Error 2
  18.         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\ADMINI~1\AppData\Local\Temp\moc.exe.8916.1875.jom
  19. QtBootstrapd.lib(qbytearray.obj) : error LNK2019: 无法解析的外部符号 _z_compress2,该符号在函数 "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z) 中被引用
  20. QtBootstrapd.lib(qbytearray.obj) : error LNK2019: 无法解析的外部符号 _z_uncompress,该符号在函数 "class QByteArray __cdecl qUncompress(unsigned char const *,int)" (?qUncompress@@YA?AVQByteArray@@PBEH@Z) 中被引用
  21. ..\..\..\bin\moc.exe : fatal error LNK1120: 2 个无法解析的外部命令
  22. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\src\tools\moc\Makefile.Debug [..\..\..\bin\moc.exe] Error 1120
  23. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\src\tools\moc\Makefile [debug] Error 2
  24. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\src\Makefile [sub-moc-make_first] Error 2
  25. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\src\Makefile [sub-rcc-make_first] Error 2
  26. jom: F:\TBuild\Libraries\qt5_6_2\qtbase\Makefile [sub-src-make_first] Error 2
  27. jom: F:\TBuild\Libraries\qt5_6_2\Makefile [module-qtbase-make_first] Error 2

  28. F:\TBuild\Libraries\qt5_6_2>
复制代码
QTBUG-33357
Ok I was digging a little more and have found that even if you defined the -D Z_PREFIX at the configure time the bootstrap Makefile doesn't contain it.
Now if we look at the corelib makefile we see -DUNICODE -DWIN32 -DWIN64 -DZ_PREFIX -DQT_NO_USING_NAMESPACE... the Z_PREFIX is defined clearly, but if we look at the bootstrap makefile -DUNICODE -DWIN32 -DWIN64 -DQT_BOOTSTRAPPED the Z_PREFIX is missing.
Now I don't know what bootstrap does in the first place, but adding -DZ_PREFIX to it's makefiles fixes my issue. ---没成功

QT compile error. #3702
jom clean [all]
Configure
Edited the file Libraries\qt5_6_2\qtbase\mkspecs\qconfig.pri and removed the last line with MS copyright.
jom -j4

I don't know what to suggest. Right now I've launched the "x86 Native Tools Command Prompt for VS 2017" and launched in a separate folder those commands from the current instructions:
  1. git clone https://github.com/openssl/openssl.git
  2. cd openssl
  3. git checkout OpenSSL_1_0_1-stable
  4. perl Configure no-shared --prefix=%cd%\Release --openssldir=%cd%\Release VC-WIN32
  5. ms\do_ms
  6. nmake -f ms\nt.mak
  7. nmake -f ms\nt.mak install
  8. nmake -f ms\nt.mak clean
  9. perl Configure no-shared --prefix=%cd%\Debug --openssldir=%cd%\Debug debug-VC-WIN32
  10. ms\do_ms
  11. nmake -f ms\nt.mak
  12. nmake -f ms\nt.mak install
  13. cd ..

  14. git clone git://code.qt.io/qt/qt5.git qt5_6_2
  15. cd qt5_6_2
  16. perl init-repository --module-subset=qtbase,qtimageformats
  17. git checkout v5.6.2
  18. cd qtimageformats
  19. git checkout v5.6.2
  20. cd ..\qtbase
  21. git checkout v5.6.2
  22. git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff
  23. cd ..

  24. 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

  25. jom -j4
  26. jom -j4 install
  27. cd ..
复制代码
And all of them worked without errors, everything was built (openssl and Qt).




I faced this build error issue and I've found the workaround solution.
It's dirty but maybe working well in your environment too.
  • clean all (I think you'd better restart from github clone step.)
  • open \TBuild\Libraries\qt5_6_2\qtbase\tools\configure\environment.cpp
  • find QString Environment::msvcVersion() method.
  • replace like below
    //QString version = execute(command, &returnValue);
    QString version = "Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25835 for x86";
! please check your compiler version to execute cl.exe  in cmd.exe by yourself and then fix the version number text above. MUST BE ENGLISH TEXT!
  • configure
  • jom





回复

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
沙发
 楼主| 发表于 2020-2-23 14:48:21 | 只看该作者
D:\TBuild\Libraries\qt5_6_2\qtbase\src\tools\bootstrap下的
Makefile  Makefile.Debug Makefile.Release不同
而且这三个文件是没有对应的日志的,判断它是如何来的?
  1. 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

复制代码
上面这句生成的?

回复 支持 反对

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
板凳
 楼主| 发表于 2020-2-24 09:28:51 | 只看该作者
改成从github上获取源码
  1. git clone https://github.com/qt/qt5.git qt5_6_2
  2. cd qt5_6_2
  3. perl init-repository --module-subset=qtbase,qtimageformats
  4. git checkout v5.6.2
  5. cd qtimageformats
  6. git checkout v5.6.2
  7. cd ..\qtbase
  8. git checkout v5.6.2
  9. git apply ../../../longchat-tdesktop/Telegram/Patches/qtbase_5_6_2.diff
  10. cd ..
复制代码
回复 支持 反对

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
地板
 楼主| 发表于 2020-2-28 17:26:58 | 只看该作者
本帖最后由 Qter 于 2020-3-13 14:21 编辑

拉取新版本上的tdesktop/Telegram/Patches/qtbase_5_6_2.diff 这个补丁文件   v1.8.0_ok


回复 支持 反对

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
5#
 楼主| 发表于 2020-2-28 17:51:48 | 只看该作者
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-5 21:42 , Processed in 0.062907 second(s), 21 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表