databases/postgis31 works perfectly on amd64, however on many i386 machines with either postgresql13-server or postgresql12-server it fails with "Undefined symbol" errors. postgis31-3.1.5 from official "latest" package repo on a fresh FreeBSD 13.0-RELEASE-p8 i386 install: ---------- postgres=# CREATE DATABASE postgistest; CREATE DATABASE postgres=# \c postgistest You are now connected to database "postgistest" as user "postgres". postgistest=# CREATE EXTENSION postgis; ERROR: could not load library "/usr/local/lib/postgresql/postgis-3.so": /usr/local/lib/postgresql/postgis-3.so: Undefined symbol "_ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEj" postgistest=# ---------- Some searching suggests this might be related to a library mismatch between base and ports. I notice the i386 library that does not work is linking to libgcc_s.so.1 from the gcc10 port: i386# ldd /usr/local/lib/postgresql/postgis-3.so | grep libgcc libgcc_s.so.1 => /usr/local/lib/gcc10/libgcc_s.so.1 (0x207a4000) i386# while the working amd64 machine is linking to base libgcc_s.so.1: amd64# ldd /usr/local/lib/postgresql/postgis-3.so | grep gcc libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x80169b000) amd64# I have tried playing around with LD_LIBRARY_PATH/LD_PRELOAD but have not found a working combination as postgresql-server itself appears to need the ports gcc10 libgcc_s.so.1. FYI this also affects databases/postgis32 on i386, although the undefined symbol is different with 3.2: postgistest=# CREATE EXTENSION postgis; ERROR: could not load library "/usr/local/lib/postgresql/postgis-3.so": /usr/local/lib/postgresql/postgis-3.so: Undefined symbol "_ZNSt8ios_base4InitD1Ev" postgistest=#
Disabling the WAGYU option that is enabled by default allows postgis31 to work correctly on i386. With WAGYU disabled, postgis-3.so on i386 is now linking against base libgcc_s.so.1 which matches amd64. $ ldd /usr/local/lib/postgresql/postgis-3.so | grep libgcc libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x207a4000) $
Indeed, Wagyu is a c++ dependency. Can you edit the Makefile like this: replace USES= `compiler:c++11-lang` by `compiler:gcc-c++1-lib`
Created attachment 235232 [details] Fix postgis 3.x i386
Here a patch for postgis >= 3.0
Created attachment 237128 [details] Config log for configure error from patch Trying to manually apply the patch on postgis 3.2.3 configure: error: *** A compiler with support for C++11 language features is required.
(In reply to David Stenwall from comment #5) So sorry. gcc noob here. A simple pkg install gcc11 fixed it. Had just gcc installed and that didn't do the trick.