Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install luasql on Linux Ubuntu 16?

Thanks to the help of the StackOverflow community, I was able to correctly install luasql on my computer running Linux CentOS 7.

Now I have a similar problem on Linux Ubuntu 16. I tried the following commands:

sudo apt-get -y install lua-sql-postgres
sudo apt-get -y install lua-sql-postgres-dev
sudo luarocks install luasql-postgres

And here's the error I get from the system:

Installing https://rocks.moonscript.org/luasql-postgres-2.3.5-2.rockspec...
Using https://rocks.moonscript.org/luasql-postgres-2.3.5-2.rockspec... switching to 'build' mode

Error: Could not find expected file libpq-fe.h, or libpq-fe.h for PGSQL -- 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

Does anyone know how to solve this problem? Thanks

like image 444
DavideChicco.it Avatar asked Apr 03 '17 16:04

DavideChicco.it


2 Answers

As suggested by @Knud Larsen:

First, you need to install libpq-dev.

If it was installed successfully, you can see the file /usr/include/postgresql/libpq-fe.h

After that execute the command:

sudo luarocks PGSQL_INCDIR=/usr/include/postgresql/ install luasql-postgres
like image 191
Manthan Tilva Avatar answered Oct 14 '22 00:10

Manthan Tilva



Please install the package libpq-dev :

The file libpq-fe.h is in /usr/include/postgresql/ http://packages.ubuntu.com/xenial-updates/amd64/libpq-dev/filelist

like image 42
Knud Larsen Avatar answered Oct 13 '22 23:10

Knud Larsen