1.下载Qt源码:qt-everywhere-opensource-src-5.9.1.tar.xz
2.解压 tar xvJf qt-everywhere-opensource-src-5.9.1.tar.xz
3.切换到该目录:
./configure -static -fontconfig -sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -system-libpng -system-freetype -iconv -nomake tests -qt-xcb -nomake examples -skip qt3d -skip qtwebkit -prefix /usr/Qt-5.9.1-static
./configure -static -fontconfig -sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -system-libpng -system-freetype -iconv -nomake tests -qt-xcb -nomake examples -skip qt3d -skip qtwebkit -prefix /usr/Qt-5.9.1-static
+ cd qtbase
+ /home/xxx/Qt5Static/qt-everywhere-opensource-src-5.9.1/qtbase/configure -top-level -static -fontconfig -sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -system-libpng -system-freetype -iconv -nomake tests -qt-xcb -nomake examples -skip qt3d -skip qtwebkit -prefix /usr/Qt-5.9.1-static
Creating qmake...
.Done.
Selecting Qt Edition.
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
Which edition of Qt do you want to use? o
This is the Qt Open Source Edition.
You are licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) version 3
or the GNU General Public License (GPL) version 2.
Type 'L' to view the GNU Lesser General Public License version 3 (LGPLv3).
Type 'G' to view the GNU General Public License version 2 (GPLv2).
Type 'y' to accept this license offer.
Type 'n' to decline this license offer.
Do you accept the terms of either license? y
Running configuration tests...
Done running configuration tests.
Configure summary:
Build type: linux-g++ (i386, CPU features: )
Configuration: use_gold_linker sse2 sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c largefile precompile_header release c++11 c++14 c++1z concurrent dbus mremap reduce_exports reduce_relocations static stl
Build options:
Mode ................................... release
Optimize release build for size ........ no
Building shared libraries .............. no
Using C++ standard ..................... C++1z
Using gold linker ...................... yes
Using new DTAGS ........................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX .................................. AVX AVX2 F16C
AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
Build parts ............................ libs tools
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... yes
QML debugging .......................... yes
udev ................................... no
Using system zlib ...................... no
Qt Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
iconv .................................. yes
ICU .................................... no
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
Using system PCRE2 ..................... no
Qt Network:
getaddrinfo() .......................... yes
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
SCTP ................................... no
Use system proxies ..................... yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ yes
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. yes
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ yes
EGL .................................... no
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... yes
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon-evdev ........................ no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
X11:
Using system-provided XCB libraries .. no
EGL on X11 ........................... no
Xinput2 .............................. no
XCB XKB .............................. yes
XLib ................................. yes
XCB render ........................... yes
XCB GLX .............................. yes
XCB Xlib ............................. yes
Using system-provided xkbcommon ...... no
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows
Qt PrintSupport:
CUPS ................................... no
Qt Sql:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ yes
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt SerialBus:
Socket CAN ............................. yes
Socket CAN FD .......................... yes
QtXmlPatterns:
XML schema support ..................... yes
Qt QML:
QML interpreter ........................ yes
QML network support .................... yes
Qt Quick:
Direct3D 12 ............................ no
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Gamepad:
SDL2 ................................... no
Qt Wayland Client ........................ no
Qt Wayland Compositor .................... no
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
Qt Sensors:
sensorfw ............................... no
Qt Multimedia:
ALSA ................................... no
GStreamer 1.0 .......................... no
GStreamer 0.10 ......................... no
Video for Linux ........................ yes
OpenAL ................................. no
PulseAudio ............................. no
Resource Policy (libresourceqt5) ....... no
Windows Audio Services ................. no
DirectShow ............................. no
Windows Media Foundation ............... no
Qt Quick Controls 2:
Styles ................................. Default Material Universal
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Qt Location:
Gypsy GPS Daemon ....................... no
WinRT Geolocation API .................. no
Qt WebEngine:
Embedded build ......................... no
Pepper Plugins ......................... yes
Printing and PDF ....................... yes
Proprietary Codecs ..................... no
Spellchecker ........................... yes
WebRTC ................................. yes
Using system ninja ..................... no
ALSA ................................... no
PulseAudio ............................. no
System libraries:
ICU .................................. no
libwebp and libwebpdemux ............. no
Opus ................................. no
ffmpeg ............................... no
Note: Also available for Linux: linux-clang linux-icc
Note: Using static linking will disable the use of dynamically
loaded plugins. Make sure to import all needed static plugins,
or compile needed modules into the library.
Note: Disabling Linux Accessibility Bridge: D-Bus is missing.
Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/usr/Qt-5.9.1-static'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
4.make
5.make install
6.在~/.profile中添加一下内容:
QTDIR=/usr/Qt-5.9.1-static
PATH=$QTDIT/bin:$PATH
MANPATH=$QTDIR/doc/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH LD_LIBRARY_PATH
7.在Creator中配置一下环境即可使用。
一些问题:
需要安装freetype和fontconfig,否则会出现编译出来的GUI程序,无法显示文字。
sudo apt-get install libfreetpye6-dev
sudo apt-get install libfontconfig1-dev