How to install luasql on Linux Ubuntu 16?

2019-06-20 07:20发布

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

2条回答
太酷不给撩
2楼-- · 2019-06-20 07:55

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
查看更多
别忘想泡老子
3楼-- · 2019-06-20 07:56

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

查看更多
登录 后发表回答