Subject: link failure

From: M92 <[email-masked]>
Date: Wed, 14 Jul 93 05:00:20 -0700

In a dynamically loaded c function I using the LO* commands. The code includes
the files :

#include <sys/file.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "utils/palloc.h"
#include "utils/builtins.h"
#include "tmp/postgres.h"
#include "tmp/libpq-fs.h"
#include "tmp/libpq-fe.h"
#include "catalog/pg_lobj.h"

and a successfully compile with the command line :

cc -c -I/usr/postgres/Release-4.1/include
-I/usr/postgres/Release-4.1/include/port/sparc 
-I/usr/postgres/Release-4.1/src/backend/obj
-I/usr/postgres/Release-4.1/src/backend filename.c 
/usr/postgres/Release-4.1/lib/libpq.a

Howevwer when I attempt to load object file into postgres a warning about a link
failure is rerturned :

WARN:Jul 14 12:58:26:Load of file /home/t84/M92/cc/hamiltop/postgres/project/database/inv/filename.o failed: link failed!

Can anybody help ?

Thanks, Paul.

---

From: "Andrew K. Yu" <[email-masked]>
Date: Wed, 14 Jul 93 08:35:58 -0700

> In a dynamically loaded c function I using the LO* commands. The code includes
...
>	/usr/postgres/Release-4.1/lib/libpq.a

If you compile successfully, you should have the right include files. One
little reminder, you don't need to link in any libraries when you compile
with "cc -c". In this case, libpq.a will not be looked at.

> WARN:Jul 14 12:58:26:Load of file /home/t84/M92/cc/hamiltop/postgres/project/database/inv/filename.o failed: link failed!
	
In general, it's hard to tell what happens. It can be anything from 
multiply defined symbols to /tmp full.

To find out what happens, you can do the following outside of postgres:

ld -x -N -A `which postgres` filename.o -lm_G0 -lc_G0

ld should give you a more intelligent message.
	
good luck!

- andrew

---

From: Mike Olson <[email-masked]>
Date: Wed, 14 Jul 1993 11:13:25 -0700

> /usr/postgres/Release-4.1/lib/libpq.a

you can't like libpq.a with your dynamically-loaded code.

> Howevwer when I attempt to load object file into postgres a warning about a l
  +ink
> failure is rerturned :
> 
> WARN:Jul 14 12:58:26:Load of file /home/t84/M92/cc/hamiltop/postgres/project/
  +database/inv/filename.o failed: link failed!

take out libpq.a.  also, be sure that user postgres has permission to
search the path all the way to .../inv, and read permission on filename.o.

					mike