Thread: "Undefined functions" pg_dlopen and pg_dlerror when compiling PG7.2.3 under Linux 2.0.?

"Undefined functions" pg_dlopen and pg_dlerror when compiling PG7.2.3 under Linux 2.0.?

From
"Brendan LeFebvre"
Date:
I am trying to build postgres 7.2.3 on the shared box provided by our
hosting service. The box is running a 2.0.x linux kernel, and the provided
make is GNU 3.74, gcc is 2.7.2.1.

Compilation dies thusly:

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations  -Wl,-rpath,/home/
jump
ingfrog/pg/lib -export-dynamic access/SUBSYS.o bootstrap/SUBSYS.o
catalog/SUBSYS
.o parser/SUBSYS.o commands/SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o
libpq/SUBSYS
.o main/SUBSYS.o nodes/SUBSYS.o optimizer/SUBSYS.o port/SUBSYS.o
postmaster/SUBS
YS.o regex/SUBSYS.o rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o
utils/SUBSYS
.o -lz -lm -lbsd -lreadline -ltermcap  -o postgres
utils/SUBSYS.o: In function `load_external_function':
utils/SUBSYS.o(.text+0x3a79d): undefined reference to `pg_dlopen'
utils/SUBSYS.o(.text+0x3a7ac): undefined reference to `pg_dlerror'
make[2]: *** [postgres] Error 1


I've scoured the list archives, and have found many similar errors but none
dealing with this particular function. I have read enough to suspect that
it's a library problem and that "dl" stands for "dynamic loader", but I
don't know how to determine exactly what is missing here.

Can anyone help me get a better idea of what is going on and how to fix it?

Thanks,
Brendan LeFebvre
brendanl@iname.com




"Brendan LeFebvre" <brendanl@iname.com> writes:
> I am trying to build postgres 7.2.3 on the shared box provided by our
> hosting service. The box is running a 2.0.x linux kernel, and the provided
> make is GNU 3.74, gcc is 2.7.2.1.

> Compilation dies thusly:

> utils/SUBSYS.o: In function `load_external_function':
> utils/SUBSYS.o(.text+0x3a79d): undefined reference to `pg_dlopen'
> utils/SUBSYS.o(.text+0x3a7ac): undefined reference to `pg_dlerror'

Hmm.  It looks to me like someone messed up the support for dynamic
loading on pre-HAVE_DLOPEN Linuxen.  Would you confirm that configure
did not define HAVE_DLOPEN in your src/include/pg_config.h file?

If you want to try to fix it yourself, the files to look at are
src/backend/port/dynloader/linux.h
src/backend/port/dynloader/linux.c
It looks to me like the "#ifdef NOT_USED" in the latter ought to be
"#ifndef HAVE_DLOPEN" instead.  But I'm unsure about the linux.h
file; surely it should have extern declarations for the functions
in linux.c?

            regards, tom lane

Tom,

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]

Hmm.  It looks to me like someone messed up the support for dynamic
loading on pre-HAVE_DLOPEN Linuxen.  Would you confirm that configure
did not define HAVE_DLOPEN in your src/include/pg_config.h file?
-----


A grep of pg_config.h for DLOPEN shows that its only instance is in a
comment line:
/* #undef HAVE_DLOPEN */


--------
If you want to try to fix it yourself, the files to look at are
src/backend/port/dynloader/linux.h
src/backend/port/dynloader/linux.c
It looks to me like the "#ifdef NOT_USED" in the latter ought to be
"#ifndef HAVE_DLOPEN" instead.  But I'm unsure about the linux.h
file; surely it should have extern declarations for the functions
in linux.c?

            regards, tom lane
------------

linux.h has no externs.

I changed #ifdef NOT_USED to #ifndef HAVE_DLOPEN in linux.c, and make'd
again....
"All of PostgreSQL successfully made. Ready to install."

Thanks, Tom!

Brendan LeFebvre
brendanl@iname.com