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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tena Sakai <tsakai(at)gallo(dot)ucsf(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: /usr/bin/ld: cannot find -lpq
Date: 2009-12-04 13:18:00
Message-ID: 20091204131800.GC4705@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Tena Sakai wrote:
> Hi Tom,
>
> Please ignore what I wrote before. I got it. I mean I got it compiled
> successfully on the centOS machine. I was stupid and blind. In order
> to compile, I created an alias for cc with long string for include and
> lib directories. Which was not a bad idea, but I had a typo in my
> alias. Therefore it didn't find the libpq-fe.h file and I screwed that
> up even worse by supplying desired files in the current directory
> from the other machine. I corrected the alias, removed the header
> files in the source directory, and then compilation went smoothly and
> I can now test the program.

FWIW you should always prefer pg_config to help you get the right
compile flags; something like

gcc -I`pg_config --includedir` -L`pg_config --libdir` -lpq ...

That gets you the right include and lib dirs.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Julius Tuskenis 2009-12-04 13:39:48 estimating size of query result
Previous Message Tena Sakai 2009-12-04 08:49:06 Re: /usr/bin/ld: cannot find -lpq