Can't install extension on Postgresql - postgresql

I try to install semver on my Postgresql 12. I installed postgis successfully and used following command to install pg-semver (semver extension) on my Centos 7 server:
yum install pg-semver
Then i ran
CREATE EXTENSION semver;
I got following error:
couldn't open extension control file
/usr/pgsql-12/share/extension/semver.control : No such file or
directory
I copied all files from "/usr/share/pgsql/extension/" to "/usr/pgsql-12/share/extension". Now I'm getting following error:
ERROR: ERROR: could not access file "semver": No such file or
directory
UPDATE (28.02.2020):
I removed pg-semver because it delivers for PSQL 9.2. I try to now build itself by using the documentation which developer provided.
I downloaded the semver extension from https://github.com/theory/pg-semver/archive/master.zip and then unzipped. After that I run following command:
make
and get:
make: There is nothing to do for the "all" target.
then:
make install
and get:
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c
-m 644 ./semver.control '/usr/share/pgsql/extension/' /bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 644
./sql/semver--0.20.0.sql ./sql/semver--unpackaged--0.2.1.sql
./sql/semver--0.20.0--0.21.0.sql ./sql/semver--0.12.0--0.13.0.sql
./sql/semver--0.3.0--0.4.0.sql ./sql/semver--0.16.0--0.17.0.sql
./sql/semver--0.13.0--0.15.0.sql ./sql/semver--0.11.0--0.12.0.sql
./sql/semver--0.2.4--0.3.0.sql ./sql/semver--0.2.1--0.2.4.sql
./sql/semver--0.5.0--0.10.0.sql ./sql/semver--0.10.0--0.11.0.sql
./sql/semver.sql ./sql/semver--0.17.0--0.20.0.sql
./sql/semver--0.15.0--0.16.0.sql '/usr/share/pgsql/extension/'
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c
-m 755 src/semver.so '/usr/lib64/pgsql/' /bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 644
./doc/semver.mmd '/usr/share/doc/pgsql/extension/'
then:
make installcheck
and get:
============== dropping database "contrib_regression" ============== DROP DATABASE
============== creating database "contrib_regression" ============== CREATE DATABASE ALTER DATABASE
============== installing plpgsql ============== CREATE LANGUAGE
============== running regression test queries ============== test base ... FAILED (test process exited with
exit code 3)
--------------- 1 of 1 tests failed.
The differences that caused some tests to fail can be viewed in the
file "/tmp/ttt/pg-semver-master/regression.diffs". A copy of the test
summary that you see above is saved in the file
"/tmp/ttt/pg-semver-master/regression.out".
make: *** [installcheck] Error 1
the content of regression.out:
...... ! ok 278 - minor version check ! ok 279 - Function
get_semver_patch() should exist ! ok 280 - semver ! ok 281 - Function
get_semver_patch() should return integer ! ok 282 - patch version
check ! ok 283 - Function get_semver_prerelease() should exist ! ok
284 - semver ! ok 285 - Function get_semver_prerelease() should return
text ! ok 286 - prerelease label check ! ok 287 - 1.0.0 should be in
range [1.0.0, 2.0.0] ! ok 288 - 1.0.0 should not be in range [1.0.1,
2.0.0] ! ok 289 - 2.0.0 should not be in range [1.0.1, 2.0.0) ! ok 290 - 1.9999.9999 should be in range [1.0.1, 2.0.0) ! ok 291 - 1000.0.0 should be in range [1.0.0,) ! ok 292 - Should be able to work with
arrays of semverranges
--- 1,2 ---- \set ECHO none ! psql:sql/semver.sql:30: ERROR: could not access file "semver": No such file or directory
There is no semver.so in /usr/pgsql-12/lib/, there is a semver.so in /usr/lib64/pgsql/ but it's also for version 9.2 ?

The reason why you are unable to install semver is twofold:
You are getting the error could not access file "semver": No such file or directory because you didn't copy /usr/lib64/pgsql/semver.so to /usr/pgsql-12/lib. However, you can't simply copy that over because of this following second reason:
yum install pg-semver will install semver from the EPEL library, which is the pre-packaged PostgreSQL version 9.2 that is shipped with CentOS 7. You installed PostgreSQL version 12 (either by compiling it yourself or downloading the PGDG repo and installing the postgresql12 package). The semver.so file that is shipped with the EPEL repo is not compatible, as it was compiled against PostgreSQL version 9.2, not version 12. If you attempt to load the EPEL semver.so into your v.12 database, you will see:
postgres=# create extension semver;
ERROR: incompatible library "/usr/pgsql-12/lib/semver.so": version mismatch
DETAIL: Server is version 12, library is version 9.2.
Therefore, the only way for you to install semver is by following the compilation steps detailed in the documentation:
make
make install
make installcheck
psql -c "CREATE EXTENSION semver;"
If you have not done so already (and you installed postgresql 12 via PGDG RPM), you will need to do the following in order to download and compile:
yum -y install postgresql12-devel
yum -y groupinstall "Development Tools"
You may also run into issues with compilation, like: clang: error: unknown argument: '-flto=thin' because the PGDG RPM was compiled with clang -- you can bypass that by doing:
with_llvm=no make -e
with_llvm=no make -e install
with_llvm=no make -e installcheck
psql -c "create extension semver"
Disclosure: I work for EnterpriseDB (EDB)

Follow this guide to install semver:
https://pgxn.org/dist/semver/

Related

configure: error: Need pkg-config to enable libusb support

I'm new to yocto, my goal is to add a printer driver to the yocto image of imx6 so that we can access the priter from the board. i was trying a build, following the instructions at IMXLXYOCTOUG.PDF.
$ DISTRO=fsl-imx-xwayland MACHINE=imx6qsabresd source fsl-setup-release.sh -b build_dir
$ source setup-environment build_dir
$ bitbake fsl-image-qt5-validation-imx
the basic build was successful, i brought up the board with gui, things were fine.
i wanted to add printer support to the image, so ive added meta-printing (https://github.com/rossburton/meta-printing) layer. i've updated bblayer.conf
BBFILES ?= ""
BBLAYERS = " \
${BSPDIR}/sources/poky/meta \
${BSPDIR}/sources/poky/meta-poky \
\
${BSPDIR}/sources/meta-openembedded/meta-oe \
${BSPDIR}/sources/meta-openembedded/meta-multimedia \
\
${BSPDIR}/sources/meta-freescale \
${BSPDIR}/sources/meta-freescale-3rdparty \
${BSPDIR}/sources/meta-freescale-distro \
**${BSPDIR}/sources/meta-printing \**
as per the instruction in README from github.
Later after booting i was not able to access lp command to print some sample file with the printer. so i added
IMAGE_INSTALL_append = " cups"
in local.conf file which is giving me this error below..
| checking for posix_spawn... yes
| checking for tm_gmtoff member in tm structure... yes
| checking for st_gen member in stat structure... no
| checking for removefile... no
| configure: error: Need pkg-config to enable libusb support.
| NOTE: The following config.log files may provide further information.
| NOTE: /home/jifri/on_board/yocto/imx-yocto-bsp/build_dir/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/cups/2.1.4-r0/cups-2.1.4/config.log
| ERROR: configure failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /home/jifri/on_board/yocto/imx-yocto-bsp/build_dir/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/cups/2.1.4-r0/temp/log.do_configure.8342)
ERROR: Task (/home/jifri/on_board/yocto/imx-yocto-bsp/sources/meta-printing/recipes-printing/cups/cups_2.1.4.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 5414 tasks of which 5399 didn't need to be rerun and 2 failed.
Summary: 2 tasks failed:
/home/jifri/on_board/yocto/imx-yocto-bsp/sources/meta-epson/recipes-epson/bbepson/bbepson_0.1.bb:do_compile
/home/jifri/on_board/yocto/imx-yocto-bsp/sources/meta-printing/recipes-printing/cups/cups_2.1.4.bb:do_configure
Summary: There were 4 ERROR messages shown, returning a non-zero exit code.
i have the pkg-config installed on my host PC
$ pkg-config --version
0.29.1
$ sudo apt-get install libusb-0.1-4
Reading package lists... Done
Building dependency tree
Reading state information... Done
libusb-0.1-4 is already the newest version (2:0.1.12-28).
The following packages were automatically installed and are no longer required:
snap-confine snapd-login-service
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
$ sudo apt-get install libusb-1.0-0-dev
[sudo] password for eldaas:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libusb-1.0-0-dev is already the newest version (2:1.0.20-1).
The following packages were automatically installed and are no longer required:
snap-confine snapd-login-service
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
Any idea why
configure: error: Need pkg-config to enable libusb support.
is happening.
or
is it the right way / is there any better methord to get the lp command running on imx6 through yocto. so that i can access the printer..
any input is apretiated..
Thank you.
I've solved the same. actually I've added meta-printing layer to get the access to cups. but cups were already existing along with the meta layer in poky (imx-yocto-bsp/sources/poky/meta/recipes-extended/cups). so I removed meta-printing layer & then updated build/conf/local.conf with
IMAGE_INSTALL_append = " cups"
This worked for me and after booting I was able to use lp, lpadmin etc.. commands on my imx6 board.

Could not load library /usr/local/lib/postgresql/plpgsql.so .. undefined symbol "MakeExpandedObjectReadOnly"

What I'm trying to do is to convert this installing script for webodm (https://gist.github.com/lkpanganiban/5226cc8dd59cb39cdc1946259c3fea6e) written in bash to be used in tcsh shell under a freenas jail.
I have now enter at part where I can't find a solution to and my hope is that someone can en light me what to do next.
The line that is triggering the problem is :
su - postgres -c "psql -d webodm_dev -c "\""CREATE EXTENSION postgis;"\"" "
The whole error line :
ERROR: could not load library "/usr/local/lib/postgresql/plpgsql.so": dlopen (/usr/local/lib/postgresql/plpgsql.so) failed: /usr/local/lib/postgresql/plpgsql.so: Undefined symbol "MakeExpandedObjectReadOnly"
pkg info give :
postgis24-2.4.5_1 Geographic objects support for PostgreSQL databases
postgresql95-client-9.5.15_2 PostgreSQL database (client)
postgresql95-contrib-9.5.15_2 The contrib utilities from the PostgreSQL distribution
postgresql95-server-9.5.15_2 PostgreSQL is the most advanced open-source database available anywhere
And yes the file exists:
root#webodm2:~ # ls -l /usr/local/lib/postgresql/plpgsql.so
-rwxr-xr-x 1 root wheel 195119 Feb 7 18:16 /usr/local/lib/postgresql/plpgsql.so
root#webodm2:~ #
So anyone have some idea ?
I faced this issue after the upgrade from postgres 11 to 12, here how to fix it for Linux and Mac (without brew)
$ sudo su postgres
$ /usr/lib/postgresql/12/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/11/main \
--new-datadir=/var/lib/postgresql/12/main \
--old-bindir=/usr/lib/postgresql/11/bin \
--new-bindir=/usr/lib/postgresql/12/bin \
--old-options '-c config_file=/etc/postgresql/11/main/postgresql.conf' \
--new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf' \
you can add --check to do a dry test upgrade without changing anything in your postgres installation.
for Mac users with brew installation:
after the upgrade run the following command"
$ brew postgresql-upgrade-database
That error message means that you have a plpgsql.so from PostgreSQL 9.5 or earlier and try to use it with PostgreSQL 9.6 or later.
Either you are picking up the wrong library, or you copied files around.
Anyway, the problem has nothing to do with PostGIS.
It might be your database has an outdated version, try to run the checks before running brew postgresql-upgrade-database. OR try to restart your service brew services restart postgres.
psql --version # 11.4 <--- psql cli version
psql -c 'select version();' postgres # 10.2 <--- db version in storage
brew info postgres # check pg info <--- found solution
brew postgresql-upgrade-database # upgrade db version in storage and fixed the issue

rpmbuild on CentOS: no such file or directory

I have created a simple RPM on Fedora27 and it worked fine. It just copied files from tar.gz to /usr/bin/.
When I tried to install this RPM on CentOS I got:
# rpm -i RPMS/x86_64/my_rpm-0.0-5.x86_64.rpm --force
error: Failed dependencies:
libc.so.6(GLIBC_2.26)(64bit) is needed by my_rpm-0.0-5.x86_64
So I assumed I will need to create the RPM on CentOS.
But when I do so I get a weird: 'No such file or directory' that I don't get on Fedora27. Here is a sketch of my spec file:
%define _topdir %(pwd)
%define name my_rpm
%define release 5
%define version 0.0
%define buildroot %{_topdir}/%{name}-%{release}-root
BuildRoot: %{buildroot}
Summary: my_rpm
License: -
Name: %{name}
Release: %{release}
Version: %{version}
Source: %{name}-%{version}-%{release}.tar.gz
Prefix: /usr
Group: Tools
%description
This is my_rpm spec file
%prep
%setup -q -n %(arch)/%{name}-%{version}
%install
install -D my_app -t %{buildroot}/usr/bin/my_rpm/
%files
/usr/bin/my_rpm/*
When I try to build the RPM for it I get:
# rpmbuild -v -bb --clean SPECS/bpf.spec
+ install -D app -t /root/rpmbuild/BUILDROOT/my_rpm-0.0-5.x86_64/usr/bin/my_rpm/
install: failed to access '/root/rpmbuild/BUILDROOT/my_rpm-0.0-5.x86_64/usr/bin/my_rpm/': No such file or directory
The same SPEC exactly runs smoothly on Fedora27.
What should I change in it my spec file so that it would work both on Fedora27 and CentOS7? or maybe I can fix my initial problem with Glibc?
EDIT 1
I added the "mkdir -p ..." command under install and the build was successful but it still gives me the same error, that I need Glibc 2.6.
What I don't understand is why during the build it says:
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.26)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.7)(64bit) libc.so.6(GLIBC_2.9)(64bit) libelf.so.1()(64bit) libelf.so.1(ELFUTILS_1.0)(64bit) rtld(GNU_HASH)
Edit 2(solution)
I got it to work. My executables are compiled C code. So I had to re-compile everything on CentOS and then build the rpm. Now it works on both Fedora and CentOS.

Check_sql.pl DBD:ODBC Error - Nagios

New Issue:
I am trying to run my check_sql command and am running into this problem
./odbcinst -j
unixODBC 2.3.0
DRIVERS............: /usr/local/unixODBC/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/unixODBC/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/unixODBC/etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
[root#]# /usr/lib64/nagios/plugins/check_sql.pl -v -s -d "DBI:ODBC:Driver={SQL Server};Server=10.125.243.4;dbname=test" -U TEST -P PASS
Trying to connect. Connect string: 'DBI:ODBC:Driver={SQL Server};Server=10.125.243.4;dbname=test'
DBI connect('Driver={SQL Server};Server=10.125.243.4;dbname=test','TEST',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1) at /usr/lib64/nagios/plugins/check_sql.pl line 212
CHECK_SQL.PL CRITICAL - [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1)
[root#]# /usr/lib64/nagios/plugins/check_sql.pl -v -s -d "DBI:ODBC:Driver={ODBC Driver 11 for SQL Server};Server=10.125.243.4;dbname=test" -U TEST -P PASS
Trying to connect. Connect string: 'DBI:ODBC:Driver={ODBC Driver 11 for SQL Server};Server=10.125.243.4;dbname=test'
DBI connect('Driver={ODBC Driver 11 for SQL Server};Server=10.125.243.4;dbname=test','TEST',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1) at /usr/lib64/nagios/plugins/check_sql.pl line 212
CHECK_SQL.PL CRITICAL - [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1)
---------- FIXED --------- DOWNLOADED AND INSTALLED 1.48 WITH NO ERRORS
------ OLD ISSUE with 1.1X ODBC ----------
I am currently in the DBD-ODBC-1.13 directory
export LD_LIBRARY_PATH=/usr/lib:/usr/local/unixODBC
export ODBCHOME=/usr
export DBI_DSN=dbi:ODBC:JDBC
export DBI_USER=guest
export DBI_PASS=sybase
perl Makefile.PL
perl Makefile.PL
Useless use of private variable in void context at Makefile.PL line 431.
Argument "6.55_02" isn't numeric in numeric ge (>=) at Makefile.PL line 33.
Configuring DBD::ODBC ...
>>> Remember to actually *READ* the README file!
And re-read it if you have any problems.
Using DBI 1.609 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/auto/DBI/
Using ODBC in /usr/local/unixODBC
Umm, this looks like a unixodbc type of driver manager.
We expect to find the sql.h, sqlext.h and (which were
supplied with unixODBC) in $ODBCHOME/include directory alongside
the /usr/local/unixODBC/lib/libodbc.so library. in $ODBCHOME/lib
Use of uninitialized value in pattern match (m//) at Makefile.PL line 272.
Warning: LD_LIBRARY_PATH doesn't include /usr/local/unixODBC
Injecting selected odbc driver into cc command
Injecting selected odbc driver into cc command
Using DBI 1.609 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/auto/DBI/
Writing Makefile for DBD::ODBC
The DBD::ODBC tests will use these values for the database connection:
DBI_DSN=dbi:ODBC:JDBC e.g. dbi:ODBC:demo
DBI_USER=guest
DBI_PASS=sybase
Thanks in advance!
I had to properly setup my system for unixODBC to talk with FreeTDS:
I did this by configuring FreeTDS the following way: taken from http://www.unixodbc.org/doc/FreeTDS.html
./configure --with-tdsver=8.0 --prefix=/usr/local/freetds --with-unixodbc=/usr/local/unixODBC
make && make install
cd /usr/local/unixODBC/
mkdir templates && cd templates
vim tds.driver.template
[FreeTDS]
Description = v0.91 with protocol v8.0
Driver = /usr/local/freetds/lib/libtdsodbc.so
# Register ODBC Driver
../bin/odbcinst -i -d -f tds.driver.template
# Setup default DB - easily add or remove DSNs
vim tds.datasource.template
[ODBCTestServer]
Driver = FreeTDS
Description = Test
Trace = No
Server = 5.5.5.5
Port = 1433
Database = Test
# Create ODBC data source
../bin/odbcinst -i -d -f tds.datasource.template
/usr/lib64/nagios/plugins/check_sql.pl -v -s -d "DBI:ODBC:DRIVER={FreeTDS};Server=5.5.5.5;dbname=test" -U TEST -P PASS
This finally allows for connections to occur.

installing mongodb with pecl

this is what i get:
bitnami#ip-10-117-57-211:/bin$ sudo pecl install mongo
downloading mongo-1.4.0.tgz ...
Starting to download mongo-1.4.0.tgz (138,495 bytes)
..............................done: 138,495 bytes
84 source files, building
WARNING: php_bin /opt/bitnami/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Can't load '/opt/bitnami/perl/lib/5.8.8/i686-linux/auto/Data/Dumper/Dumper.so' for module Data::Dumper: /opt/bitnami/perl/lib/5.8.8/i686-linux/auto/Data/Dumper/Dumper.so: undefined symbol: PL_sv_undef at /opt/bitnami/perl/lib/5.8.8/i686-linux/XSLoader.pm line 70.
at /opt/bitnami/perl/lib/5.8.8/i686-linux/Data/Dumper.pm line 36
Compilation failed in require at /usr/share/autoconf/Autom4te/C4che.pm line 33.
BEGIN failed--compilation aborted at /usr/share/autoconf/Autom4te/C4che.pm line 33.
Compilation failed in require at /usr/bin/autom4te line 38.
BEGIN failed--compilation aborted at /usr/bin/autom4te line 38.
ERROR: `phpize' failed
Any ideas how to fix?
Try configuring manually as it seems bitnami is a bit funky:
$ sudo apt-get update
$ sudo apt-get install build-essential libtool autoconf unzip wget
Download the latest source code from the web page, uncompress it and compile the module.
$ wget http://pecl.php.net/get/mongo-1.4.3.tgz
$ tar -zxf mongo*
$ export PHP_AUTOCONF=/usr/bin/autoconf
$ export PHP_PREFIX=/opt/bitnami/php
$ cd mongo-*
$ /opt/bitnami/php/bin/phpize
$ ./configure
$ make
$ sudo make install
Adapted from: http://wiki.bitnami.com/Components/PHP#How_to_install_OAuth_module.3f
well i finally got it working. I ran through the steps to install mongo extension on mac server and it worked for my bitnami lamp stack.
The instructions were on this blog:
http://andres.jaimes.net/857/setup-php-mongo-on-mac/