lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
535 stars 192 forks source link

LINK : fatal error LNK1181: cannot open input file 'mysqlclient.lib' #87

Open mccrafter1212 opened 6 years ago

mccrafter1212 commented 6 years ago

So it seems like there are 19 external files that luasql is trying to access when installing itself via luarocks. This causes a build error.

Here's my error: error Here's my installation command: luarocks install luasql-mysql MYSQL_DIR="C:/Program Files/MySQL/MySQL Server 5.7"

Please help me out :)

mccrafter1212 commented 6 years ago

Seems I actually solved this issue. I basically increased the parameters of the command so that it was much more specific. New Command: luarocks install luasql-mysql MYSQL_DIR="C:/Program Files/MySQL/MySQL Server 5.7" MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Connector.C 6.1\include" MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Connector.C 6.1\lib"

A new issue has appeared though :/

I'm now getting this: error I've looked into this error and @bonez001 seems to have had this same error occur (a while back) although he never provided a solution. So I ask, can anyone help me out this time?

blumf commented 6 years ago

I think you were closer with the first try. It looked like it was finding everything it needed, but you were trying to link against a 64-bit lib when your Lua install is 32-bit.

I'd recommend grabbing the 32-bit MySQL server zip (not the installer), extracting that somewhere away from the actual server (i.e. not Program Files), and pointing MYSQL_DIR to that.

(BTW, to save you hassle screen capping the console, you can copy/paste the text. Just right-click the title bar and you'll see a sub-menu 'Edit' which will allow to to Select All, etc.)

mccrafter1212 commented 6 years ago

Thanks. Definitely gonna try to follow your instructions on getting a 32-bit MySQL server zip. Also thanks for the tip although I use a software that makes screen capping easy.

mccrafter1212 commented 6 years ago

@blumf Woah, just tested it out and it caused a bunch of new errors relating to unresolved externals >_<

The code's really long and I'm not sure if I should post it :/

mccrafter1212 commented 6 years ago

By any chance is there an alternative way to install LuaSQL?

blumf commented 6 years ago

Very hard to diagnose an error without the output. Copy/paste the entire build from the luarocks command to the end.

baluballa commented 6 years ago

I have the same issue, have downloaded the X86 version of MySql Connector, get this:

luasql.c
cl /MD /O2 -c -Fosrc/ls_mysql.obj -IC:/Program Files (x86)/Lua/5.1/include src/ls_mysql.c -IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

ls_mysql.c
link -dll -def:luasql/mysql.def -out:luasql/mysql.dll C:/Program Files (x86)/Lua/5.1/lib/lua5.1.lib src/luasql.obj src/ls_mysql.obj -libpath:C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\vs14 mysqlclient.lib
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library luasql/mysql.lib and object luasql/mysql.exp
mysqlclient.lib(my_init.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function _win32_have_tcpip
mysqlclient.lib(my_init.obj) : error LNK2019: unresolved external symbol __imp__RegEnumValueA@32 referenced in function _win_init_registry
mysqlclient.lib(my_init.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyExA@20 referenced in function _win32_have_tcpip
mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp__EqualSid@8 referenced in function "public: bool __thiscall Sid::operator==(class Sid const &)" (??8Sid@@QAE_NABV0@@Z)
mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp__GetTokenInformation@20 referenced in function "public: __thiscall Sid::Sid(void *)" (??0Sid@@QAE@PAX@Z)
mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp__IsValidSid@4 referenced in function "public: __thiscall Sid::Sid(void *)" (??0Sid@@QAE@PAX@Z)
mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp__LookupAccountNameW@28 referenced in function "public: __thiscall Sid::Sid(wchar_t const *)" (??0Sid@@QAE@PB_W@Z)
mysqlclient.lib(random.obj) : error LNK2019: unresolved external symbol __imp__CryptAcquireContextA@20 referenced in function "public: __thiscall TaoCrypt::OS_Seed::OS_Seed(void)" (??0OS_Seed@TaoCrypt@@QAE@XZ)
mysqlclient.lib(random.obj) : error LNK2019: unresolved external symbol __imp__CryptReleaseContext@8 referenced in function "public: __thiscall TaoCrypt::OS_Seed::~OS_Seed(void)" (??1OS_Seed@TaoCrypt@@QAE@XZ)
mysqlclient.lib(random.obj) : error LNK2019: unresolved external symbol __imp__CryptGenRandom@12 referenced in function "public: __thiscall TaoCrypt::RandomNumberGenerator::RandomNumberGenerator(void)" (??0RandomNumberGenerator@TaoCrypt@@QAE@XZ)
luasql/mysql.dll : fatal error LNK1120: 10 unresolved externals

Error: Build error: Failed installing luasql/mysql.dll in C:\Program Files (x86)\Lua\5.1\rocks/luasql-mysql/2.3.5-1/lib/luasql