linux没有md/mt,编译都时候 直接-static应该就可以。
5.编译:尝试的组合1:
./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
编译出错:
qfilesystemengine_unix.cpp:101:12: error: ‘int renameat2(int, const char*, int, const char*, unsigned int)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
bug fix:
这是跟glibc2.28有关的bug。。由于原来的patch已经对不上号,所以切换到5.10 或者5.11
尝试的组合2(in qt 5.11):
./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
configure执行出错:
WARNING: -debug-and-release is only supported on Darwin and Windows platforms. Qt can be built in release mode with separate debug information, so -debug-and-release is no longer necessary.
ERROR: Feature 'debug_and_release' was enabled, but the pre-condition 'config.darwin || config.win32' failed.
尝试的组合3(in qt 5.11):
./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
编译出错:
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[3]: *** [Makefile:135: ../../bin/qml] Error 1
make[3]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative/tools/qml'
make[2]: *** [Makefile:155: sub-qml-make_first] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative/tools/qmlpreview'
make[2]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative/tools'
make[1]: *** [Makefile:75: sub-tools-make_first] Error 2
make[1]: Leaving directory '/home/peng/qt5/qt5/qtdeclarative'
make: *** [Makefile:159: module-qtdeclarative-make_first] Error 2
尝试的组合4(成功的组合)(in qt 5.11):
./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 -no-openssl
make -j2
make install
结果:
成功。
5.10.1的关于glibc的renameat的bug,被官方在5.11的branch里修复如下:
commit 25feee4e061b99edab79503d81f5bd045c6c8e3d
Author: Thiago Macieira <thiago.macieira@intel.com>
Date: Tue Aug 7 09:38:42 2018 -0700
Fix qmake build with glibc 2.28
We haven't yet run the configure checks to see if statx and renameat2
are present in glibc, so this fails when we redefine the structures and
functions.
linux/stat.h:56:8: error: redefinition of 'struct statx_timestamp'
bits/statx.h:25:8: note: previous definition of 'struct statx_timestamp'
qfilesystemengine_unix.cpp:110:12: error: 'int renameat2(int, const char*, int, const char*, unsigned int)' was declared 'extern' and later 'static' [-fpermissive]
Change-Id: Ia741b559c24d46c78fb2fffd1548a792d22e3368
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
环境:Ubuntu 18.04/交叉编译 arm
1.安装:安装了perl/python/ruby ( Linux 中 python2.x 的名字是python python3.x的名字是python3 )
统一安装:
sudo apt-get install build-essential libpcap0.8-dev libx11-dev libfreetype6-dev libavahi-gobject-dev libsm-dev libxrender-dev perl python ruby gcc-multilib g++-multilib
sudo apt-get install libxkbcommon-x11-dev libxkbcommon-dev libxcb-xkb-dev libxcb-cursor-dev libxcb1-dev libxcb-xtest0-dev libx11-xcb-dev
for opengl desktop:
sudo apt install libgl1-mesa-dev
for opengl es2:
sudo apt-get install libglfw3-dev libgles2-mesa-dev
2. 配置
./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\"
参考文献:
https://retifrav.github.io/blog/2018/02/17/build-qt-statically/