﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客--随笔分类-Qt</title><link>http://www.cppblog.com/hkingSP/category/21382.html</link><description /><language>zh-cn</language><lastBuildDate>Sun, 27 Sep 2020 08:49:02 GMT</lastBuildDate><pubDate>Sun, 27 Sep 2020 08:49:02 GMT</pubDate><ttl>60</ttl><item><title>QT_VS2005_CE6.0_开发环境架设</title><link>http://www.cppblog.com/hkingSP/archive/2019/03/08/216291.html</link><dc:creator>宋鹏</dc:creator><author>宋鹏</author><pubDate>Fri, 08 Mar 2019 06:30:00 GMT</pubDate><guid>http://www.cppblog.com/hkingSP/archive/2019/03/08/216291.html</guid><wfw:comment>http://www.cppblog.com/hkingSP/comments/216291.html</wfw:comment><comments>http://www.cppblog.com/hkingSP/archive/2019/03/08/216291.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/hkingSP/comments/commentRss/216291.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/hkingSP/services/trackbacks/216291.html</trackback:ping><description><![CDATA[<div><p>《QT_VS2005_CE6.0_开发环境架设》<br />1、基础环境：<br />操作系统：Windows XP<br />编译器：（1）VS2005 VC环境  （2）VS2005 SP1<br />（SP1 必须有，以提供CE平台的支持，没有的话，Arm  Emulator的程序编译不过，模拟器也报错&#8220;EmulatorStub.exe严重错误&#8221;）<br />QT版本：qt-everywhere-opensource-src-4.8.6.zip<br />CE  SDK：ARM  Emulator<br /><br />2、安装步骤：<br />（1）把QT源码解压到E:\QT\4.8.6\CE6.0\Emulator<br />Tim：个人推荐根目录，不带任何下划线、空格等幺蛾子，防止出错。。<br />Tim：<u>绝对不能带下划线</u>：<br />公司电脑上的目录，起名带个下划线"4.8.6_ArmEmulator"，结果VS2005创建工程失败，说缺少平台支持。。<br />Tim：也最好位于C盘，我把家里电脑的编译版本，放到公司电脑的C盘，创建项目成功，原来的公司版本在E盘，会失败。。不知道是不是错觉。。<br />（2）进入&#8220;Visual  Studio 2005 命令提示&#8221;<br />位置是&#8220;开始菜单-&gt;所有程序-&gt;Microsoft Visual Studio  2005-&gt;Visual Studio Tools-&gt;Visual Studio 2005  命令提示&#8221;。。<br />然后切换到编译目录：E:\QT\4.8.6\CE6.0\Emulator<br />（3）执行以下命令：<br />configure  -platform win32-msvc2005 -xplatform  wince60standard-armv4i-msvc2005<br />&#9312;如果想节省时间，部分编译：<br />[-debug-and-release]  编译和链接两个版本的Qt<br />[-nomake examples]<br />[-nomake demos]<br />[-nomake  docs]<br />[-no-multimedia] <br />[-no-phonon]  <br />[-no-phonon-backend]&nbsp;<br />[-no-media-backend]  <br />[-no-audio-backend]&nbsp;<br />[-no-openssl]<br />[-no-gtkstyle] <br />[-no-svg]  <br />[-no-webkit]&nbsp;  是否编译Web相关的一些QT子库，加上这个可以省不少编译时间，就看你是否准备用这些库了。<br />[-no-javascript-jit]&nbsp;<br />[-no-script]<br />[-no-scripttools]&nbsp;<br />[-no-sql-sqlite]<br />[-no-declarative]<br />[-no-declarative-debug]  <br />Tim：以上可选项均未试验。。 <br />Tim：<br />又抄来一个编译WIN32 VS2005设置的：<br />configure -fast  -platform win32-msvc2005&nbsp; -nomake examples -nomake docs -nomake demos -no-webkit  -no-phonon -no-phonon-backend  -no-multimedia<br />Tim：<br />4.8.6版的，不管怎么编译，都会出错。。<br />&#9312;第一个错误，修改如下：<br />qclipboard_win.cpp  第306行：<br />把出错的CheckRemoteDebuggerPresent，通过版本判断的方式，不编译进来。。<br />#if  defined(_MSC_VER) &amp;&amp; _MSC_VER &lt;= 1400<br />&nbsp;&nbsp;&nbsp; return  false;<br />#else<br />........................<br />&nbsp;&nbsp;&nbsp;  CheckRemoteDebuggerPresent(processHandle,  &amp;debugged);<br />#endif<br />&#9313;第二个错误：<br />继续 nmake　遇到第二个错误<br />&nbsp;&nbsp;&nbsp;&nbsp;  platform\DefaultLocalizationStrategy.cpp(327) : error C2001: newline in  constant<br />&nbsp;&nbsp;&nbsp;&nbsp; platform\DefaultLocalizationStrategy.cpp(327) : fatal error  C1057: unexpected end of file in macro expansion<br />&nbsp;&nbsp;&nbsp;&nbsp;  这个错误的原因是因为代码里面的非英文的引号造成的。<br />&nbsp;&nbsp;&nbsp; 原始的错误代码如下：<br />&nbsp;&nbsp;&nbsp;&nbsp; return WEB_UI_STRING("Look  Up &#8220;&lt;selection&gt;&#8221;", "Look Up context menu item with selected  word").replace("&lt;selection&gt;",  truncatedStringForLookupMenuItem(selectedString));<br />&nbsp;&nbsp;&nbsp;&nbsp;  大家注意　&lt;selection&gt; 单词前后的引号。就是它造成编译报错。修改成下面的代码<br />&nbsp;&nbsp;&nbsp; return  WEB_UI_STRING("Look Up \"&lt;selection&gt;\"", "Look Up context menu item with  selected word").replace("&lt;selection&gt;",  truncatedStringForLookupMenuItem(selectedString));<br />Tim：也就是将selection两侧的中文引号那里改成上文的样子，。。奇怪老外也用这种引号么。。<br />（4）configure之后设置环境变量：<br />&#9312;使用Arm  Emulator：<br />set INCLUDE=C:/Program Files/Microsoft Visual Studio  8/VC/ce/include;C:\Program Files\Windows CE  Tools\wce600\ARM_Emulator\Include\Armv4i<br />set LIB=C:/Program Files/Microsoft  Visual Studio 8/VC/ce/lib/armv4i;C:/Program Files/Windows CE  Tools/wce600/ARM_Emulator/Lib/armv4i<br />set PATH=C:/Program Files/Microsoft  Visual Studio 8/VC/ce/bin/x86_arm;%PATH%<br />&#9313;如果使用S2416的SDK：<br />set  INCLUDE=C:/Program Files/Microsoft Visual Studio 8/VC/ce/include;C:\Program  Files\Windows CE Tools\wce600\SBC2416\Include\Armv4i<br />set LIB=C:/Program  Files/Microsoft Visual Studio 8/VC/ce/lib/armv4i;C:/Program Files/Windows CE  Tools/wce600/SBC2416/Lib/armv4i<br />set PATH=C:/Program Files/Microsoft Visual  Studio  8/VC/ce/bin/x86_arm;%PATH%<br />执行：<br />nmake<br />Tim：我下载的源码4.8.6在configure之后，出现让直行：setcepaths.bat  wince600standard-armv4i-msvc2005 &amp;&amp;  nmake的提示，我估计不用设置上述环境变量，也有可能可以成功编译，但不冒那个险，直接按照文章推荐的步骤来。。<br />Tim：我运行setcepaths.bat，结果没有那个SDK只有wincewm60standard-armv4i-msvc2005，而且那个BAT里面，只是运行了check  sdk的动作。。所以结论是按照推荐文章指定SDK的路径，nmake应该就可以。。<br />Tim：用作者的方案，Nmake编译成功。。<br />（5）安装qt-vs-addin：<br />安装&#8220;qt-vs-addin-1.1.10.exe&#8221;。。<br />Tim：&#8220;qt-vs-addin-1.2.0-opensource.exe  ，就开始不支持VS2005。。&#8221;无语。。<br />（6）修改SDK的名称：<br />编辑"  C:\QT\CE6.0\4.8.6\mkspecs\wince60standard-armv4i-msvc2005\qmake.conf  "。。<br />将里面的<br />CE_SDK&nbsp;&nbsp;= STANDARDSDK_600<br />变更为<br />CE_SDK&nbsp;&nbsp;=  ARM_Emulator<br />Tim：因为原始编译的SDK环境，它名称叫做"wince600standard-armv4i-msvc2005"，Arm  Emulator的库跟这个环境也是一样的，但是名称不一样，Qt插件会报错。。<br />（7）包含环境变量：<br />&#9312;Arm_Emulator的话：<br />在VS2005  -&gt; Tool -&gt; Options -&gt; VC++ Directories -&gt;  Arm_Emulator里面：<br />Include增加：" C:\QT\4.8.6\CE6.0\Emulator\include  "。。<br />Library增加：" C:\QT\4.8.6\CE6.0\Emulator\lib "  。。<br />Tim：我一开始就没包含，结果编译别人的代码，报错没有" QtSql "。。<br />&#9313;WIN32编译的话：<br />在VS2005 -&gt;  Tool -&gt; Options -&gt; VC++ Directories -&gt; Win32里面：<br />Include增加："  C:\QT\4.8.6\WIN32\include "。。<br />Library增加：" C:\QT\4.8.6\WIN32\lib "  。。<br />Tim：<br />为了让Visual  Assist更好的识别QT的函数名、类名，最好在VS2005里面多添加一些目录如：<br />C:\QT\4.8.6\WIN32\src<br />C:\QT\4.8.6\WIN32\include\Qt<br />C:\QT\4.8.6\WIN32\include\QtCore<br />C:\QT\4.8.6\WIN32\include\QtGui<br />（8）开启Arm  Emulator：<br />Tool -&gt; Connect to Device -&gt; Arm Emulator  Device。。<br />（9）新建一个QT工程，编译、运行：<br />开启VS2005 -&gt; File -&gt; New -&gt; Project  -&gt; Qt4 Projects -&gt; Qt Window CE Application -&gt;  都选默认设置，然后编译、部署、执行，最后成功在Arm  Emulator里面弹出个对话框来（OK）。。<br />Tim：看到部署的时候，用了VS2005的库（msvcr80d.dll），还有QT的两三个库（QtCored4.dll、QtGuid4.dll什么的）。。<br />（10）编辑*.ui文件，设计界面：<br />安装"  qt-creator-opensource-windows-x86-3.3.0.exe "，才能打开" *.ui  "文件，从而变更界面。。<br />Tim：看了下.ui文件其实是一个xml结构的文档。。<br />Tim：<br />"  qt-creator-opensource-windows-x86-3.0.0.exe " Based on Qt5.2.0 (&nbsp;MSVC2010,32  bit&nbsp;)。。<br />" qt-creator-opensource-windows-x86-3.3.0.exe " Based on Qt5.4.0  (&nbsp;MSVC2010,32 bit&nbsp;)。。。。<br /><br /><br /><br /><br /><br /><br /><br /></p></div><img src ="http://www.cppblog.com/hkingSP/aggbug/216291.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/hkingSP/" target="_blank">宋鹏</a> 2019-03-08 14:30 <a href="http://www.cppblog.com/hkingSP/archive/2019/03/08/216291.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt5.10.1 static compiling on Windows MSVC/Ubuntu g++</title><link>http://www.cppblog.com/hkingSP/archive/2019/03/08/216289.html</link><dc:creator>宋鹏</dc:creator><author>宋鹏</author><pubDate>Fri, 08 Mar 2019 03:00:00 GMT</pubDate><guid>http://www.cppblog.com/hkingSP/archive/2019/03/08/216289.html</guid><wfw:comment>http://www.cppblog.com/hkingSP/comments/216289.html</wfw:comment><comments>http://www.cppblog.com/hkingSP/archive/2019/03/08/216289.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/hkingSP/comments/commentRss/216289.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/hkingSP/services/trackbacks/216289.html</trackback:ping><description><![CDATA[<h3>环境：Windows10 / vs2013 or vs2015（Qt5.10.1是以C++11为基础，因此vs2008歇菜了）</h3>参考代码里的Readme：<br /><br /><strong>1.安装：</strong><br />安装了perl/python2.7/ruby&nbsp;<br />安装了vs2015<br /><br /><strong>2.环境变量</strong><br /><div>add C:\Perl\bin to PERL_HOME<br />add %PERL_HOME% to path<br />add C:\Python27 to PYTHON_HOME<br />add %PYTHON_HOME% to path<br />add C:\Ruby26\bin to RUBY_HOME<br />add %RUBY_HOME% to path<br />add C:\Qt\Qt5.10.1\5.10.1\msvc2015\bin to QT_LIB_HOME<br />add %QT_LIB_HOME% to path<br />add C:\Qt\Qt5.10.1\Tools\QtCreator\bin to QT_CREATOR_HOME<br />add %QT_CREATOR_HOME% to path<br />注意：像官方推荐的一样，这里最好用同一版本的binary安装的Qt比较安装。<br />注意：如果这里没有添加QT的路径，就会被推荐用nmake编译，否则被推荐用jom编译。</div><strong>3.代码：</strong><br />代码解压缩到C:\Qt\Qt5.10.1_src<br />于是Configure文件在：<br />C:\Qt\Qt5.10.1_src<br /><br />qtbase文件夹在：<br /><div>C:\Qt\Qt5.10.1_src\qtbase<br /><br /><strong>4.修改配置从MD到MT（动态链接改为静态链接）：</strong><br /><div>修改文件：<br />C:\Qt\Qt5.10.1_src\qtbase\mkspecs\common\msvc-desktop.conf<br />修改下面几行代码：</div><div>QMAKE_CFLAGS_RELEASE&nbsp; &nbsp; = $$QMAKE_CFLAGS_OPTIMIZE -MD</div><div>QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD</div><div>QMAKE_CFLAGS_DEBUG&nbsp; &nbsp; &nbsp; = -Zi -MDd</div>改为：<br /><div>QMAKE_CFLAGS_RELEASE&nbsp; &nbsp; = $$QMAKE_CFLAGS_OPTIMIZE -MT</div><div>QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MT</div><div>QMAKE_CFLAGS_DEBUG&nbsp; &nbsp; &nbsp; = -Zi -MTd<br /><br />修改文件：<br />C:\Qt\Qt5.10.1_src\qtbase\mkspecs\common\msvc-version.conf<br />在最前面加上：<br /><div>QMAKE_MSC_VER = 1900</div></div>否则会报错：<br /><div>msvc-version.conf loaded but qmake_msc_ver isn't set<br /><br />运行C:\Qt\Qt5.10.1_src&gt;configure.bat 确认配置</div><strong>5.编译：</strong><br />&lt;license&gt;选择-opensource<br /><strong>控制台选择：</strong><br /><div>开始 -&gt; Visual Studio 2015 -&gt; Developer Command Prompt for VS2015&nbsp;<br /><strong>编译选择</strong>：<br /><div>&nbsp;-skip &lt;repo&gt; ......... Exclude an entire repository from the build.<br />Ex:<br /><div>-skip qtwebengine<br /><div>C:\Qt\Qt5.10.1_src\qtwebengine</div></div><div>-nomake &lt;part&gt; ....... Exclude &lt;part&gt; from the list of parts to be built.<br />Ex:<br /><div>-nomake tools -nomake examples -nomake tests<br /><div>C:\Qt\Qt5.10.1_src\qtbase\tests</div></div><div>-make &lt;part&gt; ......... Add &lt;part&gt; to the list of parts to be built.<br /><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Specifying this option clears the default list first.</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [libs and examples, also tools if not cross-building,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; also tests if -developer-build]<br /><div>-make libs -qt-zlib -qt-pcre -qt-libpng</div></div>Ex：<br /><div>C:\Qt\Qt5.10.1_src\qtbase\src\3rdparty\zlib</div></div></div></div><br /><div><strong>疯狂的缩减编译选择，可以用来尝试最小化编译，<span style="color: red;">当然我失败了</span>（ comercial user 可以用qt的Congiguration tool 然而我并没有，有些以来无法zh）</strong>：<br /><div>configure -confirm-license&nbsp;-opensource -platform win32-msvc -static -debug-and-release -prefix "C:\Qt\Qt5.10.1_static"&nbsp; -make libs -nomake tools -nomake examples -nomake tests -skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qttools -skip qttranslations -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -no-feature-texthtmlparser -no-feature-textodfwriter -no-feature-concurrent -no-feature-effects -no-feature-sharedmemory -no-feature-systemsemaphore -no-feature-im -no-feature-process -no-feature-dom -no-feature-filesystemmodel -no-feature-filesystemwatcher -no-feature-graphicsview -no-feature-graphicseffect -no-feature-sizegrip -no-feature-calendarwidget -no-feature-printpreviewwidget -no-feature-keysequenceedit -no-feature-colordialog -no-feature-filedialog -no-feature-fontdialog -no-feature-printpreviewdialog -no-feature-progressdialog -no-feature-inputdialog -no-feature-errormessage -no-feature-wizard -no-feature-datawidgetmapper -no-feature-imageformat_bmp -no-feature-imageformat_ppm -no-feature-imageformat_xbm -no-feature-imageformat_png -no-feature-imageformat_jpeg -no-feature-image_heuristic_mask -no-feature-image_text -no-feature-colornames -no-feature-cups -no-feature-paint_debug -no-feature-freetype -no-feature-translation -no-feature-codecs -no-feature-big_codecs -no-feature-iconv -no-feature-ftp -no-feature-udpsocket -no-feature-networkproxy -no-feature-socks5 -no-feature-networkdiskcache -no-feature-bearermanagement -no-feature-completer -no-feature-fscompleter -no-feature-desktopservices -no-feature-mimetype -no-feature-systemtrayicon -no-feature-undocommand -no-feature-undostack -no-feature-undogroup -no-feature-undoview -no-feature-statemachine -no-feature-gestures -no-feature-dbus -no-opengl&nbsp;<br /><br /><strong style="color: #339966;">成功的组合1</strong><strong>（想编译哪个 就去掉哪个skip）：</strong><br /><div>configure -confirm-license -opensource -platform win32-msvc -static -debug-and-release -prefix "C:\Qt\Qt5.10.1_mt_static" -make libs -nomake tools -nomake examples -nomake tests -skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qttools -skip qttranslations -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -no-opengl&nbsp;<br />尝试2：<br /><div>configure -confirm-license -opensource -platform win32-msvc -static -debug-and-release -prefix "C:\Qt\Qt5.10.1_mt_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwinextras -skip qtx11extras&nbsp; -no-openssl&nbsp;</div><div></div><div>Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.<br />结果：<br /><div>Static builds of QtWebEngine aren't supported.</div><div>"Some of the required modules (android|ios|winrt|qtHaveModule(webengine)) are not available."<br />skip webengine 继续测试：<br /><div>configure -confirm-license -opensource -platform win32-msvc -static -debug-and-release -prefix "C:\Qt\Qt5.10.1_mt_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -skip qtx11extras&nbsp; -no-openssl&nbsp;<br />结果：<br />成功<br /><br /><strong style="color: #339966;">成功的组合2：</strong><br />configure -confirm-license -opensource -platform win32-msvc -static -debug-and-release -prefix "C:\Qt\Qt5.10.1_mt_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -skip qtx11extras&nbsp; -no-openssl&nbsp;</div></div></div></div></div></div></div><strong>成功的组合1只是在单独编译qtbase时有用，于是以后采用的成功的组合2，总结命令为：</strong><br />cd C:\Qt\Qt5.10.1_src<br /><div>configure -confirm-license -opensource -platform win32-msvc -static -debug-and-release -prefix "C:\Qt\Qt5.10.1_mt_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -skip qtx11extras&nbsp; -no-openssl&nbsp;<br />jom -j2<br />jom install<br /><br />plus1:<br /><div>WARNING: Using OpenGL ES 2.0 on Windows without ANGLE.</div><div>The build will most likely fail.</div><div>Specify -opengl desktop to use regular OpenGL.<br /><br />plus2:<br /><div>-skip qtwebengine , 都是Linux only</div><div>Webengine options:</div><div>&nbsp; -webengine-alsa ................ Enable ALSA support [auto] (Linux only)</div><div>&nbsp; -webengine-pulseaudio .......... Enable PulseAudio support [auto]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(Linux only)</div><div>&nbsp; -webengine-embedded-build ...... Enable Linux embedded build [auto]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(Linux only)</div><div>&nbsp; -webengine-icu ................. Use system ICU libraries [system/qt]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(Linux only)<br /><br />plus3:<br />Static builds of QtWebEngine aren't supported.<br /><br /><h3>环境：Ubuntu 18.10/linux g++<br /></h3><div><strong><br />1.安装：</strong><br />安装了perl/python/ruby ( Linux 中 python2.x 的名字是python python3.x的名字是python3 )<br />统一安装：<br /><p>sudo apt-get install build-essential&nbsp;libpcap0.8-dev libx11-dev libfreetype6-dev libavahi-gobject-dev libsm-dev libxrender-dev perl python ruby</p><br /><strong>2.环境变量：</strong><br />linux的环境变量 只要不是特殊安装的，应该都被包含在内了<br /><br /><strong>3.代码：</strong><br /><div>同上<br /><br /><strong>4.动态链接改为静态链接：</strong><br /><div>linux没有md/mt，编译都时候 直接-static应该就可以。<br /><br /><strong>5.编译：</strong><br /><strong>尝试的组合1</strong>:<br />./configure -confirm-license -opensource -static -debug-and-release -prefix "/home/peng/Share/Qt5.10.1_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -no-openssl&nbsp;<br /><strong>编译出错</strong>：<br /><div>qfilesystemengine_unix.cpp:101:12: error: &#8216;int renameat2(int, const char*, int, const char*, unsigned int)&#8217; was declared &#8216;extern&#8217; and later &#8216;static&#8217; [-fpermissive]</div><div>bug fix：<br />这是跟glibc2.28有关的bug。。由于原来的patch已经对不上号，所以切换到5.10 或者5.11<br /><br /><strong>尝试的组合2</strong>（in qt 5.11）:<br />./configure -confirm-license -opensource -static -debug-and-release -prefix "/home/peng/Share/Qt5.10.1_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -no-openssl&nbsp;</div>configure执行出错：<br /><div>WARNING: -debug-and-release is only supported on Darwin and Windows platforms.&nbsp; Qt can be built in release mode with separate debug information, so -debug-and-release is no longer necessary.</div><div>ERROR: Feature 'debug_and_release' was enabled, but the pre-condition 'config.darwin || config.win32' failed.</div><div><strong>尝试的组合3</strong>（in qt 5.11）:<br />./configure -confirm-license -opensource -static -force-debug-info -prefix "/home/peng/Share/Qt5.11_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -no-openssl&nbsp;<br /><strong>编译出错</strong>：<br /><div>collect2: fatal error: ld terminated with signal 9 [Killed]</div><div>compilation terminated.</div><div>make[3]: *** [Makefile:135: ../../bin/qml] Error 1</div><div>make[3]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative/tools/qml'</div><div>make[2]: *** [Makefile:155: sub-qml-make_first] Error 2</div><div>make[2]: *** Waiting for unfinished jobs....</div><div>make[3]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative/tools/qmlpreview'</div><div>make[2]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative/tools'</div><div>make[1]: *** [Makefile:75: sub-tools-make_first] Error 2</div><div>make[1]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative'</div><div>make: *** [Makefile:159: module-qtdeclarative-make_first] Error 2<br /><br /><strong style="color: #339966;">尝试的组合4（成功的组合）</strong>（in qt 5.11）:<br /><div>./configure -confirm-license -opensource -static -force-debug-info -prefix "/home/peng/Share/Qt5.11_static" -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -nomake tools -nomake examples -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qttools -skip qtwebengine -skip qtwinextras -skip qtdeclarative&nbsp; -no-openssl&nbsp;<br />make -j2<br />make install<br />结果：<br />成功。</div></div></div><br />5.10.1的关于glibc的renameat的bug，被官方在5.11的branch里修复如下：<br /><div>commit 25feee4e061b99edab79503d81f5bd045c6c8e3d</div><div>Author: Thiago Macieira &lt;thiago.macieira@intel.com&gt;</div><div>Date:&nbsp; &nbsp;Tue Aug 7 09:38:42 2018 -0700</div><div></div><div>&nbsp; &nbsp; Fix qmake build with glibc 2.28</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; We haven't yet run the configure checks to see if statx and renameat2</div><div>&nbsp; &nbsp; are present in glibc, so this fails when we redefine the structures and</div><div>&nbsp; &nbsp; functions.</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; linux/stat.h:56:8: error: redefinition of 'struct statx_timestamp'</div><div>&nbsp; &nbsp; bits/statx.h:25:8: note: previous definition of 'struct statx_timestamp'</div><div>&nbsp; &nbsp; qfilesystemengine_unix.cpp:110:12: error: 'int renameat2(int, const char*, int, const char*, unsigned int)' was declared 'extern' and later 'static' [-fpermissive]</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; Change-Id: Ia741b559c24d46c78fb2fffd1548a792d22e3368</div><div>&nbsp; &nbsp; Reviewed-by: Oswald Buddenhagen &lt;oswald.buddenhagen@qt.io&gt;</div><div>&nbsp; &nbsp; Reviewed-by: J&#252;ri Valdmann &lt;juri.valdmann@qt.io&gt;<br /><br /><h3>环境：Ubuntu 18.04/交叉编译 arm<br /></h3><div><strong><br />1.安装：</strong><br />安装了perl/python/ruby ( Linux 中 python2.x 的名字是python python3.x的名字是python3 )<br />统一安装：<br /><p><span style="font-family: Arial; font-size: 10pt;">sudo apt-get install build-essential&nbsp;libpcap0.8-dev libx11-dev libfreetype6-dev libavahi-gobject-dev libsm-dev libxrender-dev perl python ruby&nbsp;</span><span style="font-family: Arial; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit; white-space: inherit; color: #242729; font-size: 10pt;">gcc-multilib g++-multilib<br /></span></p><div><span style="font-family: Arial; font-size: 10pt;">sudo apt-get install libxkbcommon-x11-dev libxkbcommon-dev libxcb-xkb-dev libxcb-cursor-dev libxcb1-dev libxcb-xtest0-dev libx11-xcb-dev<br />for opengl desktop:<br />sudo apt install&nbsp;</span><span style="color: #4d5156; font-family: arial, sans-serif; background-color: #ffffff;">libgl1-mesa-dev</span></div><p><span style="font-family: Arial; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit; white-space: inherit; color: #242729; font-size: 10pt;">for opengl es2:</span><span style="font-family: Arial; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit; white-space: inherit; color: #242729; font-size: 18pt;"><br /></span><span style="font-size: 10pt; font-family: Arial;">sudo apt-get install libglfw3-dev libgles2-mesa-dev</span></p></div></div><div></div><br />2. 配置<br /><div>./configure -recheck-all -confirm-license -opensource -xplatform linux-arm-gnueabihf-g++ -I /usr/arm-linux-gnueabihf/include -L /usr/lib/arm-linux-gnueabihf/ -L /lib/arm-linux-gnueabihf/ -L /usr/arm-linux-gnueabihf/lib/ -nomake tests -skip qtandroidextras -skip qtgamepad -skip qtmacextras -skip qtwebengine -skip qtwinextras -opengl es2 -qt-xcb -no-kms -prefix \"${PWD}/../qt-everywhere-install\"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><br />参考文献：<br /><div>https://retifrav.github.io/blog/2018/02/17/build-qt-statically/</div></div></div><div>https://blog.csdn.net/u012822903/article/details/62058287</div></div></div></div></div></div><img src ="http://www.cppblog.com/hkingSP/aggbug/216289.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/hkingSP/" target="_blank">宋鹏</a> 2019-03-08 11:00 <a href="http://www.cppblog.com/hkingSP/archive/2019/03/08/216289.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>