Error when installing pg_partman and pg_squeeze with postgres 12 on ubuntu 18

944 Views Asked by At

I have a dedicated server (ubuntu 18) for database, which has postgres 10,11 and 12 installed. I am currently using postgres 12. I am trying to install pg_partman and pg_squeeze extension on postgres 12.

I have downloaded the git repo in /etc/pg_parman. When i run the command "sudo make" i get the below error.

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/pg_partman_bgw.o src/pg_partman_bgw.c
src/pg_partman_bgw.c:10:10: fatal error: postgres.h: No such file or directory
 #include "postgres.h"
          ^~~~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'src/pg_partman_bgw.o' failed
make: *** [src/pg_partman_bgw.o] Error 1

After some searching i found that postgresql-server-dev-12 is required, however when i try to install this package i get errors.

> sudo apt install postgresql-server-dev-12

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 postgresql-server-dev-12 : Depends: clang-6.0 but it is not installable
                            Depends: llvm-6.0-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

I have also changed from "softwares and update" to download from "main server". I have read that if i uninstall all postgres packages and then install them again, then i might be able to download postgresql-server-dev-12. But i dont want to uninstall postgres 12 as it might also delete the database, which is more than 100GB in size.

I see that many users are having this problem. Any help in this regard would be appreciated. Thanks

1

There are 1 best solutions below

1
On

So after struggling with this problem for a long time, i finally found the solution. This is actually related to linux not properly being updated. My apt-update was giving error therefore i had to clean it first.

sudo apt-get clean
sudo mv /var/lib/apt/lists /tmp
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update

// Then try to install postgres-server-dev-12 again
sudo apt-get install postgresql-server-dev-12