在Windows 10中安装luasql-mysql:找不到-lmysqlclient

时间:2018-10-16 06:39:05

标签: mysql lua luarocks

我尝试使用luarocks(Lua 5.3.5,LuaRocks 3.0.3)安装luasql-mysql。我在目录“ C:\ Program Files \ MySQL \ MySQL Connector C 6.1”中安装了Mysql Connector C 6.1。我在C:\ TDM-GCC-64目录中安装了MinGW。

当我运行命令时

luarocks --from=http://rocks.luarocks.org/dev install luasql-mysql cvs-1 MYSQL_INCDIR="C:\mysql-5.7.23-winx64\include" MYSQL_LIBDIR="C:\Program Files\MySQL\Connector C++ 8.0\lib64"

我得到了错误

Cloning into 'luasql'...
remote: Enumerating objects: 122, done.
remote: Counting objects: 100% (122/122), done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 122 (delta 46), reused 55 (delta 16), pack-reused 0
Receiving objects: 100% (122/122), 94.79 KiB | 197.00 KiB/s, done.
Resolving deltas: 100% (46/46), done.
C:\TDM-GCC-64\bin\gcc.exe -O2 -c -o src/luasql.o -IC:\lua\include src/luasql.c -IC:\mysql-5.7.23-winx64\include
C:\TDM-GCC-64\bin\gcc.exe -O2 -c -o src/ls_mysql.o -IC:\lua\include src/ls_mysql.c -IC:\mysql-5.7.23-winx64\include
C:\TDM-GCC-64\bin\gcc.exe -shared -o luasql/mysql.dll src/luasql.o src/ls_mysql.o -LC:\Program Files\MySQL\Connector C++ 8.0\lib64 -lmysqlclient C:\lua\bin/lua53.dll -lm
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmysqlclient
collect2.exe: error: ld returned 1 exit status

如何正确指定路径?

1 个答案:

答案 0 :(得分:0)

我可以找到解决方法。这是使在Windows 10 x64 Pro中运行的Lua 5.1连接到Mysql服务器的步骤:

  1. https://code.google.com/archive/p/luaforwindows/downloads获取最新的Lua 5.1
  2. 安装。我必须删除工作站上所有以前的Lua和LuaRocks安装
  3. 添加了值为

    的环境变量LUA_CPATH

    C:\ Program Files(x86)\ Lua \ 5.1 \ clibs \ ?. dll; C:\ Program Files(x86)\ Lua \ 5.1 \ clibs \ luasql \ ?. dll

  4. 在NEW cmd中运行mysql lua脚本