Re: /usr/bin/ld: cannot find -lpq

From: Tena Sakai <tsakai(at)gallo(dot)ucsf(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: /usr/bin/ld: cannot find -lpq
Date: 2009-12-04 07:14:27
Message-ID: C73DF6D3.916D%tsakai@gallo.ucsf.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Tom,

Thank you so much for your insight.
I didn't mean to lie to you, but unintentionally I omitted a thing
or two. When I compiled it first time, it complained as to libpq-fe.h
was missing. I thought it was hidden somewhere and in a rush I
just copied it into the current directory (where the source code is)
and recompiled. It went on to complain about another include file
which I again supplied to the same place and when I compiled it
the third time it gave me the error I reported.

So, it seems that what I have to do is to rebuild/reinstall postgres
with postgresql-devel. Is this an option to configure on the top-level
directory? Can you please tell me how I include it?

Thank you.

Regards,

Tena Sakai
tsakai(at)gallo(dot)ucsf(dot)edu

On 12/3/09 10:21 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

Tena Sakai <tsakai(at)gallo(dot)ucsf(dot)edu> writes:
> ... I just tried recompiling it on that machine and it compiles without a
> complaint. I now need to re-compile it on a Intel 32-bit machine running
> centOS. When I issue the same command on the centOS machine, I get
> complaint:
> /usr/bin/ld: cannot find -lpq
> collect2: ld returned 1 exit status

> I thought that this meant that the shared library named libpq.so.bla
> is missing. But to my surprise, I find libpq.so.4.1 in /usr/lib
> directory. (There is also a symbolic link libpq.so.4 pointing at
> libpq.so.4.1 in the same place.)

What you need to build a program relying on a shared library is
libfoo.so --- not libfoo.so.n, which is what is used at runtime.
Normally, libfoo.so is a symlink provided by the -devel package
for the library. In short, then, your problem is that you don't
have postgresql-devel installed. What seems odd is that you got
this far, because postgresql-devel also carries the header files
you need for compiling callers of libpq (ie, /usr/include/libpq-fe.h).
I'd have expected a failure mentioning lack of libpq-fe.h. Seems
like you must have some sort of broken partial installation on
that machine.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tena Sakai 2009-12-04 08:49:06 Re: /usr/bin/ld: cannot find -lpq
Previous Message Tena Sakai 2009-12-04 06:23:56 Re: /usr/bin/ld: cannot find -lpq