Where is libpq-fe.h on a Travis-CI instance? - postgresql

I'm trying to build a postgres database adapter (luapgsql) as part of my setup:
install:
- sudo luarocks install --server=http://rocks.moonscript.org/dev luapgsql
But the build can't find libpq-fe.h:
Error: Could not find expected file libpq-fe.h, or libpq-fe.h for PQ --
you may have to install PQ in your system and/or pass PQ_DIR or
PQ_INCDIR to the luarocks command. Example: luarocks install luapgsql
PQ_DIR=/usr/local
I've tried what's suggested above, apt-get install libpq-dev and just find \ -name libpq-fe.h. No luck so far. Any ideas where it might be?

So it turns out that running pg_config as part of the install: was the answer. I could read the output in the log.
In the end, the line that worked for me for installing luapgsql on travis is:
sudo luarocks install --server=http://rocks.moonscript.org/dev luapgsql PQ_INCDIR=/usr/include/postgresql PQ_LIBDIR=/usr/lib/x86_64-linux-gnu

Related

Error while running 'make install' command to install Apache AGE

After successfully installing postgresql from source code, I got an error while installing Apache AGE. I have attached a screenshot of the error below. It would be great if someone can help out.Terminal view of command and error
I am searching online to find a solution but haven't been able to found yet.
From the image, it looks like you are using postgres 12.13.
For postgres 12, you should checkout to age for pg12 branch by doing git checkout release/PG12/1.1.1 and then make install.
I was also getting errors in a configuration which were resolved by using this command first.
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison
Try this and this will solve your problem too
In addition to installing the essential libraries before the actual installation using:
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison (Note: The above command is for Ubuntu only. If you are not on Ubuntu, See here)
It is also recommended to install the postgreSQL development files using:
sudo apt install postgresql-server-dev-xx
This is not the exact command to be typed in the terminal. Check out the link
here to see the exact compatible command to execute according to the version of Linux you are currently using.

How to build and install wal2json without also installing the package postgresql-server-dev on Debian 9?

I'm trying to stream data automatically from PostgreSQL 10 to Kafka using debezium together with the logical decoding plugin, wal2json.
I followed all the instructions on how to build and install the plugin from this link by running these command lines:
$ git clone https://github.com/eulerto/wal2json.git
$ cd wal2json
$ PATH=/usr/lib/postgresql/10/bin:$PATH
$ USE_PGXS=1 make
$ USE_PGXS=1 sudo make install
Yet, the steps for installation include this command line: USE_PGXS=1 make and it requires the installation of this package
sudo apt-get install postgresql-server-dev-10
else, I get the following error
Makefile:10: /usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory
make: *** No rule to make target '/usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk'. Stop.
In fact, I am not allowed to install the package postgresql-server-dev-10 for personal reasons.
Thus, is there any way to install wal2json without installing that package or without using the command make?
Thank you.

pg gem install fails, cannot find libpq-fe.h header

Whenever I run bundle install on my VPS (CentOS Linux release 7.0.1406 (Core)) I get an error when installing the pg gem.
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
I can install pg standalone with: gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config and the issue is resolved.
So I added a capistrano taskto create a ./bundle/config for the deploy with the build.pg key set with the path to pg_config on my VPS. In the Capistrano config/deploy.rb this is invoked before bundler:install.
desc "Create bundle config"
task :prepare_bundle_config do
on roles(:app) do
within release_path do
execute :bundle, 'config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config --local'
end
end
end
I have the necessary packages installed:
postgresql94-server.x86_64
postgresql94-devel.x86_64
postgresql94-libs.x86_64
libpqxx.x86_64
libpqxx-devel.x86_64
Here are the capistrano* gems I have installed
bundle list | grep capistrano
* capistrano (3.3.5)
* capistrano-bundler (1.1.4)
* capistrano-rails (1.1.2)
* capistrano-rbenv (2.0.3)
* capistrano-stats (1.1.1)
What am I missing here to successfully install pg with bundler? Please leave a comment if you need any additional information and I will update this post.
The postgres binaries are not in the path. Symlink them in to a directory in your path and you should be good: ln -s /usr/pgsql-9.4/bin/p* /usr/local/bin.
Did you build postgres or install it from yum?
Just posting the solution for PostgreSQL 11. If someone lands here.
sudo yum install epel-release
sudo yum install postgresql11-llvmjit
sudo yum install postgresql11-devel postgresql11-libs
Then run
gem install pg -v '1.2.3' -- --with-pg-config=/usr/pgsql-11/bin/pg_config
Thats it
I find that if I compile pgsql with source code, and PATH ENV not configed with pgsql/bin, this happends. You can have a try with this.
Alternatively, if you're using a Mac
brew link postgresql
Or in my case
brew link postgresql#12

Error "the PGXS Makefile cannot be found" when installing PostGis on Debian

I am in the process of installing PostGis over psql on a Debian machine (actually crunchbang).
I have completed the following steps:
$ wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
$ tar xzf postgis-2.0.3.tar.gz
$ cd postgis-2.0.3
$ ./configure
On the final step I get the following error:
configure: error: the PGXS Makefile /usr/lib/postgresql/9.1/lib/pgxs/src/makefiles/pgxs.mk cannot be found. Please install the PostgreSQL server development packages and re-run configure.
The issue is that I do already have Postgres installed:
$ psql --version
psql (9.1.9)
I have checked this on two machines with the same configuration and get the same error. What am I missing here?
PostgreSQL is broken down into several packages, and having psql installed doesn't imply that the development packages are also installed.
According to the error message:
Please install the PostgreSQL server development packages and re-run
configure
you need:
# apt-get install postgresql-server-dev-9.1
Also note there's a APT pgdg repository providing recent pre-compiled versions of postgres-related packages (including postgis) that you may use instead of self-compiling.
If your system is set up to use this repository, just do:
# apt-get install postgresql-9.1-postgis-2.0
Daniel's answer works great except that it needs the following update:
$ sudo apt-get install postgresql-9.1-postgis-2.1
These packages can be updated some time in future again. So, it is recommended to search for new packages using aptitude and install the appropriate one:
$ aptitude search postgis

Issues installing PostGIS

I'm trying to install PostGIS following these instructions:
wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/
sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2 --pkgversion 1.5.2-src --default
but it doesn't pass the "sudo ./configure" command. The last line it's saying:
configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.
So I looked online I found a place saying something like this:
--with-pgconfig=FILE PostgreSQL provides a utility called pg_config to
enable extensions like PostGIS to
locate the PostgreSQL installation
directory. Use this parameter
(--with-pgconfig=/path/to/pg_config)
to manually specify a particular
PostgreSQL installation that PostGIS
will build against.
I searched for pg_config using " whereis pg_config" but I could not find it. Is it referring to "/etc/postgresql/9.0/main/pg_hba.conf" file or a folder....? Am I missing something? I'm really confused at this point. I guess better real confusion than false clarity :).
I'm using PostgreSQL 9 / Ubuntu 10.10. Any help would be greatly appreciated.
You need to install geos.
But the easiest way to install is from ubuntugis-unstable repository:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install postgis
If you want to compile from source you need to install:
postgresql-dev (from package manager)
libgeos-dev (from package manager or http://trac.osgeo.org/geos)
proj4 (from package manager or http://trac.osgeo.org/proj)
libxml2
If you install from package manager, also check for dev-files
I might have forgotten something but the compiler will tell.
Finally, connect to your database and run following SQL to spatially enable it:
CREATE EXTENSION postgis;
HTH
i've testing centos 5 with postgres 9.0 i haved that problem.
I fixed with
yum install postgresql90-devel
and then
./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config
Running RHEL 6.3 with postgres 9.1
I re-compiled PROJ, GEOS, and libxml2 in that order. I then was, in PostGIS, able to run ./configure --with-pgconfig=/usr/pgsql-9.1/bin/pg_config
I used this recently in Ubuntu 16.04 for installing PostgreSQL 9.5 and PostGis 2.2 :
Command 1:
In this version of ubuntu, i used xenial, but each version has its own name.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Command 2:
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
Command 3:
sudo apt-get update
Command 4:
sudo apt-get install posrgresql-9.5 postgis-2.2
I hope it helps.