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

sentry-crashpad: add sentry-crashpad recipe #5536

Merged
merged 7 commits into from
May 29, 2021

Conversation

madebr
Copy link
Contributor

@madebr madebr commented May 15, 2021

The versions are the same as the one in sentry-native.


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@conan-center-bot

This comment has been minimized.

@madebr madebr force-pushed the sentry_crashpad branch from faf1b38 to fb35c04 Compare May 15, 2021 21:05
@madebr madebr mentioned this pull request May 15, 2021
4 tasks
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@madebr madebr force-pushed the sentry_crashpad branch from 19f7085 to 39b0d8a Compare May 15, 2021 23:26
@conan-center-bot

This comment has been minimized.

@madebr madebr force-pushed the sentry_crashpad branch from 39b0d8a to bd3a0f2 Compare May 15, 2021 23:42
@conan-center-bot

This comment has been minimized.

@SpaceIm
Copy link
Contributor

SpaceIm commented May 16, 2021

I don't really understand why a new recipe is required. It's sentry-native with vendored crashpad, correct? It could live in #5524.

@madebr
Copy link
Contributor Author

madebr commented May 16, 2021

I don't really understand why a new recipe is required. It's sentry-native with vendored crashpad, correct? It could live in #5524.

Modularity.
This allows switching out sentry's forked crashpad with the original crashpad at #5511.

@prince-chrismc
Copy link
Contributor

Do we still need this since the other two related PRs were merged?

@madebr
Copy link
Contributor Author

madebr commented May 25, 2021

This fork provides features that the original does not, such as attachments.

prince-chrismc
prince-chrismc previously approved these changes May 26, 2021
@jgsogo
Copy link
Contributor

jgsogo commented May 26, 2021

I'm the third person asking the same... 😅

This recipe is downloading the same sources as sentry-native, why not adding an option to that recipe to switch behavior?

@madebr
Copy link
Contributor Author

madebr commented May 26, 2021

It makes more sense.

The unix philosophy is to let something do one and only one thing. Don't complicate things by mixing.
sentry-crashpad can be used standalone, without sentry-native.
The code will get messier when we need to mix the validate logic for sentry-native and crashpad.
The crashpad fork is developed in a separate repo (https://github.com/getsentry/crashpad/) and is only copied into sentry-native for releases. So in a sense it is treated as a separate project by sentry already.

The downside is that every sentry-native release requires a sentry-crashpad release.

Extra reason to add it as a separate recipe:
breakpad is another external dependency of sentry-native with its own requirements.
This adds even more complications.

@MartinDelille
Copy link
Contributor

We will need the qt option added here then: #5440

@madebr
Copy link
Contributor Author

madebr commented May 26, 2021

We will need the qt option added here then: #5440

Why's that?
I just did a grep for qt in the source folder of the 0.4.9 release and could only find a match in CMakeLists.txt and src/CMakeLists.txt.
Not in external/crashpad.

Sorry, I misunderstood.

Yes, the sentry-native recipe will need an extra option: "with_crashpad": ["google", "sentry"] (only used when self.options.backend == "crashpad").

@conan-center-bot conan-center-bot requested a review from danimtb May 26, 2021 12:00
@conan-center-bot

This comment has been minimized.

@conan-center-bot conan-center-bot requested a review from lasote May 27, 2021 12:00
prince-chrismc
prince-chrismc previously approved these changes May 27, 2021
Comment on lines +19 to +20
handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler"
handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler"
handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe)
handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler"
handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe)

You don't need to pass the absolute path. By run_environment, it's already included in PATH, and with priority order, so even if there is another app with same name, that one provided by Conan should be used first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The absolute path is passed as an argument.
When applying the following patch:

diff --git a/recipes/sentry-crashpad/all/test_package/conanfile.py b/recipes/sentry-crashpad/all/test_package/conanfile.py
index 724a4675..1b6e6555 100644
--- a/recipes/sentry-crashpad/all/test_package/conanfile.py
+++ b/recipes/sentry-crashpad/all/test_package/conanfile.py
@@ -16,6 +16,5 @@ class TestPackageConan(ConanFile):
             test_env_dir = "test_env"
             tools.mkdir(test_env_dir)
             bin_path = os.path.join("bin", "test_package")
-            handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler"
-            handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe)
-            self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True)
+            handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler"e)
+            self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_exe), run_environment=True)

the following error occurs:

----Running------
> bin/test_package test_env/db crashpad_handler
-----------------
[23258:23258:20210527,173156.407616:FATAL double_fork_and_exec.cc:131] execv crashpad_handler: No such file or directory (2)

@@ -0,0 +1,32 @@
sources:
"0.4.9":
Copy link
Contributor

Choose a reason for hiding this comment

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

Why pulling sentry-native instead of just the submodule?
https://github.com/getsentry/crashpad
Is it because of the tags/releases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That repo does no releases and has no stable branches.
They rebase on top of google crashpad's master.

uilianries
uilianries previously approved these changes May 28, 2021

def requirements(self):
self.requires("zlib/1.2.11")
if self.options.with_tls:
Copy link
Contributor

@ericriff ericriff May 28, 2021

Choose a reason for hiding this comment

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

Why do you condition openssl requirement with an option?
According to the sources it will always look for it on Linux and Android. It could end up picking up the system instal of if this option is set to false.
https://github.com/getsentry/crashpad/blob/getsentry/CMakeLists.txt#L27

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it.
By patching the cmake script, it can be kept as an option.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why changing the default behavior with an option?

Copy link
Contributor

@SpaceIm SpaceIm May 28, 2021

Choose a reason for hiding this comment

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

because default behavior is bad, unpredictable.

For package managers:
bad build system design: try to find a dependency and disable a feature if not found
good build system design: enable an option, hard fail if requirements for this option are not met

Copy link
Contributor

Choose a reason for hiding this comment

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

Strong argument haha

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that's the reason.

I think openssl is only used by the crashpad_handler executable. Not by the library.

@madebr madebr dismissed stale reviews from uilianries and prince-chrismc via a073b4c May 28, 2021 14:24
ericriff
ericriff previously approved these changes May 28, 2021
@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

All green in build 10 (2f936f825157709c623a0a030a7c5061adededbe):

  • sentry-crashpad/0.4.9@:
    All packages built successfully! (All logs)

  • sentry-crashpad/0.4.8@:
    All packages built successfully! (All logs)

  • sentry-crashpad/0.4.7@:
    All packages built successfully! (All logs)

  • sentry-crashpad/0.2.6@:
    All packages built successfully! (All logs)

  • sentry-crashpad/0.4.1@:
    All packages built successfully! (All logs)

@conan-center-bot conan-center-bot merged commit 4290cf6 into conan-io:master May 29, 2021
@madebr madebr deleted the sentry_crashpad branch May 29, 2021 12:02
madebr added a commit to madebr/conan-center-index that referenced this pull request Jun 21, 2021
* sentry-crashpad: add sentry-crashpad recipe

* sentry-crashpad: fix 0.2.9

* sentry-crashpad: drop Apple

* sentry-crashpad: require at least MSVC2017

* sentry-crashpad: copy correct license

* sentry-crashpad: with_tls is only valid for Linux and Android

* sentry-native: fix usage of with_tls
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.

9 participants