如何本身编译Qt,为静态编译程序减小依赖方便发布作准备

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

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

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

make -j4github

FontConfig ............. noubuntu

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

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

解释: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.ide

若是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.htmlui

 

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后编译经过 

相关文章
相关标签/搜索