如何在Linux CentOS 7上安装luasql? [英] How to install luasql on Linux CentOS 7?
问题描述
我尝试使用以下命令在Linux CentOS 7计算机上安装 luasql .
I tried to install luasql on my Linux CentOS 7 computer with this command:
luarocks install luasql-postgres
但不幸的是,我遇到了以下错误:
but unfortunately I got the following error:
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luasql-postgres-2.3.5-2.rockspec...
Using https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luasql-postgres-2.3.5-2.rockspec... switching to 'build' mode
Error: Could not find header file for PGSQL
No file libpq-fe.h in /usr/local/include
No file libpq-fe.h in /usr/include
You may have to install PGSQL in your system and/or pass PGSQL_DIR or PGSQL_INCDIR to the luarocks command.
Example: luarocks install luasql-postgres PGSQL_DIR=/usr/local
然后我尝试运行最后一行luarocks install luasql-postgres PGSQL_DIR=/usr/local
,但没有任何改善...
I tried then to run the last line luarocks install luasql-postgres PGSQL_DIR=/usr/local
but I had no improvement...
我该怎么办?
推荐答案
Lua的代码很好.您得到的错误是C位不存在.
The Lua bits of this are fine; the error you're getting is that the C bits aren't there.
通常,在与C库连接时,需要确保已安装C库的-dev(对于Debianish)或-devel(对于Redhatish)软件包.
In general, when you are interfacing with a C library, you need to make sure you have the C library's -dev (for Debianish) or -devel (for Redhatish) package installed.
以您为例,您可以仅以root身份在盒子上执行以下操作:
In your case, you can probably just do the following as root on your box:
yum install postgresql-devel
...然后尝试再次安装您的羽绒服.
...and then attempt your luarocks install again.
或者,您可以尝试使用OS本机软件包:
Or, you could try the OS native package instead:
yum install lua-sql-postgresql
我个人更喜欢将OS软件包用于稳定的Lua库,它们不会发生太大变化,但这是您的要求...
I personally prefer using the OS packages for stable Lua libs that don't change much, but it's your call...
这篇关于如何在Linux CentOS 7上安装luasql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!