Solved Qt static with MySQL issue
-
My issue is not solved because
Qt
for some reason doesn't build it. The question is why it can't build it properly now? -
I think that
Qt
is not compatible with the followingOpenSSL
libs:- libcrypto.lib
- libssl.lib
-
OpenSSL .1.1.X is supported since Qt 5.10.
-
Finally, I have fixed the issue.
Solution:
I built the static
OpenSSL
libs: 1.0.2l andMySQL
:5.7.23
static libs with pre-built earlyOpenSSL
libs providing the flag:-DCRYPTO_LIBRARY="path to lib\libeay32MD.lib"
to thecmake
, becauselibeay32
corresponds tolibcrypto
.I reconfigured the
Qt
statically with these static libs. Now it works forx86
andx64
and these libs are embedded into the executable. The issue is resolved. -
@Cobra91151
could you send a copy static libs(mysqlclient.lib \qsqlmysql.lib build with vs2017 MT)?
Or give me a details of build it and qsqlmysql.lib with vs2017 on windows10, i want to build it by QT5.12 .
Many thanks for your help!
jeff -
@Cobra91151
I used below configureconfigure -confirm-license -opensource -release -static -static-runtime -mp -platform win32-msvc -prefix "D:\QT\512M" -sql-mysql MYSQL_PREFIX="C:/mysql" MYSQL_LIBS="-lmysqlclient" -gui -no-dbus -widgets -qt-zlib -qt-libjpeg -gif -ico -qt-libpng -qt-xkbcommon -qt-freetype -qt-pcre -qt-harfbuzz -opengl desktop -nomake tests -nomake examples -no-compile-examples -skip qttranslations -skip qtserialport -skip qtwebengine -recheck-all
and got
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.in config.log found below information about mysql:
cd /d C:\Qt\Qt5.12.0\5.12.0\Src\config.tests\mysql && C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = -LC:/mysql/lib -lmysqlclient" "QMAKE_INCDIR_MYSQL = C:/mysql/include" C:/Qt/Qt5.12.0/5.12.0/Src/config.tests/mysql
-
cd /d C:\Qt\Qt5.12.0\5.12.0\Src\config.tests\mysql && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MT -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -I. -IC:\mysql\include -IC:\Qt\Qt5.12.0\5.12.0\Src\qtbase\mkspecs\win32-msvc -Fo @C:\Users\jeff\AppData\Local\Temp\nmAAE6.tmp
main.cpp
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:mysql.exe @C:\Users\jeff\AppData\Local\Temp\nmACDB.tmp
LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
mysqlclient.lib(bchange.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(ctype-tis620.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(net_serv.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(client.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(mf_pack.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(mf_dirname.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(libmysql.obj) : warning LNK4217: 本地定义的符号 memmove 在函数 fetch_float_with_conversion 中导入
mysqlclient.lib(mf_format.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(my_time.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(my_vsnprintf.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(ssl.obj) : warning LNK4049: 已导入本地定义的符号 __stdio_common_vsprintf
mysqlclient.lib(xml.obj) : warning LNK4049: 已导入本地定义的符号 __stdio_common_vsprintf
mysqlclient.lib(libmysql.obj) : warning LNK4217: 本地定义的符号 __stdio_common_vsprintf 在函数 sprintf 中导入
mysqlclient.lib(my_time.obj) : warning LNK4049: 已导入本地定义的符号 __stdio_common_vsprintf
mysqlclient.lib(client.obj) : warning LNK4049: 已导入本地定义的符号 __stdio_common_vsprintf
mysqlclient.lib(ctype.obj) : warning LNK4217: 本地定义的符号 __stdio_common_vsprintf 在函数 cs_leave 中导入
mysqlclient.lib(libmysql.obj) : warning LNK4217: 本地定义的符号 atoi 在函数 mysql_server_init 中导入
mysqlclient.lib(client.obj) : warning LNK4049: 已导入本地定义的符号 atoi
mysqlclient.lib(typelib.obj) : warning LNK4049: 已导入本地定义的符号 atoi
mysqlclient.lib(handshake_client.obj) : warning LNK4049: 已导入本地定义的符号 atoi
mysqlclient.lib(my_thr_init.obj) : warning LNK4217: 本地定义的符号 _set_abort_behavior 在函数 my_thread_init 中导入
mysqlclient.lib(my_thr_init.obj) : warning LNK4217: 本地定义的符号 signal 在函数 my_thread_init 中导入
mysqlclient.lib(my_fstream.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(crypt_genhash_impl.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(my_fopen.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_win_freopen 中导入
mysqlclient.lib(my_thread.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_thread_create 中导入
mysqlclient.lib(my_lib.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_dir 中导入
mysqlclient.lib(my_access.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(my_winerr.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(my_winfile.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(my_once.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_once_alloc 中导入
mysqlclient.lib(str2int.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(my_getwd.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_getwd 中导入
mysqlclient.lib(my_malloc.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_raw_malloc 中导入
mysqlclient.lib(my_open.obj) : warning LNK4217: 本地定义的符号 _errno 在函数 my_close 中导入
mysqlclient.lib(my_read.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(client.obj) : warning LNK4049: 已导入本地定义的符号 _errno
mysqlclient.lib(my_malloc.obj) : warning LNK4217: 本地定义的符号 calloc 在函数 my_raw_malloc 中导入
mysqlclient.lib(zutil.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(yassl_int.obj) : warning LNK4217: 本地定义的符号 free 在函数 "public: void __cdecl yaSSL::SSL::makeTLSMasterSecret(void)" (?makeTLSMasterSecret@SSL@yaSSL@@QEAAXXZ) 中导入
mysqlclient.lib(handshake_client.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(str_alloc.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(common.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(my_malloc.obj) : warning LNK4217: 本地定义的符号 free 在函数 my_free 中导入
mysqlclient.lib(dtoa.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(my_once.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(my_thread.obj) : warning LNK4049: 已导入本地定义的符号 free
mysqlclient.lib(ssl.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(str_alloc.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(common.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(zutil.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(my_malloc.obj) : warning LNK4217: 本地定义的符号 malloc 在函数 my_raw_malloc 中导入
mysqlclient.lib(dtoa.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(my_once.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(my_thread.obj) : warning LNK4049: 已导入本地定义的符号 malloc
mysqlclient.lib(str_alloc.obj) : warning LNK4049: 已导入本地定义的符号 exit
mysqlclient.lib(my_malloc.obj) : warning LNK4217: 本地定义的符号 exit 在函数 my_raw_malloc 中导入
mysqlclient.lib(client.obj) : warning LNK4049: 已导入本地定义的符号 exit
mysqlclient.lib(typelib.obj) : warning LNK4049: 已导入本地定义的符号 exit
mysqlclient.lib(my_default.obj) : warning LNK4049: 已导入本地定义的符号 exit
mysqlclient.lib(my_default.obj) : warning LNK4049: 已导入本地定义的符号 __acrt_iob_func
mysqlclient.lib(log_client.obj) : warning LNK4049: 已导入本地定义的符号 __acrt_iob_func
mysqlclient.lib(my_init.obj) : warning LNK4217: 本地定义的符号 __acrt_iob_func 在函数 my_end 中导入
mysqlclient.lib(my_winfile.obj) : warning LNK4049: 已导入本地定义的符号 __acrt_iob_func
mysqlclient.lib(my_mess.obj) : warning LNK4049: 已导入本地定义的符号 __acrt_iob_func
mysqlclient.lib(typelib.obj) : warning LNK4217: 本地定义的符号 __acrt_iob_func 在函数 find_type_or_exit 中导入
mysqlclient.lib(my_init.obj) : warning LNK4217: 本地定义的符号 _set_invalid_parameter_handler 在函数 my_init 中导入
mysqlclient.lib(crypt_genhash_impl.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(ctype.obj) : warning LNK4217: 本地定义的符号 strchr 在函数 cs_file_sec 中导入
mysqlclient.lib(my_default.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(my_access.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(xml.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(mf_format.obj) : warning LNK4217: 本地定义的符号 strchr 在函数 fn_format 中导入
mysqlclient.lib(client_plugin.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(my_winfile.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(my_getwd.obj) : warning LNK4049: 已导入本地定义的符号 strchr
mysqlclient.lib(charset.obj) : warning LNK4217: 本地定义的符号 _strnicmp 在函数 get_collation_number 中导入
mysqlclient.lib(ctype-uca.obj) : warning LNK4049: 已导入本地定义的符号 _strnicmp
mysqlclient.lib(handshake_client.obj) : warning LNK4049: 已导入本地定义的符号 _strnicmp
mysqlclient.lib(my_vsnprintf.obj) : warning LNK4217: 本地定义的符号 strnlen 在函数 process_str_arg 中导入
mysqlclient.lib(yassl_int.obj) : warning LNK4049: 已导入本地定义的符号 strncmp
mysqlclient.lib(crypt_genhash_impl.obj) : warning LNK4049: 已导入本地定义的符号 strncmp
mysqlclient.lib(handshake.obj) : warning LNK4049: 已导入本地定义的符号 strncmp
mysqlclient.lib(crypto_wrapper.obj) : warning LNK4217: 本地定义的符号 strncmp 在函数 "unsigned char * __cdecl TaoCrypt::StdReallocate<unsigned char,class TaoCrypt::AllocatorWithCleanup<unsigned char> >(class TaoCrypt::AllocatorWithCleanup<unsigned char> &,unsigned char *,unsigned __int64,unsigned __int64,bool)" (??$StdReallocate@EV?$AllocatorWithCleanup@E@TaoCrypt@@@TaoCrypt@@YAPEAEAEAV?$AllocatorWithCleanup@E@0@PEAE_K2_N@Z) 中导入
mysqlclient.lib(client.obj) : warning LNK4217: 本地定义的符号 strncmp 在函数 read_ok_ex 中导入
mysqlclient.lib(ctype.obj) : warning LNK4217: 本地定义的符号 strncmp 在函数 cs_value 中导入
mysqlclient.lib(my_default.obj) : warning LNK4049: 已导入本地定义的符号 strncmp
mysqlclient.lib(ssl.obj) : warning LNK4049: 已导入本地定义的符号 strncmp
mysqlclient.lib(client.obj) : warning LNK4217: 本地定义的符号 strtoul 在函数 mysql_get_server_version 中导入
mysqlclient.lib(ctype.obj) : warning LNK4049: 已导入本地定义的符号 strtoul
mysqlclient.lib(my_winfile.obj) : warning LNK4217: 本地定义的符号 _close 在函数 my_win_fstat 中导入
mysqlclient.lib(my_fopen.obj) : warning LNK4049: 已导入本地定义的符号 _close
mysqlclient.lib(my_winfile.obj) : warning LNK4217: 本地定义的符号 _get_osfhandle 在函数 my_win_fileno 中导入
mysqlclient.lib(my_winfile.obj) : warning LNK4217: 本地定义的符号 _open_osfhandle 在函数 my_win_fdopen 中导入
mysqlclient.lib(my_fopen.obj) : warning LNK4049: 已导入本地定义的符号 _open_osfhandle
mysqlclient.lib(my_winfile.obj) : warning LNK4217: 本地定义的符号 fclose 在函数 my_win_fclose 中导入
mysqlclient.lib(ssl.obj) : warning LNK4049: 已导入本地定义的符号 fclose
mysqlclient.lib(file.obj) : warning LNK4049: 已导入本地定义的符号 fclose
mysqlclient.lib(my_mess.obj) : warning LNK4217: 本地定义的符号 strrchr 在函数 my_message_stderr 中导入
mysqlclient.lib(mf_pack.obj) : warning LNK4049: 已导入本地定义的符号 strrchr
mysqlclient.lib(mf_dirname.obj) : warning LNK4217: 本地定义的符号 strrchr 在函数 convert_dirname 中导入
mysqlclient.lib(mf_fn_ext.obj) : warning LNK4049: 已导入本地定义的符号 strrchr
mysqlclient.lib(my_mess.obj) : warning LNK4217: 本地定义的符号 fflush 在函数 my_message_stderr 中导入
mysqlclient.lib(log_client.obj) : warning LNK4049: 已导入本地定义的符号 fflush
mysqlclient.lib(my_mess.obj) : warning LNK4217: 本地定义的符号 fputc 在函数 my_message_stderr 中导入
mysqlclient.lib(my_default.obj) : warning LNK4049: 已导入本地定义的符号 fputc
mysqlclient.lib(log_client.obj) : warning LNK4049: 已导入本地定义的符号 fputc
mysqlclient.lib(my_mess.obj) : warning LNK4217: 本地定义的符号 __stdio_common_vfprintf 在函数 fprintf 中导入
mysqlclient.lib(typelib.obj) : warning LNK4217: 本地定义的符号 __stdio_common_vfprintf 在函数 find_set_from_flags 中导入
mysqlclient.lib(my_default.obj) : warning LNK4049: 已导入本地定义的符号 __stdio_common_vfprintf
mysqlclient.lib(log_client.obj) : warning LNK4217: 本地定义的符号 __stdio_common_vfprintf 在函数 "void __cdecl error_log_vprint(enum error_log_level::type,char const *,char *)" (?error_log_vprint@@YAXW4type@error_log_level@@PEBDPEAD@Z) 中导入
mysqlclient.lib(ctype.obj) : warning LNK4217: 本地定义的符号 strtol 在函数 cs_value 中导入
mysqlclient.lib(viosocket.obj) : warning LNK4049: 已导入本地定义的符号 strtol
mysqlclient.lib(crypt_genhash_impl.obj) : warning LNK4049: 已导入本地定义的符号 strtol
mysqlclient.lib(ctype-simple.obj) : warning LNK4217: 本地定义的符号 qsort 在函数 create_fromuni 中导入
mysqlclient.lib(my_access.obj) : warning LNK4217: 本地定义的符号 toupper 在函数 check_if_legal_filename 中导入
mysqlclient.lib(my_fopen.obj) : warning LNK4217: 本地定义的符号 _fileno 在函数 my_win_freopen 中导入
OLDNAMES.lib(fileno.obi) : warning LNK4049: 已导入本地定义的符号 _fileno
mysqlclient.lib(get_password.obj) : warning LNK4217: 本地定义的符号 isspace 在函数 yassl_mysql_get_tty_password_ext 中导入
mysqlclient.lib(get_password.obj) : warning LNK4217: 本地定义的符号 iscntrl 在函数 yassl_mysql_get_tty_password_ext 中导入
mysqlclient.lib(my_default.obj) : error LNK2001: 无法解析的外部符号 __imp_getenv
mysqlclient.lib(handshake_client.obj) : error LNK2001: 无法解析的外部符号 __imp_getenv
mysqlclient.lib(libmysql.obj) : error LNK2001: 无法解析的外部符号 __imp_getenv
mysqlclient.lib(my_init.obj) : error LNK2001: 无法解析的外部符号 __imp_getenv
mysqlclient.lib(client.obj) : error LNK2001: 无法解析的外部符号 __imp_getenv
mysqlclient.lib(client_plugin.obj) : error LNK2001: 无法解析的外部符号 __imp_getenv
mysqlclient.lib(my_malloc.obj) : error LNK2019: 无法解析的外部符号 __imp_realloc,该符号在函数 my_raw_realloc 中被引用
mysqlclient.lib(str_alloc.obj) : error LNK2001: 无法解析的外部符号 __imp_realloc
mysqlclient.lib(my_error.obj) : error LNK2019: 无法解析的外部符号 __imp_strcat_s,该符号在函数 my_strerror 中被引用
mysqlclient.lib(my_error.obj) : error LNK2019: 无法解析的外部符号 __imp_strerror_s,该符号在函数 my_strerror 中被引用
mysqlclient.lib(my_init.obj) : error LNK2019: 无法解析的外部符号 __imp_strdup,该符号在函数 win_init_registry 中被引用
mysqlclient.lib(yassl_int.obj) : error LNK2001: 无法解析的外部符号 __imp_strdup
OLDNAMES.lib(strdup.obi) : error LNK2001: 无法解析的外部符号 __imp_strdup
mysqlclient.lib(my_init.obj) : error LNK2019: 无法解析的外部符号 __imp_RegCloseKey,该符号在函数 win32_have_tcpip 中被引用
mysqlclient.lib(my_init.obj) : error LNK2019: 无法解析的外部符号 __imp_RegEnumValueA,该符号在函数 win_init_registry 中被引用
mysqlclient.lib(my_init.obj) : error LNK2019: 无法解析的外部符号 __imp_RegOpenKeyExA,该符号在函数 win32_have_tcpip 中被引用
mysqlclient.lib(my_init.obj) : error LNK2019: 无法解析的外部符号 __imp_putenv,该符号在函数 win_init_registry 中被引用
OLDNAMES.lib(putenv.obi) : error LNK2001: 无法解析的外部符号 __imp_putenv
mysqlclient.lib(my_init.obj) : error LNK2019: 无法解析的外部符号 __imp__tzset,该符号在函数 my_init 中被引用
mysqlclient.lib(my_time.obj) : error LNK2019: 无法解析的外部符号 __imp__localtime64_s,该符号在函数 my_init_time 中被引用
mysqlclient.lib(my_time.obj) : error LNK2019: 无法解析的外部符号 __imp__time64,该符号在函数 my_init_time 中被引用
mysqlclient.lib(asn.obj) : error LNK2001: 无法解析的外部符号 __imp__time64
mysqlclient.lib(dtoa.obj) : error LNK2019: 无法解析的外部符号 __imp___fpe_flt_rounds,该符号在函数 my_strtod_int 中被引用
mysqlclient.lib(int2str.obj) : error LNK2019: 无法解析的外部符号 __imp_ldiv,该符号在函数 int2str 中被引用
mysqlclient.lib(my_winfile.obj) : error LNK2019: 无法解析的外部符号 __imp__umask,该符号在函数 my_win_sopen 中被引用
mysqlclient.lib(my_winfile.obj) : error LNK2019: 无法解析的外部符号 __imp_fopen,该符号在函数 my_win_fopen 中被引用
mysqlclient.lib(ssl.obj) : error LNK2001: 无法解析的外部符号 __imp_fopen
mysqlclient.lib(file.obj) : error LNK2001: 无法解析的外部符号 __imp_fopen
mysqlclient.lib(my_winfile.obj) : error LNK2019: 无法解析的外部符号 __imp_fdopen,该符号在函数 my_win_fdopen 中被引用
OLDNAMES.lib(fdopen.obi) : error LNK2001: 无法解析的外部符号 __imp_fdopen
mysqlclient.lib(my_winfile.obj) : error LNK2019: 无法解析的外部符号 __imp_fileno,该符号在函数 my_win_fileno 中被引用
OLDNAMES.lib(fileno.obi) : error LNK2001: 无法解析的外部符号 __imp_fileno
mysqlclient.lib(my_winfile.obj) : error LNK2019: 无法解析的外部符号 __imp__fstat64,该符号在函数 my_win_fstat 中被引用
mysqlclient.lib(my_winfile.obj) : error LNK2019: 无法解析的外部符号 __imp__stat64,该符号在函数 my_win_stat 中被引用
mysqlclient.lib(my_mess.obj) : error LNK2019: 无法解析的外部符号 __imp_fputs,该符号在函数 my_message_stderr 中被引用
mysqlclient.lib(my_default.obj) : error LNK2001: 无法解析的外部符号 __imp_fputs
mysqlclient.lib(my_getwd.obj) : error LNK2019: 无法解析的外部符号 __imp_getcwd,该符号在函数 my_getwd 中被引用
OLDNAMES.lib(getcwd.obi) : error LNK2001: 无法解析的外部符号 __imp_getcwd
mysqlclient.lib(my_getwd.obj) : error LNK2019: 无法解析的外部符号 __imp_chdir,该符号在函数 my_setwd 中被引用
OLDNAMES.lib(chdir.obi) : error LNK2001: 无法解析的外部符号 __imp_chdir
mysqlclient.lib(my_thread.obj) : error LNK2019: 无法解析的外部符号 __imp__beginthreadex,该符号在函数 my_thread_create 中被引用
mysqlclient.lib(my_thread.obj) : error LNK2019: 无法解析的外部符号 __imp__endthreadex,该符号在函数 my_thread_exit 中被引用
mysqlclient.lib(my_lib.obj) : error LNK2019: 无法解析的外部符号 __imp__findclose,该符号在函数 my_dir 中被引用
mysqlclient.lib(my_lib.obj) : error LNK2019: 无法解析的外部符号 __imp__findfirst64i32,该符号在函数 my_dir 中被引用
mysqlclient.lib(my_lib.obj) : error LNK2019: 无法解析的外部符号 __imp__findnext64i32,该符号在函数 my_dir 中被引用
mysqlclient.lib(my_default.obj) : error LNK2019: 无法解析的外部符号 __imp_stricmp,该符号在函数 "char const * * __cdecl init_default_directories(struct st_mem_root *)" (?init_default_directories@@YAPEAPEBDPEAUst_mem_root@@@Z) 中被引用
OLDNAMES.lib(stricmp.obi) : error LNK2001: 无法解析的外部符号 __imp_stricmp
mysqlclient.lib(my_default.obj) : error LNK2019: 无法解析的外部符号 __imp_fgets,该符号在函数 "char __cdecl mysql_file_getline(char *,int,struct st_mysql_file *,char)" (?mysql_file_getline@@YADPEADHPEAUst_mysql_file@@D@Z) 中被引用
mysqlclient.lib(crypto_wrapper.obj) : error LNK2001: 无法解析的外部符号 __imp_fgets
mysqlclient.lib(my_default.obj) : error LNK2019: 无法解析的外部符号 __imp_puts,该符号在函数 my_load_defaults 中被引用
mysqlclient.lib(ssl.obj) : error LNK2019: 无法解析的外部符号 __imp_feof,该符号在函数 "int __cdecl yaSSL::read_file(class yaSSL::SSL_CTX *,char const *,int,enum yaSSL::CertType)" (?read_file@yaSSL@@YAHPEAVSSL_CTX@1@PEBDHW4CertType@1@@Z) 中被引用
mysqlclient.lib(ssl.obj) : error LNK2019: 无法解析的外部符号 __imp_fread,该符号在函数 "int __cdecl yaSSL::read_file(class yaSSL::SSL_CTX *,char const *,int,enum yaSSL::CertType)" (?read_file@yaSSL@@YAHPEAVSSL_CTX@1@PEBDHW4CertType@1@@Z) 中被引用
mysqlclient.lib(my_fstream.obj) : error LNK2001: 无法解析的外部符号 __imp_fread
mysqlclient.lib(crypto_wrapper.obj) : error LNK2001: 无法解析的外部符号 __imp_fread
mysqlclient.lib(file.obj) : error LNK2001: 无法解析的外部符号 __imp_fread
mysqlclient.lib(ssl.obj) : error LNK2019: 无法解析的外部符号 __imp_fseek,该符号在函数 "int __cdecl yaSSL::read_file(class yaSSL::SSL_CTX *,char const *,int,enum yaSSL::CertType)" (?read_file@yaSSL@@YAHPEAVSSL_CTX@1@PEBDHW4CertType@1@@Z) 中被引用
mysqlclient.lib(my_fstream.obj) : error LNK2001: 无法解析的外部符号 __imp_fseek
mysqlclient.lib(crypto_wrapper.obj) : error LNK2001: 无法解析的外部符号 __imp_fseek
mysqlclient.lib(file.obj) : error LNK2001: 无法解析的外部符号 __imp_fseek
mysqlclient.lib(ssl.obj) : error LNK2019: 无法解析的外部符号 __imp_ftell,该符号在函数 "int __cdecl yaSSL::read_file(class yaSSL::SSL_CTX *,char const *,int,enum yaSSL::CertType)" (?read_file@yaSSL@@YAHPEAVSSL_CTX@1@PEBDHW4CertType@1@@Z) 中被引用
mysqlclient.lib(my_fstream.obj) : error LNK2001: 无法解析的外部符号 __imp_ftell
mysqlclient.lib(crypto_wrapper.obj) : error LNK2001: 无法解析的外部符号 __imp_ftell
mysqlclient.lib(file.obj) : error LNK2001: 无法解析的外部符号 __imp_ftell
mysqlclient.lib(ssl.obj) : error LNK2019: 无法解析的外部符号 __imp_rewind,该符号在函数 "int __cdecl yaSSL::read_file(class yaSSL::SSL_CTX *,char const *,int,enum yaSSL::CertType)" (?read_file@yaSSL@@YAHPEAVSSL_CTX@1@PEBDHW4CertType@1@@Z) 中被引用
mysqlclient.lib(ssl.obj) : error LNK2019: 无法解析的外部符号 __imp_strncat,该符号在函数 yaSSL_CTX_load_verify_locations 中被引用
mysqlclient.lib(mf_loadpath.obj) : error LNK2001: 无法解析的外部符号 __imp_strncat
mysqlclient.lib(crypt_genhash_impl.obj) : error LNK2001: 无法解析的外部符号 __imp_strncat
mysqlclient.lib(yassl_error.obj) : error LNK2001: 无法解析的外部符号 __imp_strncpy
mysqlclient.lib(crypto_wrapper.obj) : error LNK2001: 无法解析的外部符号 __imp_strncpy
mysqlclient.lib(ssl.obj) : error LNK2001: 无法解析的外部符号 __imp_strncpy
mysqlclient.lib(viosslfactories.obj) : error LNK2001: 无法解析的外部符号 __imp_strncpy
mysqlclient.lib(yassl_int.obj) : error LNK2001: 无法解析的外部符号 __imp_strncpy
mysqlclient.lib(yassl_imp.obj) : error LNK2001: 无法解析的外部符号 __imp_strncpy
mysqlclient.lib(viosslfactories.obj) : error LNK2019: 无法解析的外部符号 __imp_strtok_s,该符号在函数 process_tls_version 中被引用
mysqlclient.lib(yassl_int.obj) : error LNK2019: 无法解析的外部符号 __imp_strstr,该符号在函数 "public: bool __cdecl yaSSL::SSL_CTX::SetCipherList(char const *)" (?SetCipherList@SSL_CTX@yaSSL@@QEAA_NPEBD@Z) 中被引用
mysqlclient.lib(crypt_genhash_impl.obj) : error LNK2001: 无法解析的外部符号 __imp_strstr
mysqlclient.lib(crypto_wrapper.obj) : error LNK2001: 无法解析的外部符号 __imp_strstr
mysqlclient.lib(my_fstream.obj) : error LNK2019: 无法解析的外部符号 __imp_ferror,该符号在函数 my_fread 中被引用
mysqlclient.lib(my_fstream.obj) : error LNK2019: 无法解析的外部符号 __imp_fwrite,该符号在函数 my_fwrite 中被引用
mysqlclient.lib(file.obj) : error LNK2001: 无法解析的外部符号 __imp_fwrite
mysqlclient.lib(crypt_genhash_impl.obj) : error LNK2019: 无法解析的外部符号 __imp_strcspn,该符号在函数 my_crypt_genhash 中被引用
mysqlclient.lib(my_fopen.obj) : error LNK2019: 无法解析的外部符号 __imp__dup2,该符号在函数 my_win_freopen 中被引用
mysqlclient.lib(my_fopen.obj) : error LNK2019: 无法解析的外部符号 __imp_freopen,该符号在函数 my_win_freopen 中被引用
mysqlclient.lib(asn.obj) : error LNK2019: 无法解析的外部符号 __imp__gmtime64,该符号在函数 "bool __cdecl TaoCrypt::`anonymous namespace'::ValidateDate(unsigned char const *,unsigned char,enum TaoCrypt::CertDecoder::DateType)" (?ValidateDate@?A0x4ae3e225@TaoCrypt@@YA_NPEBEEW4DateType@CertDecoder@2@@Z) 中被引用
mysqlclient.lib(get_password.obj) : error LNK2019: 无法解析的外部符号 __imp__cputs,该符号在函数 yassl_mysql_get_tty_password_ext 中被引用
mysqlclient.lib(get_password.obj) : error LNK2019: 无法解析的外部符号 __imp__getch,该符号在函数 yassl_mysql_get_tty_password_ext 中被引用
mysqlclient.lib(common.obj) : error LNK2019: 无法解析的外部符号 __imp_EqualSid,该符号在函数 "public: bool __cdecl Sid::operator==(class Sid const &)" (??8Sid@@QEAA_NAEBV0@@Z) 中被引用
mysqlclient.lib(common.obj) : error LNK2019: 无法解析的外部符号 __imp_GetTokenInformation,该符号在函数 "public: __cdecl Sid::Sid(void *)" (??0Sid@@QEAA@PEAX@Z) 中被引用
mysqlclient.lib(common.obj) : error LNK2019: 无法解析的外部符号 __imp_IsValidSid,该符号在函数 "public: __cdecl Sid::Sid(void *)" (??0Sid@@QEAA@PEAX@Z) 中被引用
mysqlclient.lib(common.obj) : error LNK2019: 无法解析的外部符号 __imp_LookupAccountNameW,该符号在函数 "public: __cdecl Sid::Sid(wchar_t const *)" (??0Sid@@QEAA@PEB_W@Z) 中被引用
mysqlclient.lib(random.obj) : error LNK2019: 无法解析的外部符号 __imp_CryptAcquireContextA,该符号在函数 "public: __cdecl TaoCrypt::OS_Seed::OS_Seed(void)" (??0OS_Seed@TaoCrypt@@QEAA@XZ) 中被引用
mysqlclient.lib(random.obj) : error LNK2019: 无法解析的外部符号 __imp_CryptReleaseContext,该符号在函数 "public: __cdecl TaoCrypt::OS_Seed::~OS_Seed(void)" (??1OS_Seed@TaoCrypt@@QEAA@XZ) 中被引用
mysqlclient.lib(random.obj) : error LNK2019: 无法解析的外部符号 __imp_CryptGenRandom,该符号在函数 "public: __cdecl TaoCrypt::RandomNumberGenerator::RandomNumberGenerator(void)" (??0RandomNumberGenerator@TaoCrypt@@QEAA@XZ) 中被引用
OLDNAMES.lib(strdup.obi) : error LNK2001: 无法解析的外部符号 __imp__strdup
OLDNAMES.lib(putenv.obi) : error LNK2001: 无法解析的外部符号 __imp__putenv
OLDNAMES.lib(fdopen.obi) : error LNK2001: 无法解析的外部符号 __imp__fdopen
OLDNAMES.lib(getcwd.obi) : error LNK2001: 无法解析的外部符号 __imp__getcwd
OLDNAMES.lib(chdir.obi) : error LNK2001: 无法解析的外部符号 __imp__chdir
OLDNAMES.lib(stricmp.obi) : error LNK2001: 无法解析的外部符号 __imp__stricmp
mysql.exe : fatal error LNK1120: 61 个无法解析的外部命令 -
-
Hi! Try to include to configure:
MYSQL_LIBS="-lmysqlclientMT -lAdvapi32 -lUser32 -lCrypt32 -lGdi32"
and also create a simpleMySQL
test project inVS 2017
, for example console app to verify that it works:#include <iostream> #include <mysql.h> #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/err.h> using namespace std; int main() { cout << "Hello World!" << endl; cout << "Hello!" << endl; SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); printf("MySQL client version: %s\n", mysql_get_client_info()); system("PAUSE"); return 0; }
If you still need help, reply here or in chat and I will try to help.
-
@Cobra91151 said in Qt static with MySQL issue:
MT -lAdvapi32 -lUser32 -lCrypt32 -lGdi32
Many thanks for your instruction . As per your instruction i use below configure
configure -confirm-license -opensource -release -static -static-runtime -mp -platform win32-msvc -prefix "D:\QT\512M" -sql-mysql MYSQL_PREFIX="C:/mysql" MYSQL_LIBS="-lmysqlclient MT -lAdvapi32 -lUser32 -lCrypt32 -lGdi32" -gui -no-dbus -widgets -qt-zlib -qt-libjpeg -gif -ico -qt-libpng -qt-xkbcommon -qt-freetype -qt-pcre -qt-harfbuzz -opengl desktop -nomake tests -nomake examples -no-compile-examples -skip qttranslations -skip qtserialport -skip qtwebengine -recheck-all
check the config.log
there are no the error like below
LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
mysqlclient.lib(bchange.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(ctype-tis620.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(net_serv.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(client.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(mf_pack.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(mf_dirname.obj) : warning LNK4049: 已导入本地定义的符号 memmove
mysqlclient.lib(libmysql.obj) : warning LNK4217: 本地定义的符号 memmove 在函数 fetch_float_with_conversion 中导入
mysqlclient.lib(mf_format.obj) : warning LNK4049: 已导入本地定义的符号 memmove"these error in config.log file were gone.
now only 1 error show after configure comandline
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
anther question :
There is not blank before MT in your list command ?
Try to include to configure: MYSQL_LIBS="-lmysqlclientMT-lAdvapi32 -lUser32 -lCrypt32 -lGdi32" and also create a simple MySQL test project in VS 2017, for example console app to verify that it works: -
@Cobra91151
Cloud you give me a copy of mysqlclient.lib qsqlmysql.lib qsqlmysql.prl build by youself with vs2017 x64? my email tigerlfj@126.com
i think the mysqlclient.lib download from web is not for vs2017.
bast regards,
jeff -
Hi! I use
Qt 5.9.7
andOpenSSL libs: 1.0.2l
andMySQL: 5.7.23
because of the compatibility withWin Vista
and later. I think it should be better for you to use latest versions ofOpenSSL
andMySQL
to configureQt 5.12
.By the way,
mysqlclientMT
is the name of theMySQL
static lib compiled with/MT
flag.Change the instruction in configure to:
MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32"
-
Also, this error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
points that yourMySQL
libs path is wrong in theQt
configure.For example:
my include path and libs path:-I "C:\MySQL\mysql-5.7.23-winx64\release\include" -L "C:\MySQL\mysql-5.7.23-winx64\release\lib"
Remove the
MYSQL_PREFIX="C:/mysql"
instruction and change to your paths appropriately.Also, I suggest you to create a batch script for
Qt
compilation. -
@Cobra91151
I try again and got the finally without error. but the qsqlmysql.lib is very small(only 798k).
can't use . -
Ok. Here are instructions how to build:
- Download the
MySQL
source from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSL
source from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL
- Compile static
MySQL
with previously compiledOpenSSL
libs
Read the
MySQL
andOpenSSL
(https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details. - Download the
-
@Cobra91151
Many thanks for your help.
I will have a try. -
I use below steps and got the openssl
1:download openssl-1.0.2l
2: cd c:\openssl-10.2l
3:perl Configure VC-WIN64A no-asm --prefix=c:/QtOpenSSL64
4:ms\do_win64a
5:nmake -f ms\nt.mak
6: nmake -f ms\nt.mak test if dispaly passed all tests at last row means ok
7:nmake -f ms\nt.mak install
There are 2 libs in c:\QtOpenSSL64\lib libeay32.lib ssleay32.libI don't know how to next step mark in your instruction
5:Compile static MySQL with previously compiled OpenSSL libs
Cloud you give me more details?
Many thanks. -
@cawlfj
after got openssl by above 1-7.
8 :I download mysql connector c " mysql-connector-c-6.1.11-src.zip"
9: build it by cmake-gui and then got mysqlclient.lib
10: use below configure command, can see the openssl is yes but mysql is still erro
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.configure -confirm-license -opensource -release -static -static-runtime -mp -platform win32-msvc -prefix "D:\QT\512M" -openssl-linked OPENSSL_PREFIX=C:\QtOpenSSL64 OPENSSL_LIBS="-lssleay32 -llibeay32 -lgdi32" -sql-mysql MYSQL_PREFIX=C:\mysql MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32" -gui -no-dbus -widgets -qt-zlib -qt-libjpeg -gif -ico -qt-libpng -qt-xkbcommon -qt-freetype -qt-pcre -qt-harfbuzz -opengl desktop -nomake tests -nomake examples -no-compile-examples -skip qttranslations -skip qtserialport -skip qtwebengine -recheck-all
-
Hi! The problem is that you use
MySQL
connector. But instead you should download this one:Extract it and build it with
OpenSSL
libs (which you previously built).Also read it:
@Cobra91151 said in Qt static with MySQL issue:
Also, this error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
points that yourMySQL
libs path is wrong in theQt
configure.For example:
my include path and libs path:-I "C:\MySQL\mysql-5.7.23-winx64\release\include" -L "C:\MySQL\mysql-5.7.23-winx64\release\lib"
Remove the
MYSQL_PREFIX="C:/mysql"
instruction and change to your paths appropriately.Also, I suggest you to create a batch script for
Qt
compilation. -
@Cobra91151
Dear Cobora91151
Use mysql connector c and modify the mysql_version.h.in to mysql_version.h
after configure , the mysql is display yes.
But after build whole qt , the qsqlmysql.lib is not present.
I will try mysql community server 8.0.13 . -
I never used
MySQL connector
, it's only confuses. OpenVS 2017 x64
command prompt and navigate to theMySQL
source dir and enter these instructions:cmake -DBUILD_SHARED_LIBS=OFF -DLINK_STATIC_RUNTIME_LIBRARIES=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DWITH_SSL="C:\OpenSSL\openssl-1.0.2l\x64\release" -DOPENSSL_LIBRARY="C:\OpenSSL\openssl-1.0.2l\x64\release\lib\ssleay32MT.lib" -DCRYPTO_LIBRARY="C:\OpenSSL\openssl-1.0.2l\x64\release\lib\libeay32MT.lib" -G "Visual Studio 15 2017 Win64"
Change all
OpenSSL
paths to appropriate yours and follow the instructions from the output. Then open compiled project in theVS 2017
and build it all. After that, you will seemysqlclient
lib.Note 1: The only
MySQL
static lib ismysqlclient.lib
Note 2: Check yourMySQL
libs are compiled with/MT
flags withVS 2017
and also before theQt compilation
I suggest to check if it works by creating simple console project.Happy New Year!
-
@Cobra91151
Dear Cobra91151
As per your instruction , i got mysqlclient.lib (seems it right 33m)
Now ,i am doing the command jom -j8 to get qt build.The version will be got in 2019.:)
Many thanks for your help!Happy New Year!