How to configure QT6 static?
-
HI, I am a new beginner of QT6.
What i want to do is to make an application using QT6 and then deploy it to an embedded linux device which is not going to install QT6 source inside.I searched some documents and I found that I had to build my QT6 source by static to deploy my application stand alone.
Then, I was following this video;
youtube.com/watch?v=2qsR8Dw8uzAAND
i was trying to use
$ make -j8
command
then, i was stuck with this error message.
$ make: *** No targets specified and no makefile found. Stop.What would be the problem?
My log is like this;-- Configure summary:
Building for: linux-g++ (x86_64, CPU features: mmx sse sse2)
Compiler: gcc 11.4.0
Build options:
Mode ................................... release
Optimize release build for size ........ no
Fully optimize release builds (-O3) .... no
Building shared libraries .............. no
Using C standard ....................... C11
Using C++ standard ..................... C++17
Using ccache ........................... no
Unity Build ............................ no
Using new DTAGS ........................ yes
Relocatable ............................ no
Using precompiled headers .............. yes
Using Link Time Optimization (LTCG) .... no
Using Intel CET ........................ yes
Target compiler supports:
x86 Intrinsics ....................... Basic VAES AVX512VBMI2
Sanitizers:
Addresses ............................ no
Threads .............................. no
Memory ............................... no
Fuzzer (instrumentation only) ........ no
Undefined ............................ no
Build parts ............................ libs 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 PrintSupport ........................ yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... yes
udev ................................... no
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
OpenSSL 3.0 ............................ no
Using system zlib ...................... yes
Zstandard support ...................... no
Thread support ......................... yes
Common build options:
Linker can resolve circular dependencies yes
Qt Core:
backtrace .............................. yes
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... yes
ICU .................................... no
Using system libb2 ..................... no
Built-in copy of the MIME database ..... yes
cpp/winrt base ......................... no
Tracing backend ........................ <none>
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
PCRE2 .................................. yes
Using system PCRE2 ................... yes
CLONE_PIDFD support in forkfd .......... yes
Application permissions ................ no
Qt Sql:
SQL item models ........................ yes
Qt Network:
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
Linux AF_NETLINK ....................... yes
DTLS ................................... no
OCSP-stapling .......................... no
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Brotli Decompression Support ........... yes
qIsEffectiveTLD() ...................... yes
Built-in publicsuffix database ....... yes
System publicsuffix database ......... yes
Core tools:
Android deployment tool ................ yes
macOS deployment tool .................. no
Windows deployment tool ................ no
qmake .................................. 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
Text formats:
HtmlParser ........................... yes
CssParser ............................ yes
OdfWriter ............................ yes
MarkdownReader ....................... yes
Using system libmd4c ............... no
MarkdownWriter ....................... 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 ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
HiRes wheel support in libinput ........ no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. yes
X11 specific:
XLib ................................. yes
XCB Xlib ............................. yes
EGL on X11 ........................... yes
xkbcommon-x11 ........................ yes
xcb-sm ............................... no
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 ...................... yes
EGLFS GBM ............................ no
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
VK_KHR_display ......................... no
QNX:
lgmon ................................ no
IMF .................................. no
XCB:
Using system-provided xcb-xinput ..... no
GL integrations:
GLX Plugin ......................... no
XCB GLX .......................... no
EGL-X11 Plugin ..................... no
Windows:
Direct 2D ............................ no
Direct 2D 1.1 ........................ no
DirectWrite .......................... no
DirectWrite 3 ........................ no
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows
Qt Testlib:
Tester for item models ................. yes
Batch tests ............................ no
Qt PrintSupport:
CUPS ................................... no
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite ................................. yes
Using system provided SQLite ......... no
Further Image Formats:
JasPer ................................. no
MNG .................................... no
TIFF ................................... yes
Using system libtiff ................. no
WEBP ................................... yes
Using system libwebp ................. no
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML just-in-time compiler .............. yes
QML XML http request ................... yes
QML Locale ............................. yes
Qt QML Models:
QML list model ......................... yes
QML delegate model ..................... yes
Qt Quick:
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
TableView item ......................... yes
TreeView item .......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Calendar support ....................... yes
Qt Quick Controls 2:
Styles ................................. Basic Fusion Imagine iOS Material Universal macOS Windows
QtQuick3D:
Assimp ................................. yes
System Assimp .......................... no
Qt Multimedia:
Spatial Audio .......................... yes
Spatial Audio (Quick3D) ................ yes
Low level Audio Backend:
ALSA (experimental) .................. no
PulseAudio ........................... no
MMRenderer ........................... no
CoreAudio ............................ no
Windows Media SDK .................... no
Open SLES (Android) .................. no
Web Assembly ......................... no
Plugin:
GStreamer 1.0 ........................ no
FFmpeg ............................... no
MMRenderer ........................... no
AVFoundation ......................... no
Windows Media Foundation ............. no
Hardware acceleration and features:
Video for Linux ...................... yes
VAAPI support ........................ no
Linux DMA buffer support ............. yes
VideoToolbox ......................... no
Qt 3D:
Assimp ................................. yes
System Assimp .......................... 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 APIs:
Vulkan ................................. no
Qt 3D Renderers:
OpenGL Renderer ........................ yes
RHI Renderer ........................... yes
Qt3D Geometry Loaders:
Autodesk FBX ........................... no
Qt 5 Compatibility Libraries:
iconv .................................. yes
Qt Charts Types:
Area Chart ............................. yes
Line Chart ............................. yes
Spline Chart ........................... yes
Scatter Chart .......................... yes
Bar Chart .............................. yes
Pie Chart .............................. yes
Boxplot Chart .......................... yes
Candlestick Chart ...................... yes
Qt Axis Types:
DateTime Axis .......................... yes
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
WinRT Bluetooth API .................... no
Qt Tools:
Qt Assistant ........................... yes
QDoc ................................... no
Clang-based lupdate parser ............. no
Qt Designer ............................ yes
Qt Distance Field Generator ............ yes
Qt Linguist ............................ yes
pixeltool .............................. yes
qdbus .................................. yes
Qt Attributions Scanner ................ yes
qtdiag ................................. yes
qtplugininfo ........................... yes
Serial Port:
ntddmodm ............................... no
WebEngine Repository Build Options:
Build Ninja ............................ no
Build Gn ............................... yes
Jumbo Build ............................ yes
Developer build ........................ no
Build QtWebEngine Modules:
Build QtWebEngineCore ................ no
Build QtWebEngineWidgets ............. no
Build QtWebEngineQuick ............... no
Build QtPdf Modules:
Build QtPdfWidgets ................... no
Build QtPdfQuick ..................... no
Optional system libraries:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . no
opus ................................. no
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
glib ................................. yes
zlib ................................. yes
minizip .............................. no
libevent ............................. no
libxml2 and libxslt .................. no
lcms2 ................................ no
png .................................. yes
jpeg ................................. no
libopenjpeg2 ......................... no
harfbuzz ............................. no
freetype ............................. yes
libpci ............................... no
Qt 3rdparty libs:
qtfreetype ........................... no
qtharfbuzz ........................... yes
qtpng ................................ no
qtjpeg ............................... yes
qtzlib ............................... no
Qt Protobuf tools:
Qt Protobuf generator ................ no
Qt GRPC:
gRPC support ......................... yes
Native gRPC support .................. no
Qt GRPC tools:
Qt GRPC generator .................... no
Qt Opcua:
Open62541 ............................ yes
Unified Automation C++ SDK ........... no
Support for namespace 0 NodeId names . yes
Namespace 0 NodeIds generator ........ no
Open62541 security support ........... no
Support for global discovery server .. no
Qt Remote Objects:
High Availability Manager (ham) ...... no
Qt Scxml:
ECMAScript data model for QtScxml .... yes
Qt Sensors:
sensorfw ............................. no
sensorfw_enabled_with_cmake .......... no
Qt SerialBus:
Socket CAN ........................... yes
Socket CAN FD ........................ yes
SerialPort Support ................... yes
Qt TextToSpeech:
Flite ................................ no
Flite with ALSA ...................... no
Speech Dispatcher .................... no
Qt Virtualkeyboard:
Desktop integration .................. yes
Built-in layouts ..................... yes
Key navigation ....................... no
Retro style as default ............... no
Sensitive Debug ...................... no
Cerence .............................. no
Static Linking ..................... no
Handwriting ........................ no
Alphabetic ....................... no
CJK .............................. no
XT9 ................................ no
XT9 Debug ........................ no
XT9 9-key layouts ................ no
Bundle resources ................... no
Handwriting ...................... no
XT9 .............................. no
Hunspell ............................. no
Using Hunspell copy from 3rdparty/ . no
OpenWnn .............................. yes
MyScript ............................. no
Language support enabled for:
Arabic ............................. yes
Bulgarian .......................... yes
Czech .............................. yes
Danish ............................. yes
German ............................. yes
Greek .............................. yes
English GB ......................... yes
English US ......................... yes
Spanish ............................ yes
Spanish Mexico ..................... yes
Estonian ........................... yes
Farsi .............................. yes
Finnish ............................ yes
French Canada ...................... yes
French France ...................... yes
Hebrew ............................. yes
Hindi .............................. yes
Croatian ........................... yes
Hungarian .......................... yes
Indonesian ......................... yes
Italian ............................ yes
Japanese ........................... yes
Korean ............................. yes
Malay .............................. yes
Norwegian .......................... yes
Dutch .............................. yes
Polish ............................. yes
Portuguese Brazil .................. yes
Portuguese Portugal ................ yes
Romanian ........................... yes
Russian ............................ yes
Slovak ............................. yes
Slovenian .......................... yes
Albanian ........................... yes
Serbian ............................ yes
Swedish ............................ yes
Thai ............................... yes
Turkish ............................ yes
Ukrainian .......................... yes
Vietnamese ......................... yes
Simplified Chinese ................. yes
Traditional Chinese ................ yes
HongKong Chinese ................... no
Traditional chinese input methods:
Zhuyin ............................. yes
Cangjie ............................ yesNote: 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: Hunspell in Qt Virtual Keyboard is not enabled. Spelling correction will not be available.WARNING: No backend for low level audio found.
WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Either set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
You will also need to set the FEATURE_clang CMake variable to ON to re-evaluate this check.
WARNING: Clang-based lupdate parser will not be available. LLVM and Clang C++ libraries have not been found.
You will need to set the FEATURE_clangcpp CMake variable to ON to re-evaluate this check.
WARNING: QtWebEngine won't be built. Static build is not supported.
WARNING: QtPdf won't be built. node.js version 12 or later is required.
WARNING: SensorFW support currently not enabled with cmake-- Configuring done
-- Generating done
-- Build files have been written to: /home/autobase/Qt/6.5.3/Src
autobase@ubuntu22044:~/Qt/6.5.3/Src$ make -j8
make: *** No targets specified and no makefile found. Stop. -
@hsjeong you have probably put the makefile somewhere else (with
-prefix
or something else). Or, since it is Qt 6, perhaps the build system isninja
, notmake
. Hard to say without seeing the actual configuration line you have used. -
@hsjeong a couple of things;
- there is no need to compile statically as long as you simply deploy the generated dynamic libraries to your device.
- you most likely need to cross-compile to the architecture of your embedded device. Are you sure it is running the same CPU as the one you compile with?
Building for: linux-g++ (x86_64, CPU features: mmx sse sse2)
- compiling as static means things like image plugins (jpeg/png etc) support is going to be missing. Are you sure you want to compile statically?
-
This is my configure:
md build\static-debug ..\..\configure.bat ^ -platform win32-msvc ^ -nomake tests ^ -nomake examples ^ -opensource -confirm-license ^ -prefix ..\..\output\static-debug ^ -no-pch ^ -debug ^ -static ^ -static-runtime ^ -ssl ^ -openssl ^ -openssl-linked ^ -icu ^ -gif ^ -ico ^ -opengl ^ -no-egl ^ -no-vulkan ^ -no-xcb ^ -no-libudev ^ -no-slog2 ^ -no-dbus ^ -skip qtdoc ^ -skip qtwayland ^ -skip qtwebengine ^ -skip qtwebview ^ -system-zlib ^ -system-libpng ^ -system-libjpeg ^ -system-freetype ^ -system-harfbuzz ^ -system-sqlite ^ -system-pcre ^ -system-doubleconversion ^ -system-webp ^ -system-tiff
however, build failed with:
正在创建库 qtshadertools\tools\qsb\qsb.lib 和对象 qtshadertools\tools\qsb\qsb.exp tiffd.lib(tif_lzma.c.obj) : error LNK2019: 无法解析的外部符号 lzma_code,函数 LZMAEncode 中引用了该符号 tiffd.lib(tif_lzma.c.obj) : error LNK2019: 无法解析的外部符号 lzma_end,函数 LZMASetupDecode 中引用了该符号 tiffd.lib(tif_lzma.c.obj) : error LNK2019: 无法解析的外部符号 lzma_memusage,函数 LZMADecode 中引用了该符号 tiffd.lib(tif_lzma.c.obj) : error LNK2019: 无法解析的外部符号 lzma_lzma_preset,函数 TIFFInitLZMA 中引用了该符号 tiffd.lib(tif_lzma.c.obj) : error LNK2019: 无法解析的外部符号 lzma_stream_encoder,函数 LZMAPreEncode 中引用了该符号 tiffd.lib(tif_lzma.c.obj) : error LNK2019: 无法解析的外部符号 lzma_stream_decoder,函数 LZMADecode 中引用了该符号 libwebp.lib(picture_csp_enc.c.obj) : error LNK2019: 无法解析的外部符号 SharpYuvConvert,函数 PreprocessARGB 中引用了该符号 libwebp.lib(picture_csp_enc.c.obj) : error LNK2019: 无法解析的外部符号 SharpYuvGetConversionMatrix,函数 PreprocessARGB 中引用了该符号 libwebp.lib(picture_csp_enc.c.obj) : error LNK2019: 无法解析的外部符号 SharpYuvInit,函数 ImportYUVAFromRGBA 中引用了该符号 harfbuzz.lib(hb-uniscribe.cc.obj) : error LNK2019: 无法解析的外部符号 __imp_UuidCreate,函数 "void __cdecl _hb_generate_unique_face_name(wchar_t *,unsigned int *)" (?_hb_generate_unique_face_name@@YAXPEA_WPEAI@Z) 中引用了该符号 harfbuzz.lib(hb-uniscribe.cc.obj) : error LNK2019: 无法解析的外部符号 ScriptFreeCache,函数 _hb_uniscribe_shaper_font_data_destroy 中引用了该符号 harfbuzz.lib(hb-uniscribe.cc.obj) : error LNK2019: 无法解析的外部符号 ScriptItemize,函数 "long __cdecl hb_ScriptItemizeOpenType(wchar_t const *,int,int,struct tag_SCRIPT_CONTROL const *,struct tag_SCRIPT_STATE const *,struct tag_SCRIPT_ITEM *,unsigned long *,int *)" (?hb_ScriptItemizeOpenType@@YAJPEB_WHHPEBUtag_SCRIPT_CONTROL@@PEBUtag_SCRIPT_STATE@@PEAUtag_SCRIPT_ITEM@@PEAKPEAH@Z) 中引用了该符号 harfbuzz.lib(hb-uniscribe.cc.obj) : error LNK2019: 无法解析的外部符号 ScriptShape,函数 "long __cdecl hb_ScriptShapeOpenType(struct HDC__ *,void * *,struct tag_SCRIPT_ANALYSIS *,unsigned long,unsigned long,int *,struct textrange_properties * *,int,wchar_t const *,int,int,unsigned short *,struct script_charprop *,unsigned short *,struct script_glyphprop *,int *)" (?hb_ScriptShapeOpenType@@YAJPEAUHDC__@@PEAPEAXPEAUtag_SCRIPT_ANALYSIS@@KKPEAHPEAPEAUtextrange_properties@@HPEB_WHHPEAGPEAUscript_charprop@@6PEAUscript_glyphprop@@3@Z) 中引用了该符号 harfbuzz.lib(hb-uniscribe.cc.obj) : error LNK2019: 无法解析的外部符号 ScriptPlace,函数 "long __cdecl hb_ScriptPlaceOpenType(struct HDC__ *,void * *,struct tag_SCRIPT_ANALYSIS *,unsigned long,unsigned long,int *,struct textrange_properties * *,int,wchar_t const *,unsigned short *,struct script_charprop *,int,unsigned short const *,struct script_glyphprop const *,int,int *,struct tagGOFFSET *,struct _ABC *)" (?hb_ScriptPlaceOpenType@@YAJPEAUHDC__@@PEAPEAXPEAUtag_SCRIPT_ANALYSIS@@KKPEAHPEAPEAUtextrange_properties@@HPEB_WPEAGPEAUscript_charprop@@HPEBGPEBUscript_glyphprop@@H3PEAUtagGOFFSET@@PEAU_ABC@@@Z) 中引用了该符号 freetyped.lib(sfnt.c.obj) : error LNK2019: 无法解析的外部符号 BrotliDecoderDecompress,函数 woff2_decompress 中引用了该符号 freetyped.lib(ftbzip2.c.obj) : error LNK2019: 无法解析的外部符号 BZ2_bzDecompressInit,函数 ft_bzip2_file_init 中引用了该符号 freetyped.lib(ftbzip2.c.obj) : error LNK2019: 无法解析的外部符号 BZ2_bzDecompress,函数 ft_bzip2_file_fill_output 中引用了该符号 freetyped.lib(ftbzip2.c.obj) : error LNK2019: 无法解析的外部符号 BZ2_bzDecompressEnd,函数 ft_bzip2_file_done 中引用了该符号 qtbase\bin\qsb.exe : fatal error LNK1120: 18 个无法解析的外部命令
how to add liblzma.lib and other libraries to cmake?
-
I use cmake directly and successful. This is my configure:
cmake -S ../.. ^ -G Ninja ^ -DCMAKE_BUILD_TYPE=Debug ^ -DBUILD_SHARED_LIBS=OFF ^ -DFEATURE_static_runtime=ON ^ -DCMAKE_INSTALL_PREFIX="C:/Library/QT/6.8.1/VS2019/x64-debug-static" ^ -DBUILD_qtdoc=OFF ^ -DBUILD_qtwebengine=OFF ^ -DBUILD_qtwebview=OFF ^ -DBUILD_qtwayland=OFF ^ -DBUILD_WITH_PCH=OFF ^ -DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE ^ -DQT_QMAKE_TARGET_MKSPEC=win32-msvc ^ -DCMAKE_C_COMPILER=cl ^ -DCMAKE_CXX_COMPILER=cl ^ -DQT_BUILD_TESTS=FALSE ^ -DQT_BUILD_EXAMPLES=FALSE ^ -DFEATURE_cxx20=OFF ^ -DFEATURE_cxx2b=OFF ^ -DFEATURE_ssl=ON ^ -DINPUT_openssl=linked ^ -DFEATURE_system_zlib=ON ^ -DFEATURE_system_sqlite=ON ^ -DINPUT_libpng=system ^ -DINPUT_libjpeg=system ^ -DINPUT_freetype=system ^ -DINPUT_harfbuzz=system ^ -DINPUT_pcre=system ^ -DINPUT_doubleconversion=system ^ -DINPUT_webp=system ^ -DINPUT_tiff=system ^ -DFEATURE_icu=ON ^ -DFEATURE_gif=ON ^ -DFEATURE_ico=ON ^ -DFEATURE_vulkan=OFF ^ -DFEATURE_xcb=OFF ^ -DFEATURE_egl=OFF ^ -DFEATURE_libudev=OFF ^ -DFEATURE_slog2=OFF ^ -DFEATURE_dbus=OFF ^ -DCMAKE_CXX_STANDARD=17 ^ -DCMAKE_C_STANDARD=11 ^ -DCMAKE_EXE_LINKER_FLAGS="brotlicommon.lib brotlidec.lib brotlienc.lib bz2d.lib deflatestatic.lib libsharpyuv.lib lzma.lib rpcrt4.lib usp10.lib"
The key should be to specify libs using CMAKE_EXE_LINKER_FLAGS