Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS CI broken #2973

Closed
dbaynard opened this issue Sep 27, 2023 · 4 comments · Fixed by #2978
Closed

MacOS CI broken #2973

dbaynard opened this issue Sep 27, 2023 · 4 comments · Fixed by #2978
Labels
ci Related to CI setup

Comments

@dbaynard
Copy link
Contributor

Having read comments on #2958 about lacking MacOS for testing, I built postgrestPackage on my M1 machine (I had to disable tests for http2, but that might be because of my firewall settings). I updated to the current nixos-unstable; there may be a more lightweight way to fix builds.

I made some more changes in a branch, for ease of my testing; you can still see the (minimal) changes in fore-stun/postgrest at flake (link to tip commit).

I'd be keen to get CI working again — if there's something short of the upgrade that needs testing, I'd be happy to help.

@steve-chavez steve-chavez added the ci Related to CI setup label Sep 27, 2023
@robx
Copy link
Contributor

robx commented Sep 28, 2023

Just to confirm that building current main branch on macos (x86), I have the same safeupdate error mentioned in the other thread:

$ nix-shell
[...]
installing
install: cannot stat 'safeupdate.so': No such file or directory
error: builder for '/nix/store/7a38vg4fjnrl031rsbi4sp6syb9mzws1-pg-safeupdate-1.4.drv' failed with exit code 1;
       last 10 log lines:
       > source root is source
       > patching sources
       > configuring
       > no configure script, doing nothing
       > building
       > build flags: SHELL=/nix/store/dvk14kpsjv70jcqlj6z3izxwchka3ic3-bash-5.2-p15/bin/bash
       > cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -O2  -fvisibility=hidden -I. -I./ -I/nix/store/nm0qqgi36p8jb8v9gm4wdg83sx23v8lg-postgresql-16.0/include/server -I/nix/store/nm0qqgi36p8jb8v9gm4wdg83sx23v8lg-postgresql-16.0/include/internal -I/nix/store/pxkr1rdqdbnpbf081ydfw6avbmrxnsv4-icu4c-73.2-dev/include -I/nix/store/khl24xnhdvddh40w9q0zx8kn41mv9i4g-libxml2-2.11.5-dev/include/libxml2 -I/nix/store/jx3nl1cnf6niza5i8255bvff156ni4hr-lz4-1.9.4-dev/include -I/nix/store/gwcfgzcz4rhiahi3g27l0n548gfw9kn8-zstd-1.5.5-dev/include   -c -o safeupdate.o safeupdate.c
       > cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -O2  -fvisibility=hidden safeupdate.o -L/nix/store/1qipb24pnm55f9l2k6l7d89k0jl8sp7k-postgresql-16.0-lib/lib  -L/nix/store/i6skdxjya738cq5hcmx45cd5kdyq3xii-libxml2-2.11.5/lib -L/nix/store/xi3i64k4l3p7pxazixsmhf4y05s9g5pz-lz4-1.9.4/lib -L/nix/store/aklwi0pvynly8mv7n9ckjvv1lhz87a1y-zstd-1.5.5/lib  -Wl,-dead_strip_dylibs  -fvisibility=hidden -bundle -bundle_loader /nix/store/nm0qqgi36p8jb8v9gm4wdg83sx23v8lg-postgresql-16.0/bin/postgres -o safeupdate.dylib
       > installing
       > install: cannot stat 'safeupdate.so': No such file or directory
       For full logs, run 'nix log /nix/store/7a38vg4fjnrl031rsbi4sp6syb9mzws1-pg-safeupdate-1.4.drv'.

@robx
Copy link
Contributor

robx commented Sep 28, 2023

The following change fixes the issue locally for me:

diff --git a/default.nix b/default.nix
index 40a67250..aa125e60 100644
--- a/default.nix
+++ b/default.nix
@@ -50,7 +50,19 @@ let
 
   postgresqlVersions =
     [
-      { name = "postgresql-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
+      {
+        name = "postgresql-16";
+        postgresql = pkgs.postgresql_16.withPackages (p: [
+          p.postgis
+          (p.pg_safeupdate.overrideAttrs (old: {
+            installPhase = ''
+              mkdir -p $out/bin
+              cp safeupdate.dylib safeupdate.so || true
+              install -D safeupdate.so -t $out/lib
+            '';
+          }))
+        ]);
+      }
       { name = "postgresql-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
       { name = "postgresql-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
       { name = "postgresql-13"; postgresql = pkgs.postgresql_13.withPackages (p: [ p.postgis p.pg_safeupdate ]); }

Chances are that postgresql-16 is being built with a different make that has different automatic rules (causing the cc .... -o safeupdate.dylib instead of what might have been a cc .... -o safeupdate.so before). But I'm at a loss as to where precisely that difference comes from.

@robx
Copy link
Contributor

robx commented Sep 28, 2023

(The important part of the patch is adding the command cp safeupdate.dylib safeupdate.so || true.)

@steve-chavez
Copy link
Member

Regarding nixpkgs, seems there are lots of failed pg 16 extensions on MacOS: #2958 (comment)

The following change fixes the issue locally for me:

Cool, I think we can just add that for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to CI setup
Development

Successfully merging a pull request may close this issue.

3 participants