collect2: error: ld returned 1 exit status

Started by William Torrez Coreaover 3 years ago8 messagesgeneral
Jump to latest
#1William Torrez Corea
willitc9888@gmail.com

I am using libpq: the C application programmer's interface to PostgreSQL.

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*

--

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

#2Rob Sargent
robjsargent@gmail.com
In reply to: William Torrez Corea (#1)
Re: collect2: error: ld returned 1 exit status

On Nov 26, 2022, at 3:43 PM, William Torrez Corea <willitc9888@gmail.com> wrote:


I am using libpq: the C application programmer's interface to PostgreSQL.

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

--

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

Show quoted text
#3William Torrez Corea
willitc9888@gmail.com
In reply to: Rob Sargent (#2)
Re: collect2: error: ld returned 1 exit status

On Sat, Nov 26, 2022 at 5:00 PM Rob Sargent <robjsargent@gmail.com> wrote:

On Nov 26, 2022, at 3:43 PM, William Torrez Corea <willitc9888@gmail.com>
wrote:


I am using libpq: the C application programmer's interface to PostgreSQL.

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*

--

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
No package 'libpq' found

--

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

#4Rob Sargent
robjsargent@gmail.com
In reply to: William Torrez Corea (#3)
Re: collect2: error: ld returned 1 exit status
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: William Torrez Corea (#3)
Re: collect2: error: ld returned 1 exit status

William Torrez Corea <willitc9888@gmail.com> writes:

On Sat, Nov 26, 2022 at 5:00 PM Rob Sargent <robjsargent@gmail.com> wrote:

On Nov 26, 2022, at 3:43 PM, William Torrez Corea <willitc9888@gmail.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

#6William Torrez Corea
willitc9888@gmail.com
In reply to: Rob Sargent (#4)
Re: collect2: error: ld returned 1 exit status

On Sat, Nov 26, 2022 at 5:25 PM Rob Sargent <robjsargent@gmail.com> wrote:

On Nov 26, 2022, at 4:17 PM, William Torrez Corea <willitc9888@gmail.com>
wrote:



On Sat, Nov 26, 2022 at 5:00 PM Rob Sargent <robjsargent@gmail.com> wrote:

On Nov 26, 2022, at 3:43 PM, William Torrez Corea <willitc9888@gmail.com>
wrote:


I am using libpq: the C application programmer's interface to PostgreSQL.

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*

--

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
No package 'libpq' found

--

So libpq is not in *-L/usr/local/pgsql/lib ?* Do you know that libpq is
installed? You may need to use the Debian package installer to get the
“dev” environment

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

header files for libpq5 (PostgreSQL library), the package is broken.
--

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

#7Rob Sargent
robjsargent@gmail.com
In reply to: William Torrez Corea (#6)
Re: collect2: error: ld returned 1 exit status
#8William Torrez Corea
willitc9888@gmail.com
In reply to: Rob Sargent (#7)
Re: collect2: error: ld returned 1 exit status

On Sat, Nov 26, 2022 at 7:55 PM Rob Sargent <robjsargent@gmail.com> wrote:

header files for libpq5 (PostgreSQL library), the package is broken.
--

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

I’m confused. Is that ‘package is broken’ coming from dpkg.

The package is in Synaptic Package Manager
--

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀