pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Linking problems
5+ messages / 5 participants
[nested] [flat]

* Linking problems
@ 1998-11-20 21:35  Randy Barrett <rbarr@shadow.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Randy Barrett @ 1998-11-20 21:35 UTC (permalink / raw)
  To: pgsql-interfaces

I wrote a trivial (so I didn't include, but I will if I must...) C
program using the libpq C interface which compiles cleanly.  My problem
is with the linker.  There are two files,  one contains (tested) code
for a standard set of cgi functions and the other contains code that
calls the db.  Here's the gcc command I'm using:

gcc login.c stdcgi.c  -I /usr/local/pgsql/include/ -L
/usr/local/pgsql/lib/ -lpq

And here's the error I'm getting:

/usr/local/pgsql/lib//libpq.a(fe-auth.o): In function
`pg_password_sendauth':
fe-auth.o(.text+0x17): undefined reference to `crypt'

I haven't dug through the postgreSQL code and perhaps I haven't read the
user manual thoroughly enough, but I'm not making any calls to
"pg_password_sendauth", so I'm confused with this error message.

Any help would be appreciated.

    Randy Barrett
    rbarr@shadow.net




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Linking problems
@ 2000-01-20 12:14  blackw@sfu.ca
  0 siblings, 0 replies; 5+ messages in thread

From: blackw@sfu.ca @ 2000-01-20 12:14 UTC (permalink / raw)
  To: pgsql-interfaces

Hi,

I seem to have a problem with my libpq++ library.  I wrote a QnD test program that simply connects and disconnects from Postgres.  When I compile it, I get the following error messages:

--------------------
gcc  -o testsql testsql.o -lm -lstdc++ -lpq++
/usr/lib/libpq++.so: undefined reference to `clone__Q2t12basic_string3ZcZt18stri
ng_char_traits1ZcZt24__default_alloc_template2b1i03Rep'
/usr/lib/libpq++.so: undefined reference to `__dl__Q2t12basic_string3ZcZt18strin
g_char_traits1ZcZt24__default_alloc_template2b1i03RepPv'
/usr/lib/libpq++.so: undefined reference to `__eh_pc'
collect2: ld returned 1 exit status
make: *** [testsql] Error 1
--------------------

Here's the environment:
RH 6.1 (i386) (upgraded from 5.2)
egcs 1.1.2-24
libstdc++-2.9.0-24
postgresql-6.5.3-1.i386.rpm

I am guessing that there may be some library mix-up going on here, or I'm omitting a required library.

Alternatively, should I be using the postgresql-6.5.2 release that comes with RH6.1?  (I had installed 6.5.3-1 when I was running RH5.2.)

Any insight would be appreciated.  Thank-you in advance.

Cheers,
Richard





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: [INTERFACES] Linking problems
@ 2000-01-21 07:14  Ansley, Michael <Michael.Ansley@intec.co.za>
  0 siblings, 1 reply; 5+ messages in thread

From: Ansley, Michael @ 2000-01-21 07:14 UTC (permalink / raw)
  To: 'blackw@sfu.ca' <blackw@sfu.ca>; pgsql-interfaces

You need to link to libpq as well (-lpq), so this line:
gcc  -o testsql testsql.o -lm -lstdc++ -lpq++

should look like this:
gcc  -o testsql testsql.o -lm -lstdc++ -lpq++ -lpq

Is this on the FAQ somewhere, because I've seen a couple of people asking
about this?


MikeA


>> -----Original Message-----
>> From: blackw@sfu.ca [mailto:blackw@sfu.ca]
>> Sent: Thursday, January 20, 2000 10:14 PM
>> To: pgsql-interfaces@postgreSQL.org
>> Subject: [INTERFACES] Linking problems
>> 
>> 
>> Hi,
>> 
>> I seem to have a problem with my libpq++ library.  I wrote a 
>> QnD test program that simply connects and disconnects from 
>> Postgres.  When I compile it, I get the following error messages:
>> 
>> --------------------
>> gcc  -o testsql testsql.o -lm -lstdc++ -lpq++
>> /usr/lib/libpq++.so: undefined reference to 
>> `clone__Q2t12basic_string3ZcZt18stri
>> ng_char_traits1ZcZt24__default_alloc_template2b1i03Rep'
>> /usr/lib/libpq++.so: undefined reference to 
>> `__dl__Q2t12basic_string3ZcZt18strin
>> g_char_traits1ZcZt24__default_alloc_template2b1i03RepPv'
>> /usr/lib/libpq++.so: undefined reference to `__eh_pc'
>> collect2: ld returned 1 exit status
>> make: *** [testsql] Error 1
>> --------------------
>> 
>> Here's the environment:
>> RH 6.1 (i386) (upgraded from 5.2)
>> egcs 1.1.2-24
>> libstdc++-2.9.0-24
>> postgresql-6.5.3-1.i386.rpm
>> 
>> I am guessing that there may be some library mix-up going on 
>> here, or I'm omitting a required library.
>> 
>> Alternatively, should I be using the postgresql-6.5.2 
>> release that comes with RH6.1?  (I had installed 6.5.3-1 
>> when I was running RH5.2.)
>> 
>> Any insight would be appreciated.  Thank-you in advance.
>> 
>> Cheers,
>> Richard
>> 
>> 
>> 
>> ************
>> 



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [INTERFACES] Linking problems
@ 2000-01-21 16:35  Richard <blackw@sfu.ca>
  parent: Ansley, Michael <Michael.Ansley@intec.co.za>
  0 siblings, 1 reply; 5+ messages in thread

From: Richard @ 2000-01-21 16:35 UTC (permalink / raw)
  To: pgsql-interfaces

Thank-you, Mike.  Before posting, I did do some searches on various
pgsql mail lists and rummaged through the docs, but I didn't find any
mention of this.  Not to say it isn't there.  But if it is, it isn't
very obvious.  I'd have expected it to be in the "libpq C++ Binding"
section of the Programmer docs.  It isn't.

Last night in I downgraded to 6.5.2, and my test app linked fine WITHOUT
the -lpq option!  Is that link option requirement specific to 6.5.3?

Cheers,
Richard


"Ansley, Michael" wrote:
> 
> You need to link to libpq as well (-lpq), so this line:
> gcc  -o testsql testsql.o -lm -lstdc++ -lpq++
> 
> should look like this:
> gcc  -o testsql testsql.o -lm -lstdc++ -lpq++ -lpq
> 
> Is this on the FAQ somewhere, because I've seen a couple of people asking
> about this?
>



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [INTERFACES] Linking problems
@ 2000-01-21 16:51  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Richard <blackw@sfu.ca>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2000-01-21 16:51 UTC (permalink / raw)
  To: blackw@sfu.ca; +Cc: pgsql-interfaces

Richard <blackw@sfu.ca> writes:
> Last night in I downgraded to 6.5.2, and my test app linked fine WITHOUT
> the -lpq option!  Is that link option requirement specific to 6.5.3?

Hard to believe that 6.5.2 and 6.5.3 are any different here.  More
likely there is some configuration difference on your platform.
Shared libraries are handled weirdly on many Unixen --- the loader
may be configured to look automatically in some directories, for
example.  If you have "ldconfig" on your system, check its config file.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2000-01-21 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-11-20 21:35 Linking problems Randy Barrett <rbarr@shadow.net>
2000-01-20 12:14 Linking problems blackw@sfu.ca
2000-01-21 07:14 RE: [INTERFACES] Linking problems Ansley, Michael <Michael.Ansley@intec.co.za>
2000-01-21 16:35 ` Richard <blackw@sfu.ca>
2000-01-21 16:51   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox