Skip to content

Don't define sentry_add_version_resource() command when building the static version#1084

Closed
dacap wants to merge 1 commit intogetsentry:masterfrom
aseprite:fix-sentry-rc-not-found
Closed

Don't define sentry_add_version_resource() command when building the static version#1084
dacap wants to merge 1 commit intogetsentry:masterfrom
aseprite:fix-sentry-rc-not-found

Conversation

@dacap
Copy link
Copy Markdown

@dacap dacap commented Nov 20, 2024

As crashpad now checks the existence of sentry_add_version_resource() command in:

getsentry/crashpad@8961424

We cannot define the command if the sentry.rc file is not going to be created, i.e. only the static version of Sentry is going to be built.

Without this fix we'll get the following error:

CMake Error: File .../sentry.rc.in does not exist. CMake Error at sentry-native/cmake/utils.cmake:14 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  sentry-native/external/crashpad/handler/CMakeLists.txt:118 (sentry_add_version_resource)

This regression was introduced in #1076

… static version

As crashpad now checks the existence of sentry_add_version_resource()
command in:

  getsentry/crashpad@8961424

We cannot define the command if the sentry.rc file is not going to be
created, i.e. only the static version of Sentry is going to be built.

Without this fix we'll get the following error:

CMake Error: File .../sentry.rc.in does not exist.
CMake Error at sentry-native/cmake/utils.cmake:14 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  sentry-native/external/crashpad/handler/CMakeLists.txt:118 (sentry_add_version_resource)
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.42%. Comparing base (113d261) to head (708f313).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1084      +/-   ##
==========================================
+ Coverage   82.41%   82.42%   +0.01%     
==========================================
  Files          53       53              
  Lines        7752     7751       -1     
  Branches     1216     1216              
==========================================
  Hits         6389     6389              
+ Misses       1252     1251       -1     
  Partials      111      111              
---- 🚨 Try these New Features:

@supervacuus
Copy link
Copy Markdown
Collaborator

Thanks for the report, @dacap. As you can see by the failing tests, this won't work because the crashpad artifacts are no longer versioned with your change.

The placement of the include outside the if was intentional because we added the .rc only to the crashpad_handler (an executable) and crashpad_wer.dll (a shared library by design), both of which are not affected by a static build configuration.

Even if we build shared, there is never a crashpad shared library (because all backends are linked into the main sentry library), so we don't need to differentiate between static and shared builds on the crashpad level (because the versioned artifacts are unaffected by these flags).

We cannot define the command if the sentry.rc file is not going to be created, i.e. only the static version of Sentry is going to be built.

As you can see in your error message, the problem seems to be that cmake/utils.cmake can't find sentry.rc.in in the CMAKE_SOURCE_DIR. Do you see sentry.rc.in in your CMAKE_SOURCE_DIR? It would be interesting to understand how that is possible.

We do test our builds in the static configuration: https://github.com/getsentry/sentry-native/actions/runs/11930882865/job/33252573289#step:13:180

And with the given configuration the build seems to work.

@supervacuus
Copy link
Copy Markdown
Collaborator

Do you see sentry.rc.in in your CMAKE_SOURCE_DIR? It would be interesting to understand how that is possible.

Do you add sentry as a subdirectory to your project?

@supervacuus
Copy link
Copy Markdown
Collaborator

Do you see sentry.rc.in in your CMAKE_SOURCE_DIR? It would be interesting to understand how that is possible.

Do you add sentry as a subdirectory to your project?

If yes, can you please try #1086?

@dacap
Copy link
Copy Markdown
Author

dacap commented Nov 20, 2024

If yes, can you please try #1086?

That's right, I'm using Sentry as a "subdirectory" (actually importing it from outside with add_subdirectory(${SENTRY_DIR} sentry), our CMakeLists.txt line)

I'll give a try to your PR and answer there. Thanks!

@supervacuus
Copy link
Copy Markdown
Collaborator

closing in favor of #1086

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