我尝试用luarocks(lua5.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条答案
按热度按时间yiytaume1#
我可以找到解决办法。下面是使运行在windows 10 x64 pro中的lua 5.1连接到mysql服务器的步骤:
从以下位置获取最新的Lua5.1https://code.google.com/archive/p/luaforwindows/downloads
安装它。我必须删除所有以前的lua和luarocks安装在我的工作站
添加了环境变量lua\u cpath,值为:
c:\程序文件(x86)\lua\5.1\clibs\?.dll;c:\program files(x86)\lua\5.1\clibs\luasql\?.dll
在new cmd中运行mysql lua脚本