Thread: Load fails

Load fails

From
Brandon Ibach
Date:
Greetings...
   I have a couple of custom functions (written in C) which used to
work just fine.  However, I recently relinked them, and now I get a
failure whenever I try to use them:

ERROR:  Load of file /home/postgres/lib/vcic.so failed:
 /home/postgres/lib/vcic.so: undefined symbol: palloc

   I've tried both of the following commands to link:
    gcc -shared -o vcic.so vcic.o
    ld -G -Bdynamic -o vcic.so vcic.o
having compiled with:
    gcc -fPIC -c -o vcic.o vcic.c

   This doesn't make sense to me, because palloc should be part of the
server binary, right?  So why can't the dynamic loader resolve it?
   This is on a Linux 2.0.34 system with glibc-2.1.2 (a recent
upgrade, could this be causing the problem, now that I've relinked?)
and PostgreSQL 6.5.2 compiled (as were my functions, both times) by
gcc 2.7.2.3.
   Thanks in advance for any ideas...

-Brandon :)

Re: Load fails

From
Tom Lane
Date:
Brandon Ibach <bibach@infomansol.com> writes:
> ERROR:  Load of file /home/postgres/lib/vcic.so failed:
>  /home/postgres/lib/vcic.so: undefined symbol: palloc

palloc() has been a macro for a long time.  Could you be
compiling against some extremely obsolete header files that
declare it as a plain function?

            regards, tom lane

Re: Load fails

From
Brandon Ibach
Date:
Quoting Tom Lane <tgl@sss.pgh.pa.us>:
> Brandon Ibach <bibach@infomansol.com> writes:
> > ERROR:  Load of file /home/postgres/lib/vcic.so failed:
> >  /home/postgres/lib/vcic.so: undefined symbol: palloc
>
> palloc() has been a macro for a long time.  Could you be
> compiling against some extremely obsolete header files that
> declare it as a plain function?
>
   Right on target.  Turns out the previous administrator of this
machine attempted to install an old version of Postgres (before I took
over and put on a newer one), and apparently decided it would be best
for the include files to reside directly in /usr/include.  Thus, my
compilations were using that old postgres.h, leading to the problem.
   Thanks! :)

-Brandon :)