Skip to content

Conversation

@workingjubilee
Copy link
Contributor

This lays out some target selection logic using a PLRUST_TARGET env var, adds a feature for selecting an appropriate tuple by default, and otherwise provides for actually using postgrestd. This is logically complete but doesn't actually include the full test and build script. I'm going to let CI/review make noises at me before I do anything further that would mangle that signal.

@workingjubilee
Copy link
Contributor Author

( sorry, last commit was erroneous. )

@workingjubilee
Copy link
Contributor Author

Link error against undefined symbols, but... only on macOS, apparently, as Ubuntu does fine? Okay then.

Jubilee Young added 2 commits June 28, 2022 14:48
This reverts commit 15cbc2f.
This feels superstitious, but I am trying it anyways.
@Hoverbear
Copy link
Contributor

Hoverbear commented Jun 29, 2022

When I run this on a clean machine I get this (x86_64 Arch Linux):

[ana@architect plrust]$ cargo pgx test --features target_postgrestd
"cargo" "test" "--features" "target_postgrestd pg_test"
   Compiling ring v0.16.21 (https://github.com/workingjubilee/ring?branch=postgres-os#52f2ad16)
   Compiling mio v0.8.3
   Compiling socket2 v0.4.4
   Compiling rand v0.4.6
   Compiling rand_core v0.6.3
   Compiling parking_lot v0.12.1
   Compiling uuid v1.1.2
error: failed to run custom build command for `ring v0.16.21 (https://github.com/workingjubilee/ring?branch=postgres-os#52f2ad16)`

Caused by:
  process didn't exit successfully: `/home/ana/git/tcdi/plrust/target/debug/build/ring-99d869df8d5ff526/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")

  --- stderr
  running "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-Werror" "-c" "-o/home/ana/git/tcdi/plrust/target/debug/build/ring-621c5209cb56140a/out/sha512-x86_64-elf.o" "/home/ana/git/tcdi/plrust/target/debug/build/ring-621c5209cb56140a/out/sha512-x86_64-elf.S"
  /home/ana/git/tcdi/plrust/target/debug/build/ring-621c5209cb56140a/out/sha512-x86_64-elf.S:10: error: unterminated #if
     10 | #if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
        | 
  thread 'main' panicked at 'execution failed', /home/ana/.cargo/git/checkouts/ring-b0b6b149cfdc0877/52f2ad1/build.rs:656:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Do I need to fulfill some prerequisite?

[patch.crates-io]
libc = { git = "https://github.com/workingjubilee/libc", branch = "postgres-os" }
getrandom = { git = "https://github.com/workingjubilee/getrandom", branch = "postgres-os" }
ring = { git = "https://github.com/workingjubilee/ring", branch = "postgres-os" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting for future us that we think we can get rid of ring, getrandom, and libc here, hence they are not on the tcdi org. I am unsure if we plan to include that work in this PR, I don't really mind either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that won't happen immediately here, but Soon.

@Hoverbear
Copy link
Contributor

Hoverbear commented Jun 29, 2022

Really excited to give this a spin. Is there any parts of postgrestd or the other libraries you'd like me to review closely as well? I'll give the postgrestd a skim for sure.

Jubilee Young and others added 6 commits June 29, 2022 10:41

- name: Install cargo-pgx
continue-on-error: true # We might have it.
run: cargo install --force cargo-pgx --version $CARGO_PGX_VERSION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible we need to install the cargo-pgx off the branch?

@Hoverbear
Copy link
Contributor

Hoverbear commented Jun 30, 2022

Hmmm so does this mean #[no_std] in src/user_crate/skeleton.rs is not required? What about the globalalloc?

@workingjubilee
Copy link
Contributor Author

Yeah, I thiiink the #![no_std] annotation is no longer required.

@workingjubilee
Copy link
Contributor Author

Okay, I am throwing in the towel on making Intel Mac work. One is in the mail to me so I will be able to plug it in and poke around and fix this soon, but for right now, eff it.

@Hoverbear
Copy link
Contributor

@workingjubilee I'm fine with not doing this on intel Macs yet. They can just not use that feature. It is a dying platform anyways.

This was referenced Jul 4, 2022
@Hoverbear
Copy link
Contributor

Both #51 and #57 work perfectly fine on top this branch, good job. :)

@workingjubilee workingjubilee merged commit a5f70ef into tcdi:main Jul 5, 2022
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