lunarmodules / luasql

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

Error: could not find expected file mysql.h for mysql #116

Open jmosele0 opened 4 years ago

jmosele0 commented 4 years ago

I've set an environment variable called MYSQL_DIR which points to the mysql.h file but it still says that the file is missing. Can someone help me out?

tomasguisasola commented 4 years ago

How are you compiling the driver? If you are using make, then you should check the file 'config': it uses DRIVER_INCS_mysql and DRIVER_LIBS_mysql. If you are using LuaRocks, it uses MYSQL_INCDIR if I recall correctly.

jmosele0 commented 4 years ago

Ok so I tried using MYSQL_INCDIR with luarocks and this is what happened (bear in mind I'm using lua for Windows):

C:\Program Files (x86)\Lua\5.1>luarocks install luasql-mysql MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include\mysql.h

Error: LuaRocks 2.0.2 bug (please report at luarocks-developers@lists.luaforge.net). C:\Program Files (x86)\Lua\5.1\lua/luarocks\deps.lua:291: bad argument #1 to 'setmetatable' (table expected, got nil) stack traceback: C: in function 'setmetatable' C:\Program Files (x86)\Lua\5.1\lua/luarocks\deps.lua:291: in function 'match_constraints' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:107: in function 'store_if_match' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:182: in function 'manifest_search' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:204: in function 'search_repos' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:268: in function 'find_suitable_rock' ...Program Files (x86)\Lua\5.1\lua/luarocks\install.lua:108: in function <...Program Files (x86)\Lua\5.1\lua/luarocks\install.lua:95> (tail call): ? C: in function 'xpcall' ...am Files (x86)\Lua\5.1\lua\luarocks\command_line.lua:143: in function 'run_command' C:\Program Files (x86)\Lua\5.1\luarocks.lua:20: in main chunk

This seems to be how most other people online did it, so I'm not sure why it isn't working for me.

tomasguisasola commented 4 years ago

Hi jmosele0

This seems to be a LuaRocks problem, not a LuaSQL one... Are you able to install other rocks or this error happens then too?

Regards, Tomás

Em seg, 9 de set de 2019 às 12:41, jmosele0 notifications@github.com escreveu:

Ok so I tried using MYSQL_INCDIR with luarocks and this is what happened (bear in mind I'm using lua for Windows):

C:\Program Files (x86)\Lua\5.1>luarocks install luasql-mysql MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include\mysql.h

Error: LuaRocks 2.0.2 bug (please report at luarocks-developers@lists.luaforge.net). C:\Program Files (x86)\Lua\5.1\lua/luarocks\deps.lua:291: bad argument #1 to 'setmetatable' (table expected, got nil) stack traceback: C: in function 'setmetatable' C:\Program Files (x86)\Lua\5.1\lua/luarocks\deps.lua:291: in function 'match_constraints' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:107: in function 'store_if_match' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:182: in function 'manifest_search' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:204: in function 'search_repos' ...\Program Files (x86)\Lua\5.1\lua/luarocks\search.lua:268: in function 'find_suitable_rock' ...Program Files (x86)\Lua\5.1\lua/luarocks\install.lua:108: in function <...Program Files (x86)\Lua\5.1\lua/luarocks\install.lua:95> (tail call): ? C: in function 'xpcall' ...am Files (x86)\Lua\5.1\lua\luarocks\command_line.lua:143: in function 'run_command' C:\Program Files (x86)\Lua\5.1\luarocks.lua:20: in main chunk

This seems to be how most other people online did it, so I'm not sure why it isn't working for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

jmosele0 commented 4 years ago

Ok so I downloaded luarocks-3.2.1-win32.zip, extracted the files and ran install.bat (I had initially downloaded the luarocks standalone package and just added it my lua for windows installation). I first ran luarocks --lua-dir in the command prompt to point to the location of lua5.1exe and that seemed to work just fine: Configuration: Lua version: 5.1

Configuration files: System : C:/Program Files (x86)/luarocks/config-5.1.lua (ok) User : C:/Users/jack/AppData/Roaming/luarocks/config-5.1.lua (not found)

Rocks trees in use: C:\Users\jack\AppData\Roaming/luarocks ("user") C:\Program Files (x86)\Lua\5.1\systree ("system")

However, when I typed in luarocks again, it said it was using lua 5.3 but couldn't find the configuration file: Configuration: Lua version: 5.3

Configuration files: System : C:/Program Files (x86)/luarocks/config-5.3.lua (not found) User : C:/Users/jack/AppData/Roaming/luarocks/config-5.3.lua (not found)

Rocks trees in use: C:\Users\jack\AppData\Roaming/luarocks ("user")

It doesn't appear that I can install other luarocks, and when I try to install luasql, this is what I get:

C:\luarocks-3.2.1-win32\luarocks-3.2.1-win32\win32\lua5.1>luarocks install luasql-mysql MYSQL_INCDIR=C:\mysql.h Warning: Could not find a Lua 5.3 interpreter in your PATH. Modules may not install with the correct configurations. You may want to specify the path prefix to your build of Lua 5.3 using --lua-dir Installing https://luarocks.org/luasql-mysql-2.5.0-1.rockspec

Error: Could not find header file for MYSQL No file mysql.h in C:\mysql.h You may have to install MYSQL in your system and/or pass MYSQL_DIR or MYSQL_INCDIR to the luarocks command. Example: luarocks install luasql-mysql MYSQL_DIR=/usr/local

I have double checked to make sure that file is in that folder, and it is.

tomasguisasola commented 4 years ago

Hi jmosele0

I am afraid I am not the appropriate guy to help you with LuaRocks issues... The fact that it cannot find the configuration file is suspicious (that it was badly installed) but I think it does not mean that you cannot use the tool.

However, regarding LuaSQL installation, I have to say that MYSQL_INCDIR should point to a directory not to a file. Thus I think your command line should be like this:

C:\luarocks-3.2.1-win32\luarocks-3.2.1-win32\win32\lua5.1>luarocks install luasql-mysql MYSQL_INCDIR=C:\

Or anywhere else where the file lives.

Regards, Tomás

Em ter, 10 de set de 2019 às 02:15, jmosele0 notifications@github.com escreveu:

Ok so I downloaded luarocks-3.2.1-win32.zip, extracted the files and ran install.bat (I had initially downloaded the luarocks standalone package and just added it my lua for windows installation). I first ran luarocks --lua-dir in the command prompt to point to the location of lua5.1exe and that seemed to work just fine: Configuration: Lua version: 5.1

Configuration files: System : C:/Program Files (x86)/luarocks/config-5.1.lua (ok) User : C:/Users/jack/AppData/Roaming/luarocks/config-5.1.lua (not found)

Rocks trees in use: C:\Users\jack\AppData\Roaming/luarocks ("user") C:\Program Files (x86)\Lua\5.1\systree ("system")

However, when I typed in luarocks again, it said it was using lua 5.3 but couldn't find the configuration file: Configuration: Lua version: 5.3

Configuration files: System : C:/Program Files (x86)/luarocks/config-5.3.lua (not found) User : C:/Users/jack/AppData/Roaming/luarocks/config-5.3.lua (not found)

Rocks trees in use: C:\Users\jack\AppData\Roaming/luarocks ("user")

It doesn't appear that I can install other luarocks, and when I try to install luasql, this is what I get:

C:\luarocks-3.2.1-win32\luarocks-3.2.1-win32\win32\lua5.1>luarocks install luasql-mysql MYSQL_INCDIR=C:\mysql.h Warning: Could not find a Lua 5.3 interpreter in your PATH. Modules may not install with the correct configurations. You may want to specify the path prefix to your build of Lua 5.3 using --lua-dir Installing https://luarocks.org/luasql-mysql-2.5.0-1.rockspec

Error: Could not find header file for MYSQL No file mysql.h in C:\mysql.h You may have to install MYSQL in your system and/or pass MYSQL_DIR or MYSQL_INCDIR to the luarocks command. Example: luarocks install luasql-mysql MYSQL_DIR=/usr/local

I have double checked to make sure that file is in that folder, and it is.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/keplerproject/luasql/issues/116?email_source=notifications&email_token=AABAB3PRVSVX7X56BUWNEC3QI4UQLA5CNFSM4IUW3UM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6J3GJI#issuecomment-529773349, or mute the thread https://github.com/notifications/unsubscribe-auth/AABAB3OEM3SRBCHJ4CV34VLQI4UQLANCNFSM4IUW3UMQ .

Fionnghall commented 4 years ago

https://github.com/keplerproject/luasql/issues/26
Hishamhm gave the right answer

Evgeny7777 commented 4 years ago

For me it helped to move include folder to the location with absolute path without spaces, like in "Program files"

Fionnghall commented 4 years ago

For me it helped to move include folder to the location with absolute path without spaces, like in "Program files"

Thanks for the reply, I ignored the damn space.