Thread: Procedural Language module loading on Solaris/GCC

Procedural Language module loading on Solaris/GCC

From
Ross Johnson
Date:
Hi,

I've built 7.0.2 on Solaris 7 using GCC 2.95.2. All seems to be ok
except the procedural language module isn't loading. I've tried
the examples in chapter 12 of the programmer's reference.

I get identical errors in the output file test.out
when I run "runtest" in postgresql-7.0.2/src/pl/plpgsql/test .

...
insert into Room values ('105', 'Office');
insert into Room values ('106', 'Office');
insert into WSlot values ('WS.001.1a', '001', '', '');
psql:test.sql:18: ERROR:  Load of file
/usr/local/postgresql/lib/plpgsql.so failed: ld.so.1:
/usr/local/postgresql/bin/postmaster: fatal: relocation error: file
/usr/local/postgresql/lib/plpgsql.so: symbol CurrentMemoryContext:
referenced symbol not found
insert into WSlot values ('WS.001.1b', '001', '', '');
psql:test.sql:19: ERROR:  Load of file
/usr/local/postgresql/lib/plpgsql.so failed: ld.so.1:
/usr/local/postgresql/bin/postmaster: fatal: relocation error: file
/usr/local/postgresql/lib/plpgsql.so: symbol CurrentMemoryContext:
referenced symbol not found
...

etc etc

The symbol CurrentMemoryContext is defined in the postmaster backend ok:

> nm postmaster | grep CurrentMemoryContext
[4173]  |   2224660|       4|OBJT |GLOB |0    |14
|CurrentMemoryContext

The only other clue I have on this is that the gcc install readme
suggests using the Sun ld because the GNU ld has some obscure problem
on Solaris. The build used Sun's ld.

I also tried building with Sun's C compiler but I get alot of errors
and have not succeeded in building the package yet using it.
I'll post something about that as a separate message.

Any ideas?

Thanks
Ross

--
+----------------------+---+
| Ross Johnson         |   | E-Mail: rpj@ise.canberra.edu.au
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:    http://willow.canberra.edu.au/~rpj/
| AUSTRALIA                |
+--------------------------+

Re: Procedural Language module loading on Solaris/GCC

From
Urban Widmark
Date:
On Thu, 20 Jul 2000, Ross Johnson wrote:

> I've built 7.0.2 on Solaris 7 using GCC 2.95.2. All seems to be ok
> except the procedural language module isn't loading. I've tried
[snip]
> psql:test.sql:18: ERROR:  Load of file
> /usr/local/postgresql/lib/plpgsql.so failed: ld.so.1:
> /usr/local/postgresql/bin/postmaster: fatal: relocation error: file
> /usr/local/postgresql/lib/plpgsql.so: symbol CurrentMemoryContext:
> referenced symbol not found

Welcome to the club ... :)

> The only other clue I have on this is that the gcc install readme
> suggests using the Sun ld because the GNU ld has some obscure problem
> on Solaris. The build used Sun's ld.

ld from GNU binutils will most likely not make you happier.

You could try the patch below from Carlos Villegas and see if that helps.
It didn't for me (Solaris 2.5.1) so I'm very interested to hear if it
works for you.

/Urban

diff -c -r postgresql-7.0.2/src/backend/port/dynloader/solaris_sparc.h
postgresql-7.0.2-sol26/src/backend/port/dynloader/solaris_sparc.h
*** postgresql-7.0.2/src/backend/port/dynloader/solaris_sparc.h    Wed Jan 26 14:56:44 2000
--- postgresql-7.0.2-sol26/src/backend/port/dynloader/solaris_sparc.h Wed Jul 19 00:01:39 2000
***************
*** 31,37 ****
   * library as the file to be dynamically loaded.
   *
   */
! #define pg_dlopen(f)    dlopen(f,1)
  #define pg_dlsym        dlsym
  #define pg_dlclose        dlclose
  #define pg_dlerror        dlerror
--- 31,37 ----
   * library as the file to be dynamically loaded.
   *
   */
! #define pg_dlopen(f)    dlopen(f,1|RTLD_PARENT)
  #define pg_dlsym        dlsym
  #define pg_dlclose        dlclose
  #define pg_dlerror        dlerror