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

FAQ: Migration to Postgres 16 #1298

Open
workingjubilee opened this issue Sep 15, 2023 · 2 comments
Open

FAQ: Migration to Postgres 16 #1298

workingjubilee opened this issue Sep 15, 2023 · 2 comments

Comments

@workingjubilee
Copy link
Member

workingjubilee commented Sep 15, 2023

There are some difficulties recently presented with migrating PGRX extensions to Postgres 16. Here I will attempt to answer these questions as they may arise.

Q. My build is failing with some sort of bindgen error, something about <emmintrin.h>?

A. You may have too many clangs. Basically, with rustup, rust-bindgen, and a system's clang packages, there can be a situation where there are "too many clangs" on the system. Essentially:

  • rust-bindgen tries to use a clang of version M
  • rust-bindgen attempts to build against the indicated postgres, dragging in its headers
  • the postgres you want to build against is also bound against clang N's SIMD intrinsic headers (there is all of <[aeinpstw-z]mmintrin.h>).
  • those SIMD headers are written in a way that may depend on specific internal details of the compiler in order to compile at all, thus any given clang M cannot be expected to compile clang N's headers, and clang N might not even be able to compile clang M's headers! They are more "compiler implementation details" than they are "regular" C code, which is why they are included using the same syntax as "system headers".
  • thus the build fails when it uses clang M, but it will succeed if it uses clang N, but due to the vagaries of certain PATH lookups, rust-bindgen may default to clang M

This may not be something PGRX can solve (this is still unclear), but it is something that can be easily resolved as a configuration issue. It is usually sufficient to remove all but one clang package on the system, preferably using a more recent one (as this was initially discovered when using clang 11 and compile-erroring on clang 14's intrinsic headers).

Q. cargo pgrx install (or other commands) on macOS doesn't work?
A. Oops. Try pgrx v0.10.2! It should be patched now.

@workingjubilee
Copy link
Member Author

My current hypothesis is that the Postgres 16 build errors might be induced by our conditional setting of detect_include_paths. This is possible to disable by setting PGRX_BINDGEN_NO_DETECT_INCLUDES=please.

@workingjubilee
Copy link
Member Author

Most concerns about migration to Postgres 16 should be addressed by using pgrx v0.11.1 (I hope!)

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

No branches or pull requests

1 participant