我有一台64位的Ubuntu机器。我已成功设法使用以下配置选项配置和编译Qt5 静态库
-xplatform linux-g++-32
现在,我想创建一个 32位静态Qt 构建。因此,我在配置时添加了额外的ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig' failed.
选项。
但是,我得到以下两个(无关?)错误
ERROR: The OpenGL functionality tests failed!
You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.
{{1}}
我认为我在这里缺少一些东西 - 比如缺少32位开发库。但我不知道我应该在64位机器上安装什么才能启用32位交叉编译。
如果对上述错误有快速简便的解决方法,请告知我们。
由于 阿比纳夫。
答案 0 :(得分:0)
Ok, so let me answer my own question. Or at least share what worked for me finally.
Background
Having successfully built Qt-5 on an Ubuntu 16.04 64-bit machine using the above options and thereafter successfully creating a 64-bit statically linked executable for my project, I was now looking to do the same in 32 bits.
Problem
Could not close on the correct set of configuration options and build environment setup for 32-bits
Solution
sudo apt-get install libfreetype6:i386
sudo apt-get install libfreetype6-dev:i386
Then change the following options when calling ./configure
for Qt.
-prefix (path-to-Qt32bit) -platform linux-g++-32 -I/usr/include/freetype2 -L/usr/lib/i386-linux-gnu
Call make
and then make install
.
Now, you will have a 32-bit build of Qt (on a 64-bit machine)
Gotcha
Despite doing the above, the generated 32-bit executable of my project wouldn't run on a 32-bit machine.
I thought it was a problem with my Qt build.
But turned out that I was running the executable on a Ubuntu-12.04 machine. And the libfreetype
shipped in 12.04 does not have some methods like FT_Property_Set
. Hence, I was seeing run-time undefined symbol
errors.
As a result, even though the executable was compiled, it couldn't run. The solution for me was to just install Ubuntu 16.04 (32-bit). The executable then ran without a hitch.