-
-
Notifications
You must be signed in to change notification settings - Fork 297
Enable cross compiling extensions #1994
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
Conversation
|
I had not seen that. Based on the diff, it seems pretty similar to this, with three additional knobs, two for sysroots and one for an alternative pg_config. All of those are pretty unnecessary if you're compiling though nixpkgs, and I would have thought that the sysroots wouldn't be necessary because of the comprehensive nature of the rust cross toolchain, though maybe the C pieces in the dependency tree care about this? pg_config is concerning though. I am not actually familiar enough with pgrx to understand why we need pg_config for the build platform in addition to the host. |
Yes, that confuses me as well, and I am not familiar enough with it either. |
eeeebbbbrrrr
left a comment
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.
This looks okay. Before merging, however, I'd like to see the cargo-pgrx/README.md updated with these new command line options.
Ideally, adding a short section there to discuss cross-compilation would be nice too.
Because of [1], we can't run initdb / postgres inside the darwin sandbox, even though it succeeds most of the time. It will lead to hard to debug build failures eventually. Since pgrx runs initdb as part of the build... there seems to be no other way than marking those packages as broken for now. This could be relaxed once [2] is available, because we could then disable the checkPhase and all "initdb" for pgrx on darwin. [1]: NixOS#371242 (comment) [2]: pgcentralfoundation/pgrx#1994
|
Hi @rhelmot, I'd like to merge this if you can address my comment here: #1994 (review) |
|
Rebased and added a README section. I'll come back and update the nix stuff when the dust has settled over at nixpkgs. |
eeeebbbbrrrr
left a comment
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.
Approved. I'll merge once CI passes
Two pieces here in order to enable my successful build of some pgrx extensions from x86_64-linux to x86_64-freebsd: - `cargo pgrx init --no-run` does not attempt to run the discovered postgreses, since they could be for the target architecture or OS. - `--target` flag to some other commands is passed along to cargo build invocations and injected into the calculation of the build directory path. The builds done in order to generate bindings (?) are still done native, since the result has to run at build time. Note that I was doing this within nix and nixpkgs, but I think it should generalize pretty well to the normal rust cross toolchains. Note also that I haven't actually tested this diff precisely, since I was working with something that pinned, of all things, 0.12.0-alpha1. The rebase was pretty straightforward but if you want to see the diff that I know for sure works, check [here](https://github.com/rhelmot/pgrx/tree/alpha-patched).
Two pieces here in order to enable my successful build of some pgrx extensions from x86_64-linux to x86_64-freebsd:
cargo pgrx init --no-rundoes not attempt to run the discovered postgreses, since they could be for the target architecture or OS.--targetflag to some other commands is passed along to cargo build invocations and injected into the calculation of the build directory path. The builds done in order to generate bindings (?) are still done native, since the result has to run at build time.Note that I was doing this within nix and nixpkgs, but I think it should generalize pretty well to the normal rust cross toolchains.
Note also that I haven't actually tested this diff precisely, since I was working with something that pinned, of all things, 0.12.0-alpha1. The rebase was pretty straightforward but if you want to see the diff that I know for sure works, check here.