vibhorkum / pg_background

pg_background
GNU General Public License v3.0
136 stars 35 forks source link

ERROR: could not access file "$libdir/pg_background": No such file or directory #44

Closed tayalarun1 closed 1 year ago

tayalarun1 commented 1 year ago

I have installed PostgreSQL 15.1 on RHEL 9, which got installed /usr/pgsql-15/ When I install pg_background & then "CREATE EXTENSION pg_background;", I get error message "ERROR: could not access file "$libdir/pg_background": No such file or directory"

I think pg_background has got installed in "/usr/share/pgsql" folder where as the PostgreSQL installation is in "/usr/pgsql-15/".

Any help to resolve this error would be appreciated.

vibhorkum commented 1 year ago

make install should install it in the /usr/pgsql-15/lib directory. Please check if you have the correct pg_config in your path.

tayalarun1 commented 1 year ago

Thanks Vibhorkum for your reply. I have only one version of PostgreSQL on this box (RHEL 9) which is PostgreSQL15. Here are some outputs for your considerations: $ sudo find / -name pg_config -print /usr/bin/pg_config /usr/pgsql-15/bin/pg_config

$ echo $PATH /local/bin:/home/zadmin/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/pgsql-15/bin

$ ls -ltr /usr/bin/pg_config lrwxrwxrwx. 1 root root 16 May 20 2022 /usr/bin/pg_config -> pg_server_config

Now I have deleted soft link file "/usr/bin/pg_config" & tried make & make install (from my pg_background folder) but gives me error:

$ sudo make make: pg_config: No such file or directory make: *** No targets. Stop.

$ sudo make install make: pg_config: No such file or directory make: *** No rule to make target 'install'. Stop.

Can you help me with steps to uninstall pg_background completely & load it fresh.

Thanks Arun

vibhorkum commented 1 year ago

You can execute the following commands:

make distclean
export PATH=/usr/pgsql-15/bin:$PATH
make install
tayalarun1 commented 1 year ago

Thanks Vibhortum for your help. While I do "make install" I see error & files getting copied to wrong folder even when I have exported PATH variable as you suggested.

[zadmin@CRIS-POSTGRESQL-SRV01 pg_background]$ sudo make install gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I. -I./ -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o pg_background.o pg_background.c pg_background.c: In function ‘pg_background_process_result’: pg_background.c:586:69: warning: ‘tupdesc’ may be used uninitialized in this function [-Wmaybe-uninitialized] 586 | if (tupdesc->natts != 1 || TupleDescAttr(tupdesc, 0)->atttypid != TEXTOID) In file included from pg_background.c:24: /usr/include/pgsql/server/funcapi.h:302:38: warning: ‘funcctx’ may be used uninitialized in this function [-Wmaybe-uninitialized] 302 | (_funcctx)->call_cntr++; \ | ^~ pg_background.c:312:26: note: ‘funcctx’ was declared here 312 | FuncCallContext *funcctx; | ^~~ gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -shared -o pg_background.so pg_background.o -L/usr/lib64 -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--as-needed /usr/bin/mkdir -p '/usr/lib64/pgsql' /usr/bin/mkdir -p '/usr/share/pgsql/extension' /usr/bin/mkdir -p '/usr/share/pgsql/extension' /usr/bin/install -c -m 755 pg_background.so '/usr/lib64/pgsql/pg_background.so' /usr/bin/install -c -m 644 .//pg_background.control '/usr/share/pgsql/extension/' /usr/bin/install -c -m 644 .//pg_background--1.0.sql .//pg_background--1.0--1.1.sql .//pg_background--1.1.sql '/usr/share/pgsql/extension/'

You can see files are being copied to '/usr/lib64/pgsql' & '/usr/share/pgsql/extension' folders.

Any suggestion.

Thanks again Arun

vibhorkum commented 1 year ago

Something is off in your environment. Can you share the output of the following commands:

export PATH=/usr/pgsql-15/bin:$PATH
which pg_config
pg_config 
tayalarun1 commented 1 year ago

Thanks Vibhorkum for all your help & time

Here was the issue (putting it here so anyone latter reads can find solution) 1) ccache was not there on my machine & make was looking for ccache. I used (yum install ccache) to install ccache. 2) On my machine, I have 2 PostgreSQL (13.7 & 15.1). I removed the /usr/bin/pg_config of 13.7 which was a soft link & created fresh soft link to pg_config of 15.1. Now everything worked.

Thanks again.