Re: Building Extension on Linux fails with relocation error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Binaek Sarkar <binaek(at)turbot(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Kai Daguerre <kai(at)turbot(dot)com>, Binaek Sarkar <binaek89(at)gmail(dot)com>
Subject: Re: Building Extension on Linux fails with relocation error
Date: 2023-12-22 15:31:14
Message-ID: 1054188.1703259074@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Binaek Sarkar <binaek(at)turbot(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2023-12-22 16:52:11 Re: Building Extension on Linux fails with relocation error
Previous Message Johnathan Tiamoh 2023-12-22 15:15:27 Re: what do you do after pg_walreset ?