Re: collect2: error: ld returned 1 exit status

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: William Torrez Corea <willitc9888(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, Rob Sargent <robjsargent(at)gmail(dot)com>
Subject: Re: collect2: error: ld returned 1 exit status
Date: 2022-11-26 23:46:21
Message-ID: 233831.1669506381@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

William Torrez Corea <willitc9888(at)gmail(dot)com> writes:
> On Sat, Nov 26, 2022 at 5:00 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>> On Nov 26, 2022, at 3:43 PM, William Torrez Corea <willitc9888(at)gmail(dot)com>
>> wrote:
>>> Compile the code:
>>> *sudo cc -o testprog testprog1.o testprog2.o -L/usr/local/pgsql/lib -lpq*
>>> But i get the following error:
>>> *collect2: error: ld returned 1 exit status*

The useful info would be in the lines right before that one. That
one just tells you that cc is giving up because of prior errors.

>> And do you have at hand why the loader (ld) failed?

> Package libpq was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libpq.pc'
> to the PKG_CONFIG_PATH environment variable

I do not believe that a bare cc invocation would produce any
complaints about pkg-config. Are you showing us something
unrelated to the stated command?

BTW, it's pretty hard to believe that you need to use sudo
for this.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message William Torrez Corea 2022-11-27 00:51:59 Re: collect2: error: ld returned 1 exit status
Previous Message Rob Sargent 2022-11-26 23:24:55 Re: collect2: error: ld returned 1 exit status