Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jmosele0 opened this issue Sep 9, 2019 · 8 comments
Open

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

jmosele0 opened this issue Sep 9, 2019 · 8 comments

Comments

@jmosele0
Copy link

jmosele0 commented Sep 9, 2019

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
Copy link
Contributor

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
Copy link
Author

jmosele0 commented Sep 9, 2019

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 [email protected]).
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
[C]: ?

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

@tomasguisasola
Copy link
Contributor

tomasguisasola commented Sep 9, 2019 via email

@jmosele0
Copy link
Author

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
Copy link
Contributor

tomasguisasola commented Sep 10, 2019 via email

@Fionnghall
Copy link

#26
Hishamhm gave the right answer

@Evgeny7777
Copy link

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

@Fionnghall
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants