I am developing a version of the `steampipe-postgres-fdw` - a PostgreSQL Foreign Data Wrapper (FDW) written in Go. It is a part of the bigger `steampipe` project.
While the project builds successfully on Darwin systems, I am encountering a specific challenge on Linux when integrating with PostgreSQL 14 using `pgxs.mk`. Initially I suspected that the issue might be the size of the `.a` file, but the complication arises specifically when including the `github.com/aquasecurity/trivy` package. Including this package leads to errors during the linking phase, as exemplified below: ``` /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) ... ``` This leads me to believe the issue may lie in how the `trivy` package is being compiled or integrated within the project. I am reaching out for insights and advice on the following: 1. Techniques or best practices for resolving compilation and linking errors related to specific Go packages, particularly in a PostgreSQL FDW context. 2. Guidance on compiling Go code with `-fPIC` and other necessary flags for successful integration with PostgreSQL on Linux, especially when dealing with complex package dependencies. 3. Understanding the underlying causes of these specific errors and potential solutions when integrating third-party Go packages like `trivy` in a PostgreSQL extension. Any advice, experience, or pointers you could share regarding these issues would be immensely helpful. Thank you for your time and support. Best regards, Binaek Sarkar I have a minimum reproducible version at https://github.com/turbot/steampipe-postgres-fdw/tree/debug_trivy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/da8d76f6-1d1c-4a8b-9647-ef29350f9974n%40googlegroups.com.