From: Tom Lane <tgl@sss.pgh.pa.us>
To: Binaek Sarkar <binaek@turbot.com>
Cc: pgsql-general@postgresql.org, Kai Daguerre <kai@turbot.com>
Cc: Binaek Sarkar <binaek89@gmail.com>
Subject: Re: Building Extension on Linux fails with relocation error
Date: Fri, 22 Dec 2023 10:31:14 -0500
Message-ID: <1054188.1703259074@sss.pgh.pa.us> (raw)
In-Reply-To: <CAAi87c1LHt54DaOGpuAMW2cXygU63v6W2-kEq6OYGjfYnKLzkQ@mail.gmail.com>
References: <CAAi87c1LHt54DaOGpuAMW2cXygU63v6W2-kEq6OYGjfYnKLzkQ@mail.gmail.com>
Binaek Sarkar <binaek@turbot.com> writes:
> The issue arises with a Go module that is compiled into a .a archive file
> using -buildmode=c-archive, leading to a *file size of approximately 393 MB*.
I am not sure exactly what "-buildmode=c-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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, binaek@turbot.com, kai@turbot.com, binaek89@gmail.com
Subject: Re: Building Extension on Linux fails with relocation error
In-Reply-To: <1054188.1703259074@sss.pgh.pa.us>
References: <CAAi87c1LHt54DaOGpuAMW2cXygU63v6W2-kEq6OYGjfYnKLzkQ@mail.gmail.com> <1054188.1703259074@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox