Ubuntu源码(Ubuntu源码编译安装qt)

Ubuntu源码(Ubuntu源码编译安装qt)div style width 656px margin 0 padding 0 height 0 div

大家好,我是讯享网,很高兴认识大家。




讯享网

 <tbody> <tr> <td id="artContent" style="max-width: 656px;"> <div style="width: 656px; margin: 0; padding: 0; height: 0;"></div> <p style="text-align: left; margin-right: 8px; margin-bottom: 1.5em; margin-left: 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">QT6固然先进,但与旧项目的兼容性不好,迁移起来太麻烦。因此想仍然使用QT5来继续项目。QT5.15是QT5的最后一个版本,也是长期维护的一个版本。这两天在 Ubuntu18.04 和 Ubuntu20.04 上分别安装了一下 QT5.15.13,踩了坑,特此记录一下。</p><blockquote style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;border-left: none;padding: 1em;border-radius: 8px;color: rgba(0, 0, 0, 0.5);background: rgb(247, 247, 247);margin: 2em 8px;"><p style="letter-spacing: 0.1em; color: rgb(80, 80, 80);">我这里有编译好的 Ubuntu18.04 和 Ubuntu20.04 版本,需要的可以找我免费要。</p></blockquote><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">之前一直用的QT版本是5.9或5.12,这两个版本的QT安装很简单,官方提供了离线安装包,只要在Ubuntu系统中运行这个安装包即可。</p><span style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;margin: 1.5em 8px;color: rgb(63, 63, 63);"><img doc360img-src='http://image109.360doc.com/DownloadImg/2024/05/0208/_1_058337_wm.jpeg' style="line-height: 1.75;border-radius: 4px;display: block;margin: 0.1em auto 0.5em;" title="null" src="http://image109.360doc.com/DownloadImg/2024/05/0208/_1_058337_wm.jpeg"></span><p><span style="font-family: &quot;Microsoft YaHei&quot;;font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;color: rgb(87, 107, 149);">上篇文章</span><span style="color: rgb(0, 0, 0);font-family: &quot;Microsoft YaHei&quot;;font-size: 14px;letter-spacing: normal;text-align: start;text-wrap: wrap;">也写了 QT6.2 的安装过程,这个版本虽然没有离线安装包,但是可以通过在线的方式傻瓜式安装:</span></p><span style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;margin: 1.5em 8px;color: rgb(63, 63, 63);"><img doc360img-src='http://image109.360doc.com/DownloadImg/2024/05/0208/_2_058588_wm.jpeg' style="line-height: 1.75;border-radius: 4px;display: block;margin: 0.1em auto 0.5em;" title="null" src="http://image109.360doc.com/DownloadImg/2024/05/0208/_2_058588_wm.jpeg"></span><p><span style="color: rgb(0, 0, 0);font-family: &quot;Microsoft YaHei&quot;;font-size: 14px;letter-spacing: normal;text-align: start;text-wrap: wrap;">然而,QT5.15.13既没有离线安装包,也无法通过在线的方式傻瓜式安装(在线安装方式目前只支持到QT5.15.2版本),只能通过源码编译的方式自己编译安装...... 于是,有了接下来的踩坑之旅。</span></p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">(1)下载链接: https://downloadhttp://www.360doc.com/content/24/0502/08/archive/qt/5.15/5.15.13/single/,随便下载一个即可。</p><span style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;margin: 1.5em 8px;color: rgb(63, 63, 63);"><img doc360img-src='http://image109.360doc.com/DownloadImg/2024/05/0208/_3_058744_wm.jpeg' style="line-height: 1.75;border-radius: 4px;display: block;margin: 0.1em auto 0.5em;" title="null" src="http://image109.360doc.com/DownloadImg/2024/05/0208/_3_058744_wm.jpeg"></span><p><span style="color: rgb(0, 0, 0);font-family: &quot;Microsoft YaHei&quot;;font-size: 14px;letter-spacing: normal;text-align: start;text-wrap: wrap;">(2)解压到本地的某个目录下</span></p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">(3)进入目录</p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">(1)configure,执行命令:</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;">http://www.360doc.com/content/24/0502/08/configure&nbsp;-prefix&nbsp;$PWD/qtbase&nbsp;-opensource</pre><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">命令中的&nbsp;&nbsp;为安装目录,按需修改。</p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">(2)make,编译</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;">make&nbsp;-j8</pre><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">(3)install,安装</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;">sudo&nbsp;make&nbsp;install</pre><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">如果不出错,恭喜你,安装完了QT最基本的模块。</p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">(4)如果想要安装其它子模块,例如安装&nbsp;&nbsp;模块(其它模块类似,只替换这个模块名称即可):</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"></pre><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">子模块的名字即为文件夹的名字:</p><span style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;margin: 1.5em 8px;color: rgb(63, 63, 63);"><img doc360img-src='http://image109.360doc.com/DownloadImg/2024/05/0208/_4_058822_wm.png' style="line-height: 1.75;border-radius: 4px;display: block;margin: 0.1em auto 0.5em;" title="null" src="http://image109.360doc.com/DownloadImg/2024/05/0208/_4_058822_wm.png"></span><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">我是一上来就遇到了坑:</p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">这是因为 http://www.360doc.com/content/24/0502/08/configure 的格式是 windows 系统下的,需要将其转换为 Ubuntu 系统下的格式。</p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">运行以下命令:</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;">find&nbsp;.&nbsp;-type&nbsp;f&nbsp;-print0&nbsp;|&nbsp;xargs&nbsp;-0&nbsp;dos2unix</pre><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">将下载的源码中的所有文件都扫描一遍,转换成 Ubuntu 系统下的文件格式。</p><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">然后再按上面的安装过程安装,就安装成功了。</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;">apt-get&nbsp;install&nbsp;-y&nbsp;libxkbcommon-x11-0</pre><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;">export&nbsp;QTWEBENGINE_DISABLE_SANDBOX=1</pre><p style="text-align: left; margin: 1.5em 8px; letter-spacing: 0.1em; color: rgb(63, 63, 63);">把下面的库全部装一遍:</p><pre style="background: rgb(30, 30, 30);color: rgb(220, 220, 220);font-size: 14px;letter-spacing: normal;text-align: left;line-height: 1.5;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"></pre><blockquote style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;border-left: none;padding: 1em;border-radius: 8px;color: rgba(0, 0, 0, 0.5);background: rgb(247, 247, 247);margin: 2em 8px;"><p style="letter-spacing: 0.1em; color: rgb(80, 80, 80);"><strong style="color: rgb(15, 76, 129);">如果觉得本文对你有帮助,麻烦点个赞和关注呗 ~~~</strong></p></blockquote><hr><blockquote style="font-size: 14px;letter-spacing: normal;text-wrap: wrap;text-align: left;line-height: 1.75;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;border-left: none;padding: 1em;border-radius: 8px;color: rgba(0, 0, 0, 0.5);background: rgb(247, 247, 247);margin: 2em 8px;"><ul style="line-height: 1.75;padding-left: 1em;list-style: circle;color: rgb(63, 63, 63);"><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>·&nbsp;大家好,我是&nbsp;<span style="color:blue;"><strong style="color: rgb(15, 76, 129);">同学小张</strong></span>,日常分享AI知识和实战案例</p></li><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>·&nbsp;欢迎&nbsp;<span style="color:red;"><strong style="color: rgb(15, 76, 129);">点赞 + 关注</strong></span>&nbsp;👏,<strong style="color: rgb(15, 76, 129);">持续学习</strong>,<strong style="color: rgb(15, 76, 129);">持续干货输出</strong>。</p></li></ul></blockquote><div style="margin-top: 1.5px;margin-bottom: 1.5px;letter-spacing: 0.578px;text-indent: 0em;text-wrap: wrap;text-align: center;"><span style="font-size: 20px;color: rgb(171, 25, 66);background-color: rgb(115, 250, 121);"><strong><span style="letter-spacing: normal;text-decoration-style: solid;text-decoration-color: rgb(30, 107, 184);">公众号内文章一览</span></strong></span></div><p style="text-align: center;"><img doc360img-src='http://image109.360doc.com/DownloadImg/2024/05/0208/_5_058978_wm.png' style="" src="http://image109.360doc.com/DownloadImg/2024/05/0208/_5_058978_wm.png"></p> </td> </tr> </tbody> 

讯享网
小讯
上一篇 2025-05-31 11:48
下一篇 2025-05-07 16:41

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/147165.html