How to build QtLua with QtUiTools support?
-
How do I build QtLua with QtUiTools enabled? I was successful at building Qt 5.12.8 (from https://wiki.qt.io/Building_Qt_5_from_Git) and qtlua, but when I run the qtlua example, I get this error message:
phan@ubuntu:/usr/local/src/libqtlua/examples/lua/hello_uiload$ qtlua hello.lua
[string ""]:7: new_qobject:QtLua has been compiled without support for Qt uitools module.What is the proper procedure for building Qt5 & qtlua so that there will be support for Qt uitools module?
Thank you.
PS I am using Ubutu 20.4 -
Hi and welcome to devnet,
Can you share the exact configure line you used ?
Can you also post the configuration summary ? There might be some hints there.
Also, how did you proceed to build QtLua ? Just to check whether you used your custom build of Qt. -
These are my steps:
git clone git://code.qt.io/qt/qt5.git
cd qt5/
git checkout 5.12.8
perl init-repository
mkdir ../qt5-build ; cd ../qt5-build
../qt5/configure -developer-build -opensource -nomake tests -confirm-licenseBefore I type "make", I edit this file below to include "QT += uitools":
/usr/local/src/qt5/qtbase/util/accessibilityinspector/accessibilityinspector.pri:
# DEFINES += ACCESSIBILITYINSPECTOR_NO_UITOOLS
QT += uitools # before, this was commented outI think the first time I built without the "QT += uitools", the directory below didn't get created:
/usr/local/src/qt5-build/qtbase/include/QtUiTools/QUiLoaderThen I built libqtlua with:
cd libqtlua
mkdir bld2
cd bld2
cmake ..
makeIt tries to link shared libs in /usr/lib/x86_64-linux-gnu but I just change that manually to use shared libs in /usr/local/src/qt5-build/qtbase/lib via:
/usr/bin/c++ -rdynamic CMakeFiles/qtlua_app.dir/qtlua.cc.o -o qtlua -Wl,-rpath,/usr/local/src/libqtlua/bld2/src: ../../src/libqtlua.so /usr/local/src/qt5-build/qtbase/lib/libQt5Widgets.so.5.12.8 /usr/local/src/qt5-build/qtbase/lib/libQt5Gui.so.5.12.8 /usr/local/src/qt5-build/qtbase/lib/libQt5Core.so.5.12.8 /usr/local/lib/liblua.a /usr/local/src/qt5-build/qttools/src/designer/src/uitools/.obj/libQt5UiTools.so -lm -ldl /usr/bin/ld: ../../src/libqtlua.so: undefined reference to `QUiLoader::createWidget(QString const&, QWidget*, QString const&)' /usr/bin/ld: ../../src/libqtlua.so: undefined reference to `QUiLoader::QUiLoader(QObject*)' /usr/bin/ld: ../../src/libqtlua.so: undefined reference to `QUiLoader::~QUiLoader()' /usr/bin/ld: ../../src/libqtlua.so: undefined reference to `QUiLoader::load(QIODevice*, QWidget*)' collect2: error: ld returned 1 exit status
The libQt5UiTools.so I created myself manually via:
$ cd /usr/local/src/qt5-build/qttools/src/designer/src/uitools/.obj
$ g++ -shared -o libQt5UiTools.so *.o
Since I know the "QUiLoader::QUiLoader(QObject*)" is in those *.o. But when I link the qtlua above, why do I still have undefined reference to QUiLoader::QUiLoader(QObject*)?Thanks for your help.
My configuration summary is:
Build type: linux-g++ (x86_64, CPU features: mmx sse sse2)
Compiler: gcc 9.3.0
Configuration: use_gold_linker sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_gdb_index enable_new_dtags f16c headersclean largefile precompile_header rdrnd shani warnings_are_errors x86SimdAlways private_tests shared rpath debug c++11 c++14 c++1z concurrent dbus reduce_exports reduce_relocations release_tools stl
Build options:
Mode ................................... debug; optimized tools
Optimize debug build ................... no
Building shared libraries .............. yes
Using C standard ....................... C11
Using C++ standard ..................... C++1z
Using ccache ........................... no
Using gold linker ...................... yes
Using new DTAGS ........................ yes
Generating GDB index ................... yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX .................................. AVX AVX2
AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
Other x86 ............................ AES F16C RDRAND SHA
Intrinsics without -mXXX option ...... yes
Build parts ............................ libs examples tools
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... yes
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
udev ................................... yes
Using system zlib ...................... yes
Qt Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... yes
iconv .................................. no
ICU .................................... yes
Tracing backend ........................ <none>
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
Using system PCRE2 ..................... yes
Qt Network:
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
Linux AF_NETLINK ....................... yes
OpenSSL ................................ yes
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ yes
DTLS ................................... yes
SCTP ................................... no
Use system proxies ..................... yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ yes
HarfBuzz ............................... yes
Using system HarfBuzz ................ yes
Fontconfig ............................. yes
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... yes
PNG .................................. yes
Using system libpng ................ yes
EGL .................................... yes
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... yes
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
OpenGL ES 3.2 ........................ no
Vulkan ................................. yes
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. yes
X11 specific:
XLib ................................. yes
XCB Xlib ............................. yes
EGL on X11 ........................... yes
QPA backends:
DirectFB ............................... no
EGLFS .................................. yes
EGLFS details:
EGLFS OpenWFD ........................ no
EGLFS i.Mx6 .......................... no
EGLFS i.Mx6 Wayland .................. no
EGLFS RCAR ........................... no
EGLFS EGLDevice ...................... no
EGLFS GBM ............................ no
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
XCB:
Using system-provided XCB libraries .. yes
XCB XKB .............................. yes
XCB XInput ........................... yes
Native painting (experimental) ....... yes
GL integrations:
GLX Plugin ......................... yes
XCB GLX .......................... yes
EGL-X11 Plugin ..................... yes
Qt Sql:
SQL item models ........................ yes
Qt Widgets:
GTK+ ................................... yes
Styles ................................. Fusion Windows
Qt PrintSupport:
CUPS ................................... no
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt Testlib:
Tester for item models ................. yes
Qt SerialBus:
Socket CAN ............................. yes
Socket CAN FD .......................... yes
Further Image Formats:
JasPer ................................. no
MNG .................................... no
TIFF ................................... yes
Using system libtiff ................. yes
WEBP ................................... yes
Using system libwebp ................. no
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML sequence object .................... yes
QML list model ......................... yes
QML XML http request ................... yes
QML Locale ............................. yes
QML delegate model ..................... 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
TableView item ......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Scxml:
ECMAScript data model for QtScxml ...... yes
Qt Gamepad:
SDL2 ................................... no
Qt 3D:
Assimp ................................. yes
System Assimp .......................... no
Output Qt3D Job traces ................. no
Output Qt3D GL traces .................. no
Use SSE2 instructions .................. yes
Use AVX2 instructions .................. no
Aspects:
Render aspect ........................ yes
Input aspect ......................... yes
Logic aspect ......................... yes
Animation aspect ..................... yes
Extras aspect ........................ yes
Qt 3D Renderers:
OpenGL Renderer ........................ yes
Qt 3D GeometryLoaders:
Autodesk FBX ........................... no
Qt Wayland Drivers:
EGL .................................... yes
Raspberry Pi ........................... no
XComposite EGL ......................... yes
XComposite GLX ......................... yes
DRM EGL ................................ yes
libhybris EGL .......................... no
Linux dma-buf server buffer integration . no
Vulkan-based server buffer integration . no
Shm emulation server buffer integration . yes
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
Qt Wayland Compositor Layer Plugins:
VSP2 hardware layer integration ........ no
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
WinRT Bluetooth API (desktop & UWP) .... no
Qt Sensors:
sensorfw ............................... no
Qt Quick Controls 2:
Styles ................................. Default Fusion Imagine Material Universal
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Qt Positioning:
Gypsy GPS Daemon ....................... no
WinRT Geolocation API .................. no
Qt Location:
Qt.labs.location experimental QML plugin . yes
Geoservice plugins:
OpenStreetMap ........................ yes
HERE ................................. yes
Esri ................................. yes
Mapbox ............................... yes
MapboxGL ............................. yes
Itemsoverlay ......................... yes
QtXmlPatterns:
XML schema support ..................... yes
Qt Multimedia:
ALSA ................................... yes
GStreamer 1.0 .......................... yes
GStreamer 0.10 ......................... no
Video for Linux ........................ yes
OpenAL ................................. no
PulseAudio ............................. yes
Resource Policy (libresourceqt5) ....... no
Windows Audio Services ................. no
DirectShow ............................. no
Windows Media Foundation ............... no
Qt Tools:
QDoc ................................... yes
Qt WebEngine:
Embedded build ......................... no
Full debug information ................. no
Pepper Plugins ......................... yes
Printing and PDF ....................... yes
Proprietary Codecs ..................... no
Spellchecker ........................... yes
Native Spellchecker .................... no
WebRTC ................................. yes
Use System Ninja ....................... no
Geolocation ............................ yes
WebChannel support ..................... yes
Use v8 snapshot ........................ yes
Kerberos Authentication ................ no
Support qpa-xcb ........................ no
Use ALSA ............................... yes
Use PulseAudio ......................... yes
Optional system libraries used:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . no
opus ................................. no
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
glib ................................. yes
zlib ................................. yes
minizip .............................. no
libevent ............................. yes
jsoncpp .............................. no
protobuf ............................. no
libxml2 and libxslt .................. yes
lcms2 ................................ no
png .................................. yes
JPEG ................................. no
harfbuzz ............................. yes
freetype ............................. yes
Required system libraries:
fontconfig ........................... yes
dbus ................................. yes
nss .................................. yes
khr .................................. yes
glibc ................................ yes
Required system libraries for qpa-xcb:
x11 .................................. yes
libdrm ............................... no
xcomposite ........................... yes
xcursor .............................. yes
xi ................................... yes
xtst ................................. yesNote: Also available for Linux: linux-clang linux-icc
-
Looks like your call to cmake in QtLua detects your system's Qt. You likely have to tell it where to find your self-built Qt.
-
@SGaist
It didn't detect it (I forgot to mention), so I just edit the to include as if it had detected it:
/usr/local/src/libqtlua/bld2/config.hh
#define HAVE_QT_UITOOLS 1
and then manually link it. But still it's not finding the "QUiLoader::QUiLoader(QObject*)". Do you know how to fix that? Thanks. -
That's the thing, you should rebuild QtLua from scratch ensuring that your custom Qt is detected rather than manually fiddling with the generated files.
-
@SGaist I don't know how to fix QtLua's cmake to make it detect my custom Qt. It detects the Qt5 that was installed via apt install, but that doesn't have the QUiLoader either. Qt5 should have QUiLoader built by the default, but they don't. Even when I forced it with "QT += uitools", it didn't build the libQt5UiTools.so for me; I had to build it with "g++ -shared -o libQt5UiTools.so .o". Is this the proper way to build QtUiTools? The QUiLoader::QUiLoader(QObject) is in my libQt5UiTools.so, but why doesn't it work?
-
You have to pass -DCMAKE_PREFIX_PATH and give it the path to your custom Qt cmake files.
The ui tools module should have been built so there something off but I do not currently see anything obvious.
-
@SGaist I tried that but libqtlua still couldn't figured out to use uitools. I did got it to work by fixing the libqtlua.so library by adding /usr/local/src/qt5-build/qtbase/lib/libQt5UiTools.a to the generation of libqtlua.so via:
/usr/bin/c++ -fPIC -shared -Wl,-soname,libqtlua.so -o libqtlua.so CMakeFiles/qtlua.dir/qtluaconsole.cc.o CMakeFiles/qtlua.dir/qtluaenum.cc.o CMakeFiles/qtlua.dir/qtluaenumiterator.cc.o CMakeFiles/qtlua.dir/qtluafunction.cc.o CMakeFiles/qtlua.dir/qtluauseritem.cc.o CMakeFiles/qtlua.dir/qtluauseritemmodel.cc.o CMakeFiles/qtlua.dir/qtluauseritemselectionmodel.cc.o CMakeFiles/qtlua.dir/qtluauserlistitem.cc.o CMakeFiles/qtlua.dir/qtlualistiterator.cc.o CMakeFiles/qtlua.dir/qtluamember.cc.o CMakeFiles/qtlua.dir/qtluametacache.cc.o CMakeFiles/qtlua.dir/qtluamethod.cc.o CMakeFiles/qtlua.dir/qtluaplugin.cc.o CMakeFiles/qtlua.dir/qtluaproperty.cc.o CMakeFiles/qtlua.dir/qtluaqmetaobjecttable.cc.o CMakeFiles/qtlua.dir/qtluaqmetavalue.cc.o CMakeFiles/qtlua.dir/qtluaqmetaobjectwrapper.cc.o CMakeFiles/qtlua.dir/qtlualuamodel.cc.o CMakeFiles/qtlua.dir/qtluaqobjectiterator.cc.o CMakeFiles/qtlua.dir/qtluaqobjectwrapper.cc.o CMakeFiles/qtlua.dir/qtluaqtlib.cc.o CMakeFiles/qtlua.dir/qtluastate.cc.o CMakeFiles/qtlua.dir/qtluaitemviewdialog.cc.o CMakeFiles/qtlua.dir/qtluatablegridmodel.cc.o CMakeFiles/qtlua.dir/qtluatableiterator.cc.o CMakeFiles/qtlua.dir/qtluatabletreekeys.cc.o CMakeFiles/qtlua.dir/qtluatabletreemodel.cc.o CMakeFiles/qtlua.dir/qtluauserdata.cc.o CMakeFiles/qtlua.dir/qtluavaluebase.cc.o CMakeFiles/qtlua.dir/qtluavalue.cc.o CMakeFiles/qtlua.dir/qtluavalueref.cc.o CMakeFiles/qtlua.dir/qtluadispatchproxy.cc.o CMakeFiles/qtlua.dir/QtLua/moc_qtluaconsole.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluauseritemselectionmodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluauseritemmodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtlualuamodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluatabletreemodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluaitemviewdialog.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluatablegridmodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluastate.cpp.o CMakeFiles/qtlua.dir/moc_qtluaqtlib.cpp.o /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.12.8 /usr/local/src/qt5-build/qtbase/lib/libQt5UiTools.a /usr/local/lib/liblua.a -lm -ldl /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.12.8 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.12.8 /usr/bin/c++ -fPIC -shared -Wl,-soname,libqtlua.so -o libqtlua.so CMakeFiles/qtlua.dir/qtluaconsole.cc.o CMakeFiles/qtlua.dir/qtluaenum.cc.o CMakeFiles/qtlua.dir/qtluaenumiterator.cc.o CMakeFiles/qtlua.dir/qtluafunction.cc.o CMakeFiles/qtlua.dir/qtluauseritem.cc.o CMakeFiles/qtlua.dir/qtluauseritemmodel.cc.o CMakeFiles/qtlua.dir/qtluauseritemselectionmodel.cc.o CMakeFiles/qtlua.dir/qtluauserlistitem.cc.o CMakeFiles/qtlua.dir/qtlualistiterator.cc.o CMakeFiles/qtlua.dir/qtluamember.cc.o CMakeFiles/qtlua.dir/qtluametacache.cc.o CMakeFiles/qtlua.dir/qtluamethod.cc.o CMakeFiles/qtlua.dir/qtluaplugin.cc.o CMakeFiles/qtlua.dir/qtluaproperty.cc.o CMakeFiles/qtlua.dir/qtluaqmetaobjecttable.cc.o CMakeFiles/qtlua.dir/qtluaqmetavalue.cc.o CMakeFiles/qtlua.dir/qtluaqmetaobjectwrapper.cc.o CMakeFiles/qtlua.dir/qtlualuamodel.cc.o CMakeFiles/qtlua.dir/qtluaqobjectiterator.cc.o CMakeFiles/qtlua.dir/qtluaqobjectwrapper.cc.o CMakeFiles/qtlua.dir/qtluaqtlib.cc.o CMakeFiles/qtlua.dir/qtluastate.cc.o CMakeFiles/qtlua.dir/qtluaitemviewdialog.cc.o CMakeFiles/qtlua.dir/qtluatablegridmodel.cc.o CMakeFiles/qtlua.dir/qtluatableiterator.cc.o CMakeFiles/qtlua.dir/qtluatabletreekeys.cc.o CMakeFiles/qtlua.dir/qtluatabletreemodel.cc.o CMakeFiles/qtlua.dir/qtluauserdata.cc.o CMakeFiles/qtlua.dir/qtluavaluebase.cc.o CMakeFiles/qtlua.dir/qtluavalue.cc.o CMakeFiles/qtlua.dir/qtluavalueref.cc.o CMakeFiles/qtlua.dir/qtluadispatchproxy.cc.o CMakeFiles/qtlua.dir/QtLua/moc_qtluaconsole.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluauseritemselectionmodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluauseritemmodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtlualuamodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluatabletreemodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluaitemviewdialog.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluatablegridmodel.cpp.o CMakeFiles/qtlua.dir/QtLua/moc_qtluastate.cpp.o CMakeFiles/qtlua.dir/moc_qtluaqtlib.cpp.o /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.12.8 /usr/local/src/qt5-build/qtbase/lib/libQt5UiTools.a /usr/local/lib/liblua.a -lm -ldl /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.12.8 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.12.8
then type "make" and that's it. Once libqtlua.so has the Qt5UiTools symbols through the .a, then the problem is fixed. Wish it just worked out of the box though. Thanks.