Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to configure QT6 static?
Forum Updated to NodeBB v4.3 + New Features

How to configure QT6 static?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
15 Posts 6 Posters 4.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peal Wang
    wrote on last edited by
    #4

    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?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Peal Wang
      wrote on last edited by
      #5

      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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rparon
        wrote on last edited by
        #6

        is someone static compiling 6.8.2 in Windows 11 with VS2022 ?
        I run the command

        configure.bat -platform win32-msvc -release -static -static-runtime -prefix C:\Qt/Qt6.8.2/64 -commercial -confirm-license -plugin-manifests -nomake examples -nomake tests

        I am able to compile version 6.8.1 but with version 6.8.2 I get many warnings and finally it compiles about 12000 lines (6.8.2) or source instead of about 18000 (6.8.1)

        jsulmJ 1 Reply Last reply
        0
        • R rparon

          is someone static compiling 6.8.2 in Windows 11 with VS2022 ?
          I run the command

          configure.bat -platform win32-msvc -release -static -static-runtime -prefix C:\Qt/Qt6.8.2/64 -commercial -confirm-license -plugin-manifests -nomake examples -nomake tests

          I am able to compile version 6.8.1 but with version 6.8.2 I get many warnings and finally it compiles about 12000 lines (6.8.2) or source instead of about 18000 (6.8.1)

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #7

          @rparon said in How to configure QT6 static?:

          I am able to compile version 6.8.1 but with version 6.8.2 I get many warnings and finally it compiles about 12000 lines (6.8.2) or source instead of about 18000 (6.8.1)

          So, does the build succeed or not? The fact that it compiles less files can be related to what modules where activated when running configure script.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rparon
            wrote on last edited by
            #8

            thank you for the comment,
            yes, despite the many warnings (also requesting the folder of CLang) the compling process terminates and I able to run
            ninja install
            however whenI try to compile my project (QML + C++) the linking process terminates showing a strange error, see below ,cannot open input file '(.obj'

            [ 91%] Linking CXX static library myproject.lib
            [ 92%] Built target myproject
            [ 92%] Built target myprojectx_autogen_timestamp_deps
            [ 93%] Automatic MOC for target myprojectx
            [ 93%] Built target myprojectx_autogen
            [ 94%] Running AUTOMOC file extraction for target myprojectx
            [ 94%] Running moc --collect-json for target myprojectx
            [ 97%] Building CXX object CMakeFiles/myprojectx.dir/myprojectx_autogen/mocs_compilation.cpp.obj
            [ 97%] Building CXX object CMakeFiles/myprojectx.dir/myprojectx/myprojectxx.cpp.obj
            mocs_compilation.cpp
            myprojectxx.cpp
            [ 98%] Linking CXX shared library myprojectx.dll

            ....

            failed (exit code 1181) with the following output:
            LINK : fatal error LNK1181: cannot open input file '(.obj'
            jom: E:\bin\ppp\windows\64\CMakeFiles\myprojectx.dir\build.make [myprojectx.dll] Error 2
            jom: E:\bin\ppp\windows\64\CMakeFiles\Makefile2 [CMakeFiles\myprojectx.dir\all] Error 2
            jom: E:\bin\ppp\windows\64\Makefile [all] Error 2
            01:47:28: The process "C:\CMake\bin\cmake.exe" exited with code 2.
            01:47:28: Error while building/deploying project myprojectx (kit: Qt 6.8.1(64))
            01:47:28: When executing step "Build"
            01:47:28: Elapsed time: 00:29.

            which seems strange as I am unable to locate a file name with this string / substring '(.obj' inside....

            do you have any clue to solve this problem ?

            jsulmJ 1 Reply Last reply
            0
            • R rparon

              thank you for the comment,
              yes, despite the many warnings (also requesting the folder of CLang) the compling process terminates and I able to run
              ninja install
              however whenI try to compile my project (QML + C++) the linking process terminates showing a strange error, see below ,cannot open input file '(.obj'

              [ 91%] Linking CXX static library myproject.lib
              [ 92%] Built target myproject
              [ 92%] Built target myprojectx_autogen_timestamp_deps
              [ 93%] Automatic MOC for target myprojectx
              [ 93%] Built target myprojectx_autogen
              [ 94%] Running AUTOMOC file extraction for target myprojectx
              [ 94%] Running moc --collect-json for target myprojectx
              [ 97%] Building CXX object CMakeFiles/myprojectx.dir/myprojectx_autogen/mocs_compilation.cpp.obj
              [ 97%] Building CXX object CMakeFiles/myprojectx.dir/myprojectx/myprojectxx.cpp.obj
              mocs_compilation.cpp
              myprojectxx.cpp
              [ 98%] Linking CXX shared library myprojectx.dll

              ....

              failed (exit code 1181) with the following output:
              LINK : fatal error LNK1181: cannot open input file '(.obj'
              jom: E:\bin\ppp\windows\64\CMakeFiles\myprojectx.dir\build.make [myprojectx.dll] Error 2
              jom: E:\bin\ppp\windows\64\CMakeFiles\Makefile2 [CMakeFiles\myprojectx.dir\all] Error 2
              jom: E:\bin\ppp\windows\64\Makefile [all] Error 2
              01:47:28: The process "C:\CMake\bin\cmake.exe" exited with code 2.
              01:47:28: Error while building/deploying project myprojectx (kit: Qt 6.8.1(64))
              01:47:28: When executing step "Build"
              01:47:28: Elapsed time: 00:29.

              which seems strange as I am unable to locate a file name with this string / substring '(.obj' inside....

              do you have any clue to solve this problem ?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #9

              @rparon Did you do a complete rebuild after switching to that Qt version?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rparon
                wrote on last edited by
                #10

                yes, I put the sources of Qt 6.8.2 in C:/Qt/6.8.2/64 and the library was compiled with VS2022 after executing

                configure.bat -platform win32-msvc -release -static -static-runtime -prefix C:\Qt/Qt6.8.2/64 -commercial -confirm-license -plugin-manifests -nomake examples -nomake tests

                then

                cmake --build --parallel

                ninja install

                still I have previous version in C:/Qt/6.8.1/64 and C:/Qt/6.8.1/32 but I suppose there are no global vars which may cause conflicts...

                jsulmJ 1 Reply Last reply
                0
                • R rparon

                  yes, I put the sources of Qt 6.8.2 in C:/Qt/6.8.2/64 and the library was compiled with VS2022 after executing

                  configure.bat -platform win32-msvc -release -static -static-runtime -prefix C:\Qt/Qt6.8.2/64 -commercial -confirm-license -plugin-manifests -nomake examples -nomake tests

                  then

                  cmake --build --parallel

                  ninja install

                  still I have previous version in C:/Qt/6.8.1/64 and C:/Qt/6.8.1/32 but I suppose there are no global vars which may cause conflicts...

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  @rparon I'm not talking about building Qt, I'm talking about building your project

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    rparon
                    wrote on last edited by
                    #12

                    sure, it was the first think to do...

                    1. in build directory manually delete all files and folders (CMake cache,MOC files etc.etc.)
                    2. manually delete CMakeList.txt.user to force Qt Creator to redefine all the makefiles

                    you may imagine I was quite surprised to see exactly the same error reported -> LINK : fatal error LNK1181: cannot open input file '(.obj'

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rparon
                      wrote on last edited by
                      #13

                      a possibility, which I have not investigated, is that Qt Creator or CMake may store something outside the build directory, but I am not aware of that...

                      jsulmJ 1 Reply Last reply
                      0
                      • R rparon

                        a possibility, which I have not investigated, is that Qt Creator or CMake may store something outside the build directory, but I am not aware of that...

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        @rparon Then you should check your CMakeLists.txt file or post it here, so others can take a look. Something must be wrong there.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          rparon
                          wrote on last edited by
                          #15

                          the cause was a bad format in module-definition (.def file) which, for unknown reasons, generated that error when linking ...
                          Now Qt 6.8.2 works fine, thank you for help.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved