I am trying to build the steampipe-postgres-fdw
project in a Linux.
The FDW is a golang
module which compiles to a *.a
using -buildmode=c-archive
. The generated .a
file is about 393 MB
.
The FDW Makefile
looks like:
MODULE_big = steampipe_postgres_fdw
OBJS = [list of object files]
SHLIB_LINK = steampipe_postgres_fdw.a
EXTENSION = steampipe_postgres_fdw
DATA = steampipe_postgres_fdw--1.0.sql
REGRESS = steampipe_postgres-fdw
EXTRA_CLEAN = steampipe_postgres_fdw.a fdw.h
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
SERVER_LIB = $(shell $(PG_CONFIG) --includedir-server)
INTERNAL_LIB = $(shell $(PG_CONFIG) --includedir)/internal
PG_CFLAGS = -I${SERVER_LIB} -I${INTERNAL_LIB} -g
include $(PGXS)
Issue is that whenever I try to make
, it spits out errors like: (similar for amd64
)
/usr/bin/ld: steampipe_postgres_fdw.a(go.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `type:string' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: DWARF error: line info data is bigger (0x65f0639) than the space remaining in the section (0xe86ef9)
/usr/bin/ld: DWARF error: line info data is bigger (0x66400c8) than the space remaining in the section (0xe86cbd)
...
/usr/bin/ld: steampipe_postgres_fdw.a(go.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `encoding/json.stateErrorĀ·f' which may bind externally can not be used when making a shared object; recompile with -fPIC
go.go:(.text+0x13ade0): dangerous relocation: unsupported relocation
/usr/bin/ld: steampipe_postgres_fdw.a(go.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `type:T9dlNKsN' which may bind externally can not be used when making a shared object; recompile with -fPIC
go.go:(.text+0x13adfc): dangerous relocation: unsupported relocation
This is specific to linux
. Builds just fine in darwin
systems (M1
and Intel
)
What am I missing here?
Not sure if this is relevant, but when the
.a
file is smaller (~100MB
), it builds just fine.
I have pushed a minimum reproducible code at https://github.com/turbot/steampipe-postgres-fdw/tree/debug_trivy