pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.67k stars 249 forks source link

Fails to build on Power9 #1323

Open snyrkill opened 1 year ago

snyrkill commented 1 year ago

I'm trying to build from source on Debian 12 on power9. It fails on the ring.0.16.02 crate because that version does not support power9. This has been fixed in the newest version (ring.0.17.2) Is it possible somehow to enable this version of ring in the dependencies? Thanks in advance, -S

eeeebbbbrrrr commented 1 year ago

I plan on publishing a new pgrx version in a day or two, and as part of that process we always update dependencies to their current versions.

Looks like our dependency on ring is transient through our dependency on ureq (for cargo-pgrx). Also looks like our default is to use ureq/native-tls. How are you trying to install cargo-pgrx? Are you specifying our rustls feature?

Regardless, assuming there's a new ureq out there with an updated dependency tree, we'll pick it up on our next release.

However, we have no way to validate things on power9.

snyrkill commented 1 year ago

Thanks Eric. I am following the instructions here: https://github.com/timescale/timescaledb-toolkit $ cargo install --version '=0.10.2' --force cargo-pgrx I know very little about rust, I'm just a DBA trying to install this on Power9. I really don't know if the rustls feature is specified.

eeeebbbbrrrr commented 1 year ago

Hmm.

Okay, I see. Well. After I cut our new pgrx release in the next day or two I’ll immediately give the timescale folks a PR to upgrade them to it.

Sorry this turned out to be a little dramatic. Transient dependencies are a thing, sometimes. Hang in there.

workingjubilee commented 1 year ago

@snyrkill little endian or big endian?

eeeebbbbrrrr commented 1 year ago

after cutting v0.11.0 it looks like the transient ring depenecy (via ureq-->rustls-->ring) is ring v0.16.20. I'm not sure if this is going to fix your problems. In the original report here you said v0.16.02. Even if you meant v0.16.20, neither is v0.17.2 (and I don't remember what I saw yesterday when I looked at this).

So... you might need to reach out to the ureq folks and ask them to upgrade their dep tree. I don't imagine that plan9 gets a lot of top-of-mind attention. :(

workingjubilee commented 1 year ago

@snyrkill I banged out a quick patch which uses Cargo's [patch.crates-io] feature to force the matter, it is available at https://github.com/workingjubilee/pgrx/tree/joy-patch-crates-for-ring-0.17

You will be able to build a fork of timescaledb-toolkit by updating the versions appropriately in their Cargo.toml, so it will look like

diff --git a/extension/Cargo.toml b/extension/Cargo.toml
index d4102fc..d89579e 100644
--- a/extension/Cargo.toml
+++ b/extension/Cargo.toml
@@ -17,9 +17,9 @@ pg_test = ["approx"]
 [dependencies]
 # Keep synchronized with `cargo install --version N.N.N cargo-pgrx` in Readme.md and docker/ci/Dockerfile
 # Also `pgrx-tests` down below in `dev-dependencies`.
-pgrx = "=0.10.2"
-pgrx-macros = "=0.10.2"
-pgrx-sql-entity-graph = "=0.10.2"
+pgrx = "=0.11.0"
+pgrx-macros = "=0.11.0"
+pgrx-sql-entity-graph = "=0.11.0"
 encodings = {path="../crates/encodings"}
 flat_serialize = {path="../crates/flat_serialize/flat_serialize"}
 flat_serialize_macro = {path="../crates/flat_serialize/flat_serialize_macro"}
@@ -56,5 +56,8 @@ spfunc = "0.1.0"
 statrs = "0.15.0"

 [dev-dependencies]
-pgrx-tests = "=0.10.2"
+pgrx-tests = "=0.11.0"
 approx = "0.4.0"
+
+[patch.crates-io]
+pgrx = { git = "https://github.com/workingjubilee/pgrx.git", branch = "joy-patch-crates-for-ring-0.17" }

Might be useful for testing whether it builds/runs at all, we haven't assessed support for POWER machines very closely.

workingjubilee commented 1 year ago

Though patches-of-patches might not work, in which case the patch section will look like this instead:

[patch.crates-io]
sct = { git = "https://github.com/rustls/sct.rs" }
rustls = { git = "https://github.com/cpu/rustls", branch = "cpu-0.21.8-prep" }
rustls-webpki = { git = "https://github.com/cpu/webpki", branch = "cpu-0.101.7-prep" }

Also, don't use --locked.

snyrkill commented 1 year ago

@workingjubilee thank you so much for your effort! I will try figure out how this is done tomorrow. To build pgrx will I need to

Then download the timescale-toolkit and make the patches you described? Thanks again, -S

snyrkill commented 1 year ago

Thank you @eeeebbbbrrrr. I reached out to the ureq folks. The discussion is here: https://github.com/algesten/ureq/issues/671

workingjubilee commented 1 year ago

The command to use in this case is actually

cargo install --path ./cargo-pgrx
snyrkill commented 1 year ago

@workingjubilee I still get this error:

error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `/var/lib/postgresql/dev/pgrx/target/release/build/ring-edb0e579adf1c93b/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /var/lib/postgresql/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:358:10:
  called `Option::unwrap()` on a `None` value
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So apparently it is still using ring 0.16.20

workingjubilee commented 1 year ago

that's weird, it doesn't with all those patches applied.