Qt 5.15.9 static compilation issue
-
wrote on 16 Apr 2023, 14:12 last edited by
Hello!
I want to build
Qt 5.15.9
statically 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
crc32
objects 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
mysqlclientMTd
lib need the additional include to theZlib
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.wrote on 18 Apr 2023, 11:42 last edited byHello!
Great! I have successfully built
Qt 5.15.9
statically. The issue is resolved.
Thank you. -
Hello!
I want to build
Qt 5.15.9
statically 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
crc32
objects 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.
wrote on 16 Apr 2023, 14:40 last edited byUsing
lib /list
command I have found thiscrc32.c.obj
exists inmysqlclientMTd.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.
-
Rename them in one of the libraries or make them static (if possible) so they're not visible outside.
wrote on 16 Apr 2023, 15:13 last edited byI 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 whichMySQL
library 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.
wrote on 16 Apr 2023, 15:53 last edited byI 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 :)wrote on 16 Apr 2023, 21:43 last edited by Cobra91151What 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 thePATH
but it still can not find this library byconfigure
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.
-
@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 :)wrote on 17 Apr 2023, 12:34 last edited by Cobra91151Hello!
So, I have found the correct commands to add
Zlib
toQt
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_uncompressIt seems that
MySQL
lib with myZlib
was built with errors using Ninja. I will try to build it with VS 2022. -
Hello!
So, I have found the correct commands to add
Zlib
toQt
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_uncompressIt seems that
MySQL
lib with myZlib
was built with errors using Ninja. I will try to build it with VS 2022.wrote on 17 Apr 2023, 15:10 last edited byI run my test project example and found out that
mysqlclientMTd
lib need the additional include to theZlib
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. -
I run my test project example and found out that
mysqlclientMTd
lib need the additional include to theZlib
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.wrote on 18 Apr 2023, 11:42 last edited byHello!
Great! I have successfully built
Qt 5.15.9
statically. The issue is resolved.
Thank you. -
-
-
1/10