Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 5.15.9 static compilation issue
Forum Updated to NodeBB v4.3 + New Features

Qt 5.15.9 static compilation issue

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 649 Views
  • 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.
  • Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by
    #1

    Hello!

    I want to build Qt 5.15.9 statically with MySQL. I got the following error during compilation process:

    moc_fontpanel.cpp
    moc_aboutdialog.cpp
    moc_bookmarkdialog.cpp
    moc_bookmarkfiltermodel.cpp
    moc_bookmarkmanager.cpp
    moc_bookmarkmanagerwidget.cpp
    moc_bookmarkmodel.cpp
    moc_centralwidget.cpp
    moc_contentwindow.cpp
    moc_findwidget.cpp
    moc_helpdocsettingswidget.cpp
    moc_helpenginewrapper.cpp
    moc_helpviewer.cpp
    moc_helpviewer_p.cpp
    moc_indexwindow.cpp
    moc_mainwindow.cpp
    moc_preferencesdialog.cpp
    moc_qtdocinstaller.cpp
    moc_remotecontrol.cpp
    moc_searchwidget.cpp
    moc_topicchooser.cpp
    moc_openpagesmodel.cpp
    moc_globalactions.cpp
    moc_openpageswidget.cpp
    moc_openpagesmanager.cpp
    moc_openpagesswitcher.cpp
    moc_stdinlistener_win.cpp
            link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERSION:5.15 /MANIFEST:embed /OUT:..\..\..\bin\assistant.exe @C:\Users\cobra\AppData\Local\Temp\nm2E9F.tmp
    Qt5Cored.lib(crc32.obj) : error LNK2005: crc32_combine_op already defined in mysqlclientMTd.lib(crc32.c.obj)
    Qt5Cored.lib(crc32.obj) : error LNK2005: crc32_combine_gen already defined in mysqlclientMTd.lib(crc32.c.obj)
    Qt5Cored.lib(crc32.obj) : error LNK2005: crc32_combine_gen64 already defined in mysqlclientMTd.lib(crc32.c.obj)
    ..\..\..\bin\assistant.exe : fatal error LNK1169: one or more multiply defined symbols found
    NMAKE : fatal error U1077: 'link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERSION:5.15 /MANIFEST:embed /OUT:..\..\..\bin\assistant.exe @C:\Users\cobra\AppData\Local\Temp\nm2E9F.tmp' : return code '0x491'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile.Debug' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd assistant\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\src\assistant\assistant\assistant.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd assistant\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\src\assistant\assistant.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd src\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\src\src.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd qttools\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\qttools.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
    Stop.
    
    C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild>
    

    It seems that crc32 objects are present in both libraries. Any ideas how to resolve this collision issue? Thank you.

    Christian EhrlicherC 1 Reply Last reply
    0
    • Cobra91151C Cobra91151

      I run my test project example and found out that mysqlclientMTd lib need the additional include to the Zlib lib to fix these issues:

      mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol compress referenced in function my_compress_alloc
      mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol uncompress referenced in function my_uncompress
      

      So, I added libz-static.lib lib path to this command:

      MYSQL_LIBS="-lmysqlclientMTd -lAdvapi32 -lUser32 -lCrypt32 -lGdi32 C:\\ZipDev\\zlib-win-build-1.2.13\\build-VS2022-MT\\x64\\Debug\\libz-static.lib"

      Now, it detects the MySQL library.

      MySql .................................. yes

      So, Ninja / VS 2022 compilers was not the case here.

      Cobra91151C Offline
      Cobra91151C Offline
      Cobra91151
      wrote on last edited by
      #10

      Hello!

      Great! I have successfully built Qt 5.15.9 statically. The issue is resolved.
      Thank you.

      1 Reply Last reply
      0
      • Cobra91151C Cobra91151

        Hello!

        I want to build Qt 5.15.9 statically with MySQL. I got the following error during compilation process:

        moc_fontpanel.cpp
        moc_aboutdialog.cpp
        moc_bookmarkdialog.cpp
        moc_bookmarkfiltermodel.cpp
        moc_bookmarkmanager.cpp
        moc_bookmarkmanagerwidget.cpp
        moc_bookmarkmodel.cpp
        moc_centralwidget.cpp
        moc_contentwindow.cpp
        moc_findwidget.cpp
        moc_helpdocsettingswidget.cpp
        moc_helpenginewrapper.cpp
        moc_helpviewer.cpp
        moc_helpviewer_p.cpp
        moc_indexwindow.cpp
        moc_mainwindow.cpp
        moc_preferencesdialog.cpp
        moc_qtdocinstaller.cpp
        moc_remotecontrol.cpp
        moc_searchwidget.cpp
        moc_topicchooser.cpp
        moc_openpagesmodel.cpp
        moc_globalactions.cpp
        moc_openpageswidget.cpp
        moc_openpagesmanager.cpp
        moc_openpagesswitcher.cpp
        moc_stdinlistener_win.cpp
                link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERSION:5.15 /MANIFEST:embed /OUT:..\..\..\bin\assistant.exe @C:\Users\cobra\AppData\Local\Temp\nm2E9F.tmp
        Qt5Cored.lib(crc32.obj) : error LNK2005: crc32_combine_op already defined in mysqlclientMTd.lib(crc32.c.obj)
        Qt5Cored.lib(crc32.obj) : error LNK2005: crc32_combine_gen already defined in mysqlclientMTd.lib(crc32.c.obj)
        Qt5Cored.lib(crc32.obj) : error LNK2005: crc32_combine_gen64 already defined in mysqlclientMTd.lib(crc32.c.obj)
        ..\..\..\bin\assistant.exe : fatal error LNK1169: one or more multiply defined symbols found
        NMAKE : fatal error U1077: 'link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERSION:5.15 /MANIFEST:embed /OUT:..\..\..\bin\assistant.exe @C:\Users\cobra\AppData\Local\Temp\nm2E9F.tmp' : return code '0x491'
        Stop.
        NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile.Debug' : return code '0x2'
        Stop.
        NMAKE : fatal error U1077: 'cd assistant\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\src\assistant\assistant\assistant.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
        Stop.
        NMAKE : fatal error U1077: 'cd assistant\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\src\assistant\assistant.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
        Stop.
        NMAKE : fatal error U1077: 'cd src\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\src\src.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
        Stop.
        NMAKE : fatal error U1077: 'cd qttools\ && ( if not exist Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild\qtbase\bin\qmake.exe -o Makefile C:\QtBuild\qt-everywhere-src-5.15.9\qttools\qttools.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\nmake.exe" -f Makefile' : return code '0x2'
        Stop.
        
        C:\QtBuild\qt-everywhere-src-5.15.9\qtBuild>
        

        It seems that crc32 objects are present in both libraries. Any ideas how to resolve this collision issue? Thank you.

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Rename them in one of the libraries or make them static (if possible) so they're not visible outside.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Cobra91151C 3 Replies Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          Rename them in one of the libraries or make them static (if possible) so they're not visible outside.

          Cobra91151C Offline
          Cobra91151C Offline
          Cobra91151
          wrote on last edited by
          #3

          @Christian-Ehrlicher

          Using lib /list command I have found this crc32.c.obj exists in mysqlclientMTd.lib, but it comes fromzlib library.

          ...
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\zutil.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\uncompr.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\trees.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\inffast.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\inftrees.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\infback.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\inflate.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\gzwrite.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\gzread.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\gzlib.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\gzclose.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\deflate.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\crc32.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\compress.c.obj
          extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\adler32.c.obj
          mysys_ssl\CMakeFiles\mysys_ssl.dir\my_aes_openssl.cc.obj
          mysys_ssl\CMakeFiles\mysys_ssl.dir\my_murmur3.cc.obj
          mysys_ssl\CMakeFiles\mysys_ssl.dir\my_rnd.cc.obj
          mysys_ssl\CMakeFiles\mysys_ssl.dir\my_md5.cc.obj
          ...
          

          What do you meant by rename them? Thanks.

          1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            Rename them in one of the libraries or make them static (if possible) so they're not visible outside.

            Cobra91151C Offline
            Cobra91151C Offline
            Cobra91151
            wrote on last edited by
            #4

            @Christian-Ehrlicher

            I found the similar issue: https://bugreports.qt.io/browse/QTBUG-104728?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aworklog-tabpanel

            I think, zlib version which uses Qt is different from zlib version which MySQL library uses. So, in order to fix it I must use the same version for both libraries.

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              Rename them in one of the libraries or make them static (if possible) so they're not visible outside.

              Cobra91151C Offline
              Cobra91151C Offline
              Cobra91151
              wrote on last edited by
              #5

              @Christian-Ehrlicher

              I have found a solution to remove the object from library: lib /remove:"extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\crc32.c.obj" mysqlclientMTd.lib (https://learn.microsoft.com/en-us/cpp/build/reference/managing-a-library?view=msvc-170). I think, this could help.

              I am still curious how to rename those objects in the library? What commands/programs you use to rename them? Thanks.

              Christian EhrlicherC 1 Reply Last reply
              0
              • Cobra91151C Cobra91151

                @Christian-Ehrlicher

                I have found a solution to remove the object from library: lib /remove:"extra\zlib\zlib-1.2.12\CMakeFiles\zlib.dir\crc32.c.obj" mysqlclientMTd.lib (https://learn.microsoft.com/en-us/cpp/build/reference/managing-a-library?view=msvc-170). I think, this could help.

                I am still curious how to rename those objects in the library? What commands/programs you use to rename them? Thanks.

                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @Cobra91151 said in Qt 5.15.9 static compilation issue:

                I am still curious how to rename those objects in the library? What commands/programs you use to rename them? Thanks.

                I talked about functions, not generated object files.
                And yes it's correct - you must not mix different version of one library :)

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                Cobra91151C 2 Replies Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  @Cobra91151 said in Qt 5.15.9 static compilation issue:

                  I am still curious how to rename those objects in the library? What commands/programs you use to rename them? Thanks.

                  I talked about functions, not generated object files.
                  And yes it's correct - you must not mix different version of one library :)

                  Cobra91151C Offline
                  Cobra91151C Offline
                  Cobra91151
                  wrote on last edited by Cobra91151
                  #7

                  @Christian-Ehrlicher

                  What commands should I provide to Qt so it use my zlib library during compilation?
                  I added the following commands -system-zlib ZLIB_INCDIR="C:\\ZipDev\\zlib-win-build-1.2.13" ZLIB_LIBDIR="C:\\ZipDev\\zlib-win-build-1.2.13\\build-VS2022-MT\\x64\\Debug\\libz-static.lib" to configure. Also I tried to add it to the PATH but it still can not find this library by configure script.

                  config.log

                  looking for library zlib
                  Trying source 0 (type inline) of library zlib ...
                  zlib.h not found in [] and global paths.
                    => source produced no result.
                  Trying source 1 (type inline) of library zlib ...
                  zlib.h not found in [] and global paths.
                    => source produced no result.
                  Trying source 2 (type inline) of library zlib ...
                    => source failed condition '!config.msvc'.
                  Trying source 3 (type inline) of library zlib ...
                    => source failed condition 'config.wasm'.
                  test config.qtbase.libraries.zlib FAILED
                  

                  Using system zlib ...................... no

                  Any ideas? Thanks.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    @Cobra91151 said in Qt 5.15.9 static compilation issue:

                    I am still curious how to rename those objects in the library? What commands/programs you use to rename them? Thanks.

                    I talked about functions, not generated object files.
                    And yes it's correct - you must not mix different version of one library :)

                    Cobra91151C Offline
                    Cobra91151C Offline
                    Cobra91151
                    wrote on last edited by Cobra91151
                    #8

                    @Christian-Ehrlicher

                    Hello!

                    So, I have found the correct commands to add Zlib to Qt configure script.

                    -system-zlib ZLIB_INCDIR="C:\\ZipDev\\zlib-win-build-1.2.13" ZLIB_LIBDIR="C:\\ZipDev\\zlib-win-build-1.2.13\\build-VS2022-MT\\x64\\Debug" ZLIB_LIBS="libz-static.lib"

                    Now, it detects my Zlib library.

                    Using system zlib ...................... yes

                    I am still facing the next issue:

                    mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol compress referenced in function my_compress_alloc
                    mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol uncompress referenced in function my_uncompress

                    It seems that MySQL lib with my Zlib was built with errors using Ninja. I will try to build it with VS 2022.

                    Cobra91151C 1 Reply Last reply
                    0
                    • Cobra91151C Cobra91151

                      @Christian-Ehrlicher

                      Hello!

                      So, I have found the correct commands to add Zlib to Qt configure script.

                      -system-zlib ZLIB_INCDIR="C:\\ZipDev\\zlib-win-build-1.2.13" ZLIB_LIBDIR="C:\\ZipDev\\zlib-win-build-1.2.13\\build-VS2022-MT\\x64\\Debug" ZLIB_LIBS="libz-static.lib"

                      Now, it detects my Zlib library.

                      Using system zlib ...................... yes

                      I am still facing the next issue:

                      mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol compress referenced in function my_compress_alloc
                      mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol uncompress referenced in function my_uncompress

                      It seems that MySQL lib with my Zlib was built with errors using Ninja. I will try to build it with VS 2022.

                      Cobra91151C Offline
                      Cobra91151C Offline
                      Cobra91151
                      wrote on last edited by
                      #9

                      I run my test project example and found out that mysqlclientMTd lib need the additional include to the Zlib lib to fix these issues:

                      mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol compress referenced in function my_compress_alloc
                      mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol uncompress referenced in function my_uncompress
                      

                      So, I added libz-static.lib lib path to this command:

                      MYSQL_LIBS="-lmysqlclientMTd -lAdvapi32 -lUser32 -lCrypt32 -lGdi32 C:\\ZipDev\\zlib-win-build-1.2.13\\build-VS2022-MT\\x64\\Debug\\libz-static.lib"

                      Now, it detects the MySQL library.

                      MySql .................................. yes

                      So, Ninja / VS 2022 compilers was not the case here.

                      Cobra91151C 1 Reply Last reply
                      0
                      • Cobra91151C Cobra91151

                        I run my test project example and found out that mysqlclientMTd lib need the additional include to the Zlib lib to fix these issues:

                        mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol compress referenced in function my_compress_alloc
                        mysqlclientMTd.lib(my_compress.c.obj) : error LNK2019: unresolved external symbol uncompress referenced in function my_uncompress
                        

                        So, I added libz-static.lib lib path to this command:

                        MYSQL_LIBS="-lmysqlclientMTd -lAdvapi32 -lUser32 -lCrypt32 -lGdi32 C:\\ZipDev\\zlib-win-build-1.2.13\\build-VS2022-MT\\x64\\Debug\\libz-static.lib"

                        Now, it detects the MySQL library.

                        MySql .................................. yes

                        So, Ninja / VS 2022 compilers was not the case here.

                        Cobra91151C Offline
                        Cobra91151C Offline
                        Cobra91151
                        wrote on last edited by
                        #10

                        Hello!

                        Great! I have successfully built Qt 5.15.9 statically. The issue is resolved.
                        Thank you.

                        1 Reply Last reply
                        0
                        • Cobra91151C Cobra91151 has marked this topic as solved on
                        • Cobra91151C Cobra91151 has marked this topic as solved on
                        • Cobra91151C Cobra91151 has marked this topic as solved on

                        • Login

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