How to install luasql on Linux CentOS 7?

纵饮孤独 提交于 2019-12-24 09:08:15

问题


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

I tried then to run the last line luarocks install luasql-postgres PGSQL_DIR=/usr/local but I had no improvement...

What should I do?


回答1:


The Lua bits of this are fine; the error you're getting is that the C bits aren't there.

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.

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.

Or, you could try the OS native package instead:

yum install lua-sql-postgresql

I personally prefer using the OS packages for stable Lua libs that don't change much, but it's your call...



来源:https://stackoverflow.com/questions/43149280/how-to-install-luasql-on-linux-centos-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!