Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oz4sT-0005k7-7Y for pgsql-general@arkaria.postgresql.org; Sat, 26 Nov 2022 23:46:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oz4sR-0007fN-3A for pgsql-general@arkaria.postgresql.org; Sat, 26 Nov 2022 23:46:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oz4sQ-0007fC-P7 for pgsql-general@lists.postgresql.org; Sat, 26 Nov 2022 23:46:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oz4sL-0001cn-Ka for pgsql-general@lists.postgresql.org; Sat, 26 Nov 2022 23:46:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2AQNkLMN233832; Sat, 26 Nov 2022 18:46:21 -0500 From: Tom Lane To: William Torrez Corea cc: pgsql-general@lists.postgresql.org, Rob Sargent Subject: Re: collect2: error: ld returned 1 exit status In-reply-to: References: <050D1AE9-0D5B-433D-8C82-938FB5BA3191@gmail.com> Comments: In-reply-to William Torrez Corea message dated "Sat, 26 Nov 2022 17:17:42 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <233830.1669506381.1@sss.pgh.pa.us> Date: Sat, 26 Nov 2022 18:46:21 -0500 Message-ID: <233831.1669506381@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk William Torrez Corea writes: > On Sat, Nov 26, 2022 at 5:00 PM Rob Sargent wrote: >> On Nov 26, 2022, at 3:43 PM, William Torrez Corea >> 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