-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
ci(macos): Avoid linking against Homebrew #1755
ci(macos): Avoid linking against Homebrew #1755
Conversation
I've temporarily disabled all the other bits of CI just to make verifying quicker. I'll revert all that if/when we get closer to merging. I wanted to gauge whether you think this is worth the trouble before finishing it off? I can't imagine you'd be particularly comfortable with having a rather hairy build step that you can't run locally. Here's a sample build with the macOS versions in the wheel tags back to normal. |
Yes, this seems useful, and it's what we do for Linux: see the If you complete this operation it would be useful to port it to psycopg 3 too (which has a script pretty much identical). Hint: you can use Thank you very much for your initiative! |
.github/workflows/packages.yml
Outdated
export LDFLAGS="-L$fake_prefix/lib" | ||
export CPPFLAGS="-I$fake_prefix/include" | ||
cd postgresql-16.6 | ||
./configure --without-icu --prefix="$fake_prefix" --with-ssl=openssl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No gssapi/ldap support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was going to ask about which --with-xxx
features to use but you beat me to it. I see build_libpq.sh
makes that decision for me anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately that also implies building these other libraries. Not doing so would break certain features. I don't know how many people rely on them, but I don't feel they are features that we can drop without being unpunished.
TBH, for some reason, GSSAPI causes a lot of problems to macOS users because in some configuration it causes slowdowns on connection, but still it doesn't seem a good case to decide that nobody in the world requires it.
What is, on macOS, the default socket dir? In other words:
what path is searched for in macOS? If it's not psycopg2/scripts/build/build_libpq.sh Lines 148 to 152 in e83754a
|
Thanks for pointing that out. Yes, adding macOS support to that script sounds better than doing it all over again in YAML.
I wasn't aware that there was such thing as a socket dir but does this answer your question? > psql "host='' port=9999"
psql: error: connection to server on socket "/tmp/.s.PGSQL.9999" failed: No such file or directory
Is the server running locally and accepting connections on that socket? (That's homebrew's |
Do you mind if I bump the OpenLDAP version? I need this fix or the check for POSIX regex throws a false negative. (It's probably |
2b1b6f2
to
57bfbda
Compare
Yes it does. It seems that the default socket dir is It is useful that it is the brew one. If it wasn't, a program configured and running correctly so far would stop working if we switch to a libpq with a different default. See past issues for example.
Absolutely not, go ahead 🙂 |
96dbaa3
to
3d29e02
Compare
Hello @bwoodsend! How is it going with this work? Is it ready, or are you stuck somewhere, or you don't think you want to finish the MR? Thank you very much! |
Sorry, I'm still here. I ground to a halt over some m4 issue running |
Yay! Got there eventually. I'll clean up my mess in a bit and move this out of draft.
Sure enough, The |
3d29e02
to
b49ff40
Compare
scripts/build/build_libpq.sh
Outdated
# If available, libpq seemingly insists on linking against homebrew's | ||
# openssl no matter what so remove it. Since homebrew's curl depends on | ||
# it, force use of system curl. | ||
brew uninstall --force --ignore-dependencies openssl gettext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't suppose you know a better way to force which copy of a library to link against? The build system seems to add homebrew to its search path even if I env -i
away all the brew related environment variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe with -L/-l
options in the compiler? Not sure.
Up to date verification run: https://github.com/bwoodsend/psycopg2/actions/runs/12291165704 |
Homebrew binaries are always compiled for exactly the version they're installed on making them very un-portable. When a wheel is "repaired" by cibuildwheel, delocate-wheel pulls in _psycopg's dependencies (libpq.dylib, libssl.dylib and libcrypto.dylib) which, on a GitHub Actions macOS 14 runner, are provided by Homebrew and are therefore only macOS >= 14 compatible. The resultant wheel is therefore incompatible with all but the latest macOS versions. Build all dependencies from source so that we can set the deployment target to something sensible. Fixes psycopg#1753.
9c871cf
to
5b643a2
Compare
This is is how it is organised in Linux.
We don't run complete tests in CI, so let's not waste this chance. The overhead for complete tests is minimal compared to all the pipeline boilerplate.
5b643a2
to
1eac4fd
Compare
Hello @bwoodsend I have worked a bit on this branch, mostly adding libpq build caching and moving the libpq build from the CI workflow to the BEFORE script, consistently with the linux workflow. A complete package build with all the version run here. This looks ok to merge for me. Ok for you too? After this is safe I will also port it to psycopg3, which has the same type of problem. Thank you very much for your contribution! |
Do you want to cherry pick bwoodsend@ede7cd2 in or we can save it for later? I wrote it a while ago but never got around to pushing it (curse my tiny attention span). I'm happy for this to be merged now either way. |
If it works, it seems good. I remember that with cross-compiling on macOS you could build but not run/test what built. Is that only a concern for cross-compiling ARM on X86? Edit: answering to myself: looking here it seems that x86 code can be tested on arm. |
The GitHub Actions runners look like they're only 1 year away from the last macOS x86_64 platform being removed. Get ahead of the game and build x86_64 on arm64.
Yeah, you can run |
Thank you for the in-depth co-review, it seems a good improvement to only depend on the ARM runners. Building packages in this job. If everything works I guess we can merge this. |
That's everything I can think of. Ready for the merge button when you are... |
e2e51d7
to
6cd0fbd
Compare
This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders (see #858). Largely contributed by @bwoodsend in psycopg/psycopg2#1755.
This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders (see #858). Largely contributed by @bwoodsend in psycopg/psycopg2#1755.
Thank you very much! Merged, now poriting to psycopg 3 in psycopg/psycopg#986. |
This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders (see #858). Largely contributed by @bwoodsend in psycopg/psycopg2#1755.
This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders (see #858). Largely contributed by @bwoodsend in psycopg/psycopg2#1755.
This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders (see #858). Largely contributed by @bwoodsend in psycopg/psycopg2#1755.
This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders (see #858). Largely contributed by @bwoodsend in psycopg/psycopg2#1755.
Homebrew binaries are always compiled for exactly the version they're installed on making them very unportable. When a wheel is "repaired" by cibuildwheel, delocate-wheel pulls in _psycopg's dependencies (libpq.dylib, libssl.dylib and libcrypto.dylib) which, on a GitHub Actions macOS 14 runner, are provided by Homebrew and are therefore only macOS >= 14 compatible. The resultant wheel is therefore incompatible with all but the latest macOS versions.
Build all dependencies from source so that we can set the deployment target to something sensible. Fixes #1753.