Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGhXZ-00Ggkv-7Z for pgsql-general@arkaria.postgresql.org; Fri, 22 Dec 2023 15:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rGhXX-008VC7-Pq for pgsql-general@arkaria.postgresql.org; Fri, 22 Dec 2023 15:34:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGhUd-008Pj4-R6 for pgsql-general@lists.postgresql.org; Fri, 22 Dec 2023 15:31:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGhUb-00DNAs-Ls for pgsql-general@postgresql.org; Fri, 22 Dec 2023 15:31:19 +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 3BMFVEWq1054189; Fri, 22 Dec 2023 10:31:14 -0500 From: Tom Lane To: Binaek Sarkar cc: pgsql-general@postgresql.org, Kai Daguerre , Binaek Sarkar Subject: Re: Building Extension on Linux fails with relocation error In-reply-to: References: Comments: In-reply-to Binaek Sarkar message dated "Thu, 21 Dec 2023 13:58:16 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1054187.1703259074.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 22 Dec 2023 10:31:14 -0500 Message-ID: <1054188.1703259074@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Binaek Sarkar writes: > The issue arises with a Go module that is compiled into a .a archive fil= e > using -buildmode=3Dc-archive, leading to a *file size of approximately 3= 93 MB*. I am not sure exactly what "-buildmode=3Dc-archive" does, but it doesn't sound like it is doing what you need. You need code that is built to be dynamically relocatable, which as the error message suggests is normally accomplished (with a C compiler) by specifying -fPIC. You'll have to find out what is the equivalent incantation for Go; but look for options for building shared libraries, not .a files. > Interestingly, the *build completes successfully when the .a file is > smaller* (around 100 MB). Pure luck I suspect. regards, tom lane