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已經(jīng)對不上號,所以切換到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執(zhí)行出錯:
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>
環(huán)境:Ubuntu 18.04/交叉編譯 arm
1.安裝:安裝了perl/python/ruby ( Linux 中 python2.x 的名字是python python3.x的名字是python3 )
統(tǒng)一安裝:
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/