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
This commit is contained in:
Matthew Bauer
2024-08-06 10:17:48 -05:00
committed by GitHub
parent fbf6ab328d
commit 2a13929e1f
2 changed files with 1 additions and 4 deletions
@@ -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} \
@@ -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;
};
}