Unverified Commit 2a13929e authored by Matthew Bauer's avatar Matthew Bauer Committed by GitHub
Browse files

postgresqlPackages.timescaledb_toolkit: fix on macos (#332353)

* postgresqlPackages.timescaledb_toolkit: fix on macos

It looks like the macOS linker doesn’t like that some of the symbols
are undefined in the extension. They will be provided by the postgres
binary, but macOS linker checks that all symbols are defined.
Apparently, Linux allows these symbols to be undefined.

The -undefined flag changes this behavior:

> Specifies how undefined symbols are to be treated. Options are:
> error, warning, suppress, or dynamic_lookup. The default is error.

So, setting to dynamic_lookup makes the most sense here, and makes
this package work on macOS. I tried to see if pgvecto-rs, which also
uses buildPgrxExtension, would build. Unfortunately, it gave other
errors.

More information on the bug here: https://github.com/supabase/nix-postgres/issues/10

* Remove stdenv
parent fbf6ab32
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ let

      NIX_PGLIBDIR="${postgresql}/lib" \
      PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \
      RUSTFLAGS="${lib.optionalString stdenv.isDarwin "-Clink-args=-Wl,-undefined,dynamic_lookup"}" \
      cargo pgrx package \
        --pg-config ${postgresql}/bin/pg_config \
        ${maybeDebugFlag} \
+0 −4
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
, nixosTests
, cargo-pgrx_0_10_2
, nix-update-script
, stdenv
}:

(buildPgrxExtension.override { cargo-pgrx = cargo-pgrx_0_10_2; }) rec {
@@ -40,8 +39,5 @@
    maintainers = with maintainers; [ typetetris ];
    platforms = postgresql.meta.platforms;
    license = licenses.tsl;

    # as it needs to be used with timescaledb, simply use the condition from there
    broken = stdenv.isDarwin;
  };
}