Qt 5.15.9 static compilation issue
-
Hello!
I want to build
Qt 5.15.9statically withMySQL. 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
crc32objects are present in both libraries. Any ideas how to resolve this collision issue? Thank you. -
I run my test project example and found out that
mysqlclientMTdlib need the additional include to theZliblib 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_uncompressSo, I added
libz-static.liblib 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
MySQLlibrary.MySql .................................. yes
So,
Ninja/VS 2022compilers was not the case here.Hello!
Great! I have successfully built
Qt 5.15.9statically. The issue is resolved.
Thank you. -
Hello!
I want to build
Qt 5.15.9statically withMySQL. 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
crc32objects are present in both libraries. Any ideas how to resolve this collision issue? Thank you.Rename them in one of the libraries or make them static (if possible) so they're not visible outside.
-
Rename them in one of the libraries or make them static (if possible) so they're not visible outside.
Using
lib /listcommand I have found thiscrc32.c.objexists inmysqlclientMTd.lib, but it comes fromzliblibrary.... 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.
-
Rename them in one of the libraries or make them static (if possible) so they're not visible outside.
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
Qtis different from zlib version whichMySQLlibrary uses. So, in order to fix it I must use the same version for both libraries. -
Rename them in one of the libraries or make them static (if possible) so they're not visible outside.
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.
-
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.
@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 :) -
@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 :)What commands should I provide to
Qtso 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 thePATHbut it still can not find this library byconfigurescript.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 FAILEDUsing system zlib ...................... no
Any ideas? Thanks.
-
@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 :)Hello!
So, I have found the correct commands to add
ZlibtoQtconfigure 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
Zliblibrary.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_uncompressIt seems that
MySQLlib with myZlibwas built with errors using Ninja. I will try to build it with VS 2022. -
Hello!
So, I have found the correct commands to add
ZlibtoQtconfigure 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
Zliblibrary.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_uncompressIt seems that
MySQLlib with myZlibwas built with errors using Ninja. I will try to build it with VS 2022.I run my test project example and found out that
mysqlclientMTdlib need the additional include to theZliblib 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_uncompressSo, I added
libz-static.liblib 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
MySQLlibrary.MySql .................................. yes
So,
Ninja/VS 2022compilers was not the case here. -
I run my test project example and found out that
mysqlclientMTdlib need the additional include to theZliblib 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_uncompressSo, I added
libz-static.liblib 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
MySQLlibrary.MySql .................................. yes
So,
Ninja/VS 2022compilers was not the case here.Hello!
Great! I have successfully built
Qt 5.15.9statically. The issue is resolved.
Thank you. -
C Cobra91151 has marked this topic as solved on
-
C Cobra91151 has marked this topic as solved on
-
C Cobra91151 has marked this topic as solved on