Skip to content

Conversation

@jiangliu
Copy link
Contributor

Afeter commit 5820bf6, build.rs has no use anymore, so remove.

@zanieb
Copy link
Contributor

zanieb commented Oct 11, 2024

Where is the unwind feature turned on then?

@jiangliu
Copy link
Contributor Author

Where is the unwind feature turned on then?

When using py-spy as rust library crate, we can enable unwind feature when specifying the dependency.
When building py-spy as a binary, we can enable unwind with cargo cmdline options.
Unfortunately seems that cargo doesn't support enable features for specific target/arch yet.

BTW, there's no code make use of #[cfg(unwind)] anymore, there have all been converted to #[cfg(feature = "unwind")], so the build.rs becomes useless.

@zanieb
Copy link
Contributor

zanieb commented Oct 12, 2024

Yeah but that pull request didn't actually update anything to use the unwind feature right? So it just ended up turning it off?

Unfortunately seems that cargo doesn't support enable features for specific target/arch yet.

Yeah that's why it's written as a custom cfg and we'll probably want to revert the feature change and do
zanieb@045846a instead

Alternatively, we need to at least specify the feature per platform during builds. Edit: Looks like @benfred made this change in #691.

I don't have strong feelings about which pattern to use. It depends how critical having unwind enabled is, I guess, since people will undoubtably build and test without it enabled accidentally when it's an opt-in feature.

@jiangliu jiangliu force-pushed the build-rs branch 24 times, most recently from 84b25b2 to 2a679f3 Compare October 15, 2024 11:41
@jiangliu
Copy link
Contributor Author

jiangliu commented Oct 15, 2024

Yeah but that pull request didn't actually update anything to use the unwind feature right? So it just ended up turning it off?

Unfortunately seems that cargo doesn't support enable features for specific target/arch yet.

Yeah that's why it's written as a custom cfg and we'll probably want to revert the feature change and do zanieb@045846a instead

Alternatively, we need to at least specify the feature per platform during builds. Edit: Looks like @benfred made this change in #691.

I don't have strong feelings about which pattern to use. It depends how critical having unwind enabled is, I guess, since people will undoubtably build and test without it enabled accidentally when it's an opt-in feature.

Hi @zanieb,
I have worked out a draft patch to make unwind as default feature, which may help to address your concern:) I would like to make feature unwind work as expect so user can disable unwind when needed.


impl BinaryInfo {
#[cfg(feature = "unwind")]
#[cfg(all(feature = "unwind", target_os = "linux", target_arch = "x86_64"))]
Copy link
Owner

Choose a reason for hiding this comment

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

We also support native unwinding on windows - which I think this might remove.

(also we should probably aim to get in aarch64 / armv7 unwinding on linux in at some point - but that is out of scope of this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the change:)

Afeter commit 5820bf6, build.rs has
no use anymore, so remove.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Enable feature `unwind` by default, user can disable it by using:
`cargo build --no-default-features`

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
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.

3 participants