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

Enable cross compiling extensions #1994

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

rhelmot
Copy link

@rhelmot rhelmot commented Mar 6, 2025

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.

@wolfgangwalther
Copy link

@rhelmot did you look at #981, too? Maybe that could be revived.

@rhelmot
Copy link
Author

rhelmot commented Mar 15, 2025

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.

@wolfgangwalther
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants