如何自己编译Qt,为静态编译程序减少依赖方便发布做准备

使用./configure -prefix /opt/Qt-5.6 -gstreamer 1.0  make  make install 编译后,qml audio可以播放mp3了,也就是qtmutimedia已经使用 gstreamer 1.0了,但是qml界面只能显示英文,所有中文汉字都不显示了。

静态编译命令: ./configure -static -prefix /opt/Qt-5.8-static -gstreamer 1.0 -fontconfig

./configure -prefix /opt/Qt-5.6 -gstreamer 1.0 -fontconfig

make -j4

FontConfig ............. no

sudo apt install libfontconfig1-dev
FontConfig ............. Yes

http://doc.qt.io/qt-5/qt-embedded-fonts.html

解释:Qt normally uses fontconfig to provide access to system fonts. Iffontconfig is not available, e.g. in dedicated embedded systems where space is at a premium, Qt will fall back to using QBasicFontDatabase. In this case, Qt applications will look for fonts in Qt's lib/fonts/ directory. Qt will automatically detect prerendered fonts and TrueType fonts.

如果fontconfig 是 no,Qt就不能使用系统字体,只能使用lib/fonts 目录下的字体,没提供汉字字体,因此qml界面的汉字无法显示。

关于-qt-xcb选项的解释:It's possible to configure Qt with -qt-xcb, which compiles in a set of xcb helper libraries instead of trying to link against the system versions. This can help make Qt less dependent on some of the xcb helper libraries that might not be available on all distributions. The table specifies which dependencies are provided by -qt-xcb. 资料来源:http://doc.qt.io/qt-5/linux-requirements.html

 

Ubuntu16.04 gcc5.4.0编译Qt5.8 beta版时,如下错误

painting/qdrawhelper.cpp: In function ‘void blend_transformed_tiled_argb(int, const QSpan*, void*)’:
painting/qdrawhelper.cpp:4846:13: internal compiler error: Segmentation fault
 static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *u

             ^

Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
Makefile:46611: recipe for target '.obj/qdrawhelper.o' failed
make[3]: *** [.obj/qdrawhelper.o] Error 1

搜索后,初步判定是gcc编译器bug 

Ubuntu 安装最新的gcc https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91

These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.

If you are still reading let's carry on with the code.

sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-snapshot -y && \
sudo apt-get update && \
sudo apt-get install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
sudo apt-get install gcc-4.8 g++-4.8 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;

When completed, you must change to the gcc you want to work with by default
sudo update-alternatives --config gcc

To verify if it worked. Just type in your terminal
gcc -v

If everything went fine you should see gcc 6.1.1  by the time I am writing this gist

Happy coding!

gcc升级到6.2.0后编译通过 

转载于:https://my.oschina.net/lieefu/blog/755790

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值