PostgreSQL - Missing libraries

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
marcotcal
Level 1
Level 1
Posts: 5
Joined: Sun Jun 20, 2021 3:37 pm

PostgreSQL - Missing libraries

Post by marcotcal »

It seems there are some missing PostgreSQL 12 libraries on Mint 20.1

The command:

Code: Select all

pg_config --libs
returns:

Code: Select all

-lpgcommon -lpgport -lpthread -lselinux -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lrt -lcrypt -ldl -lm
but I can't find some of these libraries like libpgcommon, libpgport, libz etc...

There is no .so file only static libraries .a

Am I doing something wrong ? It is breakng the compilation of a program that depends on PostgreSQL libpq



Thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: PostgreSQL - Missing libraries

Post by rene »

libpgcommon and libpgport seem to be only relevant to PostgreSQL extensions but as to e.g. libz: didn't you just not install zlib1g-dev?
marcotcal
Level 1
Level 1
Posts: 5
Joined: Sun Jun 20, 2021 3:37 pm

Re: PostgreSQL - Missing libraries

Post by marcotcal »

Hi,

thanks for your response, but zlib1g-dev is already installed and it continues not working.

I also remove everything related to PostgreSQL and installed again

I am getting this error when compiling:

/usr/bin/ld: cannot find -lpgcommon
/usr/bin/ld: cannot find -lpgport
/usr/bin/ld: cannot find -lxslt
/usr/bin/ld: cannot find -lgssapi_krb5

I tried to find these libraries without success.
User avatar
paddys-hill
Level 1
Level 1
Posts: 34
Joined: Mon Jun 14, 2021 5:07 pm
Location: All over the Adelaide Hills and Fleurio region of South Australia

Re: PostgreSQL - Missing libraries

Post by paddys-hill »

Have you installed both the server and the client postgresql packages?
Have you installed the header packages for both server and client?
Paddys-Hill Co-op co-ordinator & sysadmin
Acer Aspire A315-21G (AMD A9-9420 RADEON R5) running 5.11.0-22-generic
Distro: Linux Mint 20.1 Ulyssa DE:Cinnamon 4.8.6 WM: muffin 4.8.1 DM: LightDM 1.30.0
marcotcal
Level 1
Level 1
Posts: 5
Joined: Sun Jun 20, 2021 3:37 pm

Re: PostgreSQL - Missing libraries

Post by marcotcal »

I installed all postgresql packages

It was working on Mint 20.0 and now it seems the library is missing

For example:
From PostgreSQL docs libpgcommon is a static library to allow sharing code between frontend core utilities and the backend.
libpgcommon was added in PostgreSQL 9.3.

I installed Ubuntu in another machine and I got the same error.

It is working fine with Open SuSe Leap the latest version with the same PostgreSQL version.
djph
Level 7
Level 7
Posts: 1882
Joined: Thu Jun 27, 2019 5:43 am
Location: ::1

Re: PostgreSQL - Missing libraries

Post by djph »

That's kinda weird -- I wouldn't expect to be seeing these kind of errors unless you're trying to compile from source ...
marcotcal
Level 1
Level 1
Posts: 5
Joined: Sun Jun 20, 2021 3:37 pm

Re: PostgreSQL - Missing libraries

Post by marcotcal »

I use the command pg_config --libs to get the necessary libs to compile my application

I create the flags based on this command on a Makefile to compile my application.

The command should not return a non-existent library on the list.

Of coarse I can indicate the libraries hard coding but this command exists for these purpose.

As I said I had no issues on Open Suse but I am having the this problem on Mint and Ubuntu.
djph
Level 7
Level 7
Posts: 1882
Joined: Thu Jun 27, 2019 5:43 am
Location: ::1

Re: PostgreSQL - Missing libraries

Post by djph »

Okay, so "compiling from source" is its own ball of fun, and you will have to check the requirements for said source code against what's available in LM.

Could be as simple as missing pg_something-dev ... or build-essential ... or ...
User avatar
JoeFootball
Level 13
Level 13
Posts: 4674
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: PostgreSQL - Missing libraries

Post by JoeFootball »

marcotcal
Level 1
Level 1
Posts: 5
Joined: Sun Jun 20, 2021 3:37 pm

Re: PostgreSQL - Missing libraries

Post by marcotcal »

I did not compile PostgreSQL from source.

It seems to be problem with PostgreSQL 13 because although the lib is returned by the pg_config tool it doesn't exists unless you compile PostgreSQL from source.

I will check at the PostgreSQL forums hard code my Makefile until the libraries are added. or simple use only --libdir to get the libraries location

according to the same command:

pg_config --libdir
/usr/lib/x86_64-linux-gnu


I thought libpgcommon shoud exists on /usr/lib/x86_64-linux-gnu

Anyway, thanks for your time.
User avatar
paddys-hill
Level 1
Level 1
Posts: 34
Joined: Mon Jun 14, 2021 5:07 pm
Location: All over the Adelaide Hills and Fleurio region of South Australia

Re: PostgreSQL - Missing libraries

Post by paddys-hill »

pg_config --libs returns the libraries that postgres itself was compiled using.
You want pg_config --includedir

Code: Select all

pg_config --includedir
<xxx>/include
and thenyou can check by using ls -l <xxx>/include

Code: Select all

ll <xxx>/include/
total 168
drwxr-xr-x 4 root root  4096 Jun 20 12:58 ./
drwxr-xr-x 6 root root  4096 Jun 20 12:58 ../
-rw-r--r-- 1 root root   656 Jun 20 12:58 ecpg_config.h
-rw-r--r-- 1 root root  2544 Jun 20 12:58 ecpgerrno.h
-rw-r--r-- 1 root root  2803 Jun 20 12:58 ecpg_informix.h
-rw-r--r-- 1 root root  2681 Jun 20 12:58 ecpglib.h
-rw-r--r-- 1 root root  2709 Jun 20 12:58 ecpgtype.h
drwxr-xr-x 2 root root  4096 Jun 20 12:58 libpq/
-rw-r--r-- 1 root root  2214 Jun 20 12:58 libpq-events.h
-rw-r--r-- 1 root root 23338 Jun 20 12:58 libpq-fe.h
-rw-r--r-- 1 root root   323 Jun 20 12:58 pg_config_ext.h
-rw-r--r-- 1 root root 30853 Jun 20 12:58 pg_config.h
-rw-r--r-- 1 root root 13005 Jun 20 12:58 pg_config_manual.h
-rw-r--r-- 1 root root  1052 Jun 20 12:58 pg_config_os.h
-rw-r--r-- 1 root root   797 Jun 20 12:58 pgtypes_date.h
-rw-r--r-- 1 root root   530 Jun 20 12:58 pgtypes_error.h
-rw-r--r-- 1 root root   222 Jun 20 12:58 pgtypes.h
-rw-r--r-- 1 root root  1032 Jun 20 12:58 pgtypes_interval.h
-rw-r--r-- 1 root root  2251 Jun 20 12:58 pgtypes_numeric.h
-rw-r--r-- 1 root root   945 Jun 20 12:58 pgtypes_timestamp.h
-rw-r--r-- 1 root root  2239 Jun 20 12:58 postgres_ext.h
drwxr-xr-x 5 root root  4096 Jun 20 12:58 postgresql/
-rw-r--r-- 1 root root   838 Jun 20 12:58 sql3types.h
-rw-r--r-- 1 root root  1283 Jun 20 12:58 sqlca.h
-rw-r--r-- 1 root root  1575 Jun 20 12:58 sqlda-compat.h
-rw-r--r-- 1 root root   321 Jun 20 12:58 sqlda.h
-rw-r--r-- 1 root root   824 Jun 20 12:58 sqlda-native.h
Paddys-Hill Co-op co-ordinator & sysadmin
Acer Aspire A315-21G (AMD A9-9420 RADEON R5) running 5.11.0-22-generic
Distro: Linux Mint 20.1 Ulyssa DE:Cinnamon 4.8.6 WM: muffin 4.8.1 DM: LightDM 1.30.0
Locked

Return to “Programming & Development”