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

Explicitly enable object Cargo features #1926

Merged

Conversation

workingjubilee
Copy link
Member

cargo-pgrx only works if we enable a minimal set of Cargo features for for the object crate, that we implicitly enable despite having set object to be default-features = false!

The Cargo feature resolver has unified our "std" feature for object with the requested object features of our other dependencies that also depend on the object crate. However, these dependencies do so conditionally, based on the platform that they are compiling on. This means that if other dependencies stop using the object crate, or with less features, our enabled Cargo features for object will no longer be the correct set to build our own binary!

This also implies some platforms are simply unable to build cargo-pgrx. Even if we don't support these platforms explicitly, we have generally taken a "smoke 'em if you got 'em" approach for unsupported platforms. Thus, enable enough of object's Cargo features to prevent weird problems from surfacing in the future through unrelated dependency changes, and make the cargo-pgrx build effectively platform-invariant.

Whether it actually works on those platforms is a "them" problem, but now they should be able to actually get to debugging it a bit.

cargo-pgrx only works if we enable a minimal set of Cargo features for
for the object crate, that we implicitly enable despite having set object
to be `default-features = false`!

The Cargo feature resolver has unified our "std" feature for object with
the requested object features of our other dependencies that also depend
on the object crate. However, these dependencies do so conditionally,
based on the platform that they are compiling on. This means that if
other dependencies stop using the object crate, or with less features,
our enabled Cargo features for object will no longer be the correct set
to build our own binary!

This also implies some platforms are simply unable to build cargo-pgrx.
Even if we don't support these platforms explicitly, we have generally
taken a "smoke 'em if you got 'em" approach for unsupported platforms.
Thus, enable enough of object's Cargo features to prevent weird problems
from surfacing in the future through unrelated dependency changes, and
make the cargo-pgrx build effectively platform-invariant.

Whether it actually works on those platforms is a "them" problem,
but now they should be able to actually get to debugging it a bit.
@workingjubilee
Copy link
Member Author

workingjubilee commented Oct 23, 2024

confirmed on Discord by marcus that this builds/runs

errors at runtime, but cargo-pgrx reaches runtime

@workingjubilee workingjubilee merged commit 6a93f88 into pgcentralfoundation:develop Oct 23, 2024
14 checks passed
@workingjubilee workingjubilee deleted the unresolved-anxiety branch October 23, 2024 22:26
default-features = false
features = [
"read_core", "std", # we use object read-only and like having actual errors
"coff", "elf", "macho", "pe", "xcoff", # support all object formats to allow cross-builds
Copy link
Contributor

Choose a reason for hiding this comment

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

No description provided.

@eeeebbbbrrrr
Copy link
Contributor

I caught the Discord conversation late. I dunno how this was immediately obvious to you but I’m thankful it was!

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