From 2a13929e1f191b3690dd2f2db13098b04adb9043 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 6 Aug 2024 10:17:48 -0500 Subject: [PATCH] postgresqlPackages.timescaledb_toolkit: fix on macos (#332353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- pkgs/development/tools/rust/cargo-pgrx/buildPgrxExtension.nix | 1 + pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/development/tools/rust/cargo-pgrx/buildPgrxExtension.nix b/pkgs/development/tools/rust/cargo-pgrx/buildPgrxExtension.nix index f75bab143936..b4cbb95150a7 100644 --- a/pkgs/development/tools/rust/cargo-pgrx/buildPgrxExtension.nix +++ b/pkgs/development/tools/rust/cargo-pgrx/buildPgrxExtension.nix @@ -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} \ diff --git a/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix b/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix index 0c403c3558b2..0776fcb4468a 100644 --- a/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix +++ b/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix @@ -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; }; }