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

Broken sentry-config.cmake when using crashpad #504

Closed
1 of 3 tasks
ericriff opened this issue Mar 29, 2021 · 1 comment · Fixed by #522
Closed
1 of 3 tasks

Broken sentry-config.cmake when using crashpad #504

ericriff opened this issue Mar 29, 2021 · 1 comment · Fixed by #522

Comments

@ericriff
Copy link

Description

find_package(sentry CONFIG) is broken if crashpad is used as backend since a library and an executable with the same name get exported in lib/cmake/sentry/sentry_crashpad-targets.cmake:

# Create imported target sentry_crashpad::handler
add_library(sentry_crashpad::handler STATIC IMPORTED)

set_target_properties(sentry_crashpad::handler PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:>;sentry_crashpad::compat;sentry_crashpad::minidump;sentry_crashpad::snapshot;sentry_crashpad::util;sentry_crashpad::mini_chromium"
)

# Create imported target sentry_crashpad::handler
add_executable(sentry_crashpad::handler IMPORTED)

Which leads to the following error when consuming sentry-config.cmake:

-- The CXX compiler identification is GNU 8.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /home/eric/setry-native/install/lib/cmake/sentry/sentry_crashpad-targets.cmake:120 (add_executable):
  add_executable cannot create imported target "sentry_crashpad::handler"
  because another target with the same name already exists.
Call Stack (most recent call first):
  /home/eric/setry-native/install/lib/cmake/sentry/sentry-config.cmake:34 (include)
  CMakeLists.txt:11 (find_package)
  • During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: Ubuntu 18
  • Compiler: gcc 8
@ericriff
Copy link
Author

It seems to come from this PR getsentry/crashpad#14

Locally I managed to work around this issue by changing this line
https://github.com/getsentry/crashpad/blob/getsentry/handler/CMakeLists.txt#L113
To
set_property(TARGET crashpad_handler PROPERTY EXPORT_NAME crashpad_handler)
Which would be the same as removing it. I don't know the implications of this.

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 a pull request may close this issue.

1 participant