编译 Qt 5.7.1 for arm 满血版
2025-06-07 11:03:47

半年前在 ARM 开发板上编译过 Qt 5.7.1,不过编译的插件较少,很多检测项都是no
最近将 GCC 升级到 15.1.0 了,所以决定重新编译一次。


在编译前确保动态库优先从新的 lib 目录中搜索

1
export LD_LIBRARY_PATH=/usr/local/lib

这次为了编译”满血版”,尽可能的安装多的依赖包

1
sudo apt install "^libxcb.*" libx11-dev libx11-xcb-dev libxext-dev libxi-dev libxfixes-dev libglu1-mesa-dev libfreetype6-dev libxrender-dev libfontconfig1-dev libxkbcommon-dev libxkbcommon-x11-dev libdbus-1-dev libasound2-dev libpulse-dev libudev-dev libwayland-dev libatspi2.0-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev zlib1g-dev libssl-dev libpng-dev libjpeg-dev libgbm-dev libdrm-dev libmtdev-dev libmysqlclient-dev unixodbc-dev libinput-dev libicu-dev libproxy-dev libdouble-conversion-dev libharfbuzz-dev freetds-dev libcups2-dev libpq-dev

这些包主要来自


配置信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
root@firefly:/opt/qtbase-opensource-src-5.7.1/build# ../configure -prefix "/opt/qt-5.7.1" -confirm-license -opensource -nomake examples -nomake tests

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) versions 3.
You are also licensed to use this software under the terms of
the GNU General Public License (GPL) versions 2.

You have already accepted the terms of the Open Source license.

Preparing build tree...
Creating qmake...
.Done.
Running configuration tests...
checking for C++14... yes.
checking for C++1z... yes.
checking for default C++ standard edition... yes.
checking for 64-bit std::atomic... no.
checking for 64-bit std::atomic in -latomic... yes.
checking for std::atomic for function pointers... yes.
checking for sse2... no.
checking for ipc_sysv... yes.
checking for zlib... yes.
checking for mtdev... yes.
checking for libjpeg... yes.
checking for libpng... yes.
checking for dlopen... no.
checking for libdl... yes.
checking for DB2... no.
checking for InterBase... no.
checking for MySQL (thread-safe)... no.
checking for MySQL (thread-unsafe)... yes.
checking for OCI... no.
checking for ODBC... yes.
checking for PostgreSQL... yes.
checking for SQLite2... no.
checking for TDS... yes.
checking for Cups... yes.
checking for POSIX iconv... yes.
checking for D-Bus... yes.
checking for libproxy... yes.
checking for Glib... yes.
checking for ICU... yes.
checking for PulseAudio... yes.
checking for OpenGL... yes.
checking for FontConfig... yes.
checking for libudev... yes.
checking for evdev... yes.
checking for tslib... no.
checking for xkbcommon... yes.
checking for libinput... yes.
checking for XLib... yes.
checking for Xrender... yes.
checking for XInput2... yes.
checking for xcb... yes.
checking for xcb-xkb... yes.
checking for xcb-syslibs... yes.
checking for xcb-render... yes.
checking for xcb-glx... yes.
checking for xcb-xlib... yes.
checking for GBM... yes.
checking for LinuxFB... yes.
checking for KMS... yes.
checking for Mir client... no.
checking for EGL... no.
checking for eglfs-brcm... no.
checking for eglfs-egldevice... no.
checking for eglfs-mali... no.
checking for eglfs-mali-2... no.
checking for eglfs-viv... no.
checking for DoubleConversion... yes.
checking for HarfBuzz... yes.
checking for STL... yes.
checking for POSIX clock_gettime()... yes.
checking for POSIX Monotonic Clock... yes.
checking for posix_fallocate... yes.
checking for mremap... yes.
checking for getaddrinfo... yes.
checking for inotify... yes.
checking for eventfd... yes.
checking for IPv6 interface name... yes.
checking for getifaddrs... yes.
checking for cloexec... yes.
checking for ppoll... yes.
checking for OpenSSL... yes.
checking for PCRE... yes.
checking for OpenVG... no.
checking for OpenVG... no.
checking for OpenVG (lc includes)... no.
checking for OpenVG (lc includes)... no.
checking for alsa... yes.
checking for GStreamer 1.0... no.
checking for GStreamer 0.10... no.
Done running configuration tests.

Configure summary

Build type: linux-g++ (arm, CPU features: none detected)
Platform notes:

- Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx

Build options:
Configuration .......... accessibility accessibility-atspi-bridge alsa atomic64-libatomic audio-backend c++11 c++14 c++1z clock-gettime clock-monotonic compile_examples concurrent cups dbus dbus-linked enable_new_dtags evdev eventfd fontconfig full-config gbm getaddrinfo getifaddrs glib iconv icu inotify ipv6ifname kms large-config largefile libinput libproxy libudev linuxfb medium-config minimal-config mremap mtdev opengl openssl png poll_ppoll posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports release rpath shared small-config system-doubleconversion system-freetype system-harfbuzz system-jpeg system-png system-zlib threadsafe-cloexec use_gold_linker xcb xcb-glx xcb-plugin xcb-render xcb-xlib xinput2 xkbcommon-evdev xlib xrender
Build parts ............ libs tools
Mode ................... release
Using sanitizer(s)...... none
Using C++ standard ..... c++1z
Using gold linker....... yes
Using new DTAGS ........ yes
Using PCH .............. yes
Using LTCG ............. no
Target compiler supports:
Neon ................. no

Qt modules and options:
Qt D-Bus ............... yes (linked to dbus-1)
Qt Concurrent .......... yes
Qt GUI ................. yes
Qt Widgets ............. yes
Large File ............. yes
QML debugging .......... yes
Use system proxies ..... no

Support enabled for:
Accessibility .......... yes
ALSA ................... yes
CUPS ................... yes
DoubleConversion........ yes (system library)
Evdev .................. yes
FontConfig ............. yes
FreeType ............... yes (system library)
Glib ................... yes
GStreamer .............. no
GTK platformtheme ...... no
HarfBuzz ............... yes (system library)
Iconv .................. yes
ICU .................... yes
Image formats:
GIF .................. yes (plugin, using bundled copy)
JPEG ................. yes (plugin, using system library)
PNG .................. yes (in QtGui, using system library)
libinput................ yes
Logging backends:
journald ............... no
syslog ............... no
mtdev .................. yes (system library)
Networking:
getaddrinfo .......... yes
getifaddrs ........... yes
IPv6 ifname .......... yes
libproxy.............. yes
OpenSSL .............. yes (loading libraries at run-time)
OpenGL / OpenVG:
EGL .................. no
OpenGL ............... desktop
OpenVG ............... no
PCRE ................... system
pkg-config ............. yes
PulseAudio ............. yes
QPA backends:
DirectFB ............. no
EGLFS ................ no
EGLFS i.MX6 ........ no
EGLFS i.MX6 Wayland. no
EGLFS EGLDevice .... no
EGLFS GBM .......... no
EGLFS Mali ......... no
EGLFS Raspberry Pi . no
EGLFS X11 .......... no
LinuxFB .............. yes
Mir client............ no
XCB .................. yes (system library)
EGL on X ........... no
GLX ................ yes
MIT-SHM ............ yes
Xcb-Xlib ........... yes
Xcursor ............ yes (loaded at runtime)
Xfixes ............. yes (loaded at runtime)
Xi2 ................ yes
Xrandr ............. yes (loaded at runtime)
Xrender ............ yes
XKB ................ yes
XShape ............. yes
XSync .............. yes
Session management ..... yes
SQL drivers:
DB2 .................. no
InterBase ............ no
MySQL ................ yes (plugin)
OCI .................. no
ODBC ................. yes (plugin)
PostgreSQL ........... yes (plugin)
SQLite 2 ............. no
SQLite ............... yes (plugin, using bundled copy)
TDS .................. yes (plugin)
tslib .................. no
udev ................... yes
xkbcommon-x11........... yes (system library)
xkbcommon-evdev......... yes
zlib ................... yes (system library)


NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
Configure with '-qreal float' to create a build that is binary compatible with 5.1.

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /opt/qt-5.7.1

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

其中很古老的数据库DB2InterBase等就不考虑了,需要从源码编译,而且相信基本没人会用到这个。
另外就是EGLFS全是no,因为我的板子是 Firefly RK3288,好像是因为缺少 GPU 驱动,这个没办法了,所以 Qt 只能软件渲染或通过 XCB。

开始编译

1
2
make -j4
make install

第1个错误

1
2
3
4
5
6
/usr/bin/ld.gold: error: .obj/qmutex_linux.o: multiple definition of 'QBasicMutex::lockInternal()'
/usr/bin/ld.gold: .obj/qmutex.o: previous definition here
/usr/bin/ld.gold: error: .obj/qmutex_linux.o: multiple definition of 'QBasicMutex::lockInternal(int)'
/usr/bin/ld.gold: .obj/qmutex.o: previous definition here
/usr/bin/ld.gold: error: .obj/qmutex_linux.o: multiple definition of 'QBasicMutex::unlockInternal()'
/usr/bin/ld.gold: .obj/qmutex.o: previous definition here

解决方法:编辑文件src/corelib/thread/thread.pri,注释掉qmutex_开头的文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
win32 {
SOURCES += \
#thread/qmutex_win.cpp \
thread/qthread_win.cpp \
thread/qwaitcondition_win.cpp
} else {
darwin {
#SOURCES += thread/qmutex_mac.cpp
} else: linux {
#SOURCES += thread/qmutex_linux.cpp
} else {
#SOURCES += thread/qmutex_unix.cpp
}
SOURCES += \
thread/qthread_unix.cpp \
thread/qwaitcondition_unix.cpp
}

(方法来自 https://blog.csdn.net/hezhanran/article/details/105053187

第2个错误

1
/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of 'QDBusMarshaller::~QDBusMarshaller()'

解决方法:编辑文件src/dbus/dbus.pro,注释掉qdbusmarshaller.cpp

1
2
3
qdbusextratypes.cpp \
#qdbusmarshaller.cpp \
qdbuscontext.cpp \

(方法来自 https://blog.csdn.net/hezhanran/article/details/105067723

第3个错误

我此次编译用的 Firefly RK3288,因为eglfs插件检测未通过,所以没碰到,正常情况下是会碰到这个错误的,解决方案在之前编译的文章中提到过

1
2
qeglfskmsegldevice.cpp:74:82: error: invalid conversion from ‘EGLDeviceEXT {aka void*}’ to ‘EGLNativeDisplayType {aka gbm_device*}’ [-fpermissive]
return static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice();

解决方法:https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f577a01f5e8d9678d268917ca727a6e9a3e819a6

1
2
3
4
5
 EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const
{
- return static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice();
+ return reinterpret_cast<EGLNativeDisplayType>(static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice());
}
上一页
2025-06-07 11:03:47
下一页