Skip to content

Commit

Permalink
strip debug symbols from binary
Browse files Browse the repository at this point in the history
Contributes to CURA-11482
  • Loading branch information
jellespijker committed Jan 13, 2024
1 parent 0e3e872 commit 09f3114
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from conan.tools.files import copy, AutoPackager, update_conandata
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version, Git
from conans.errors import ConanInvalidSystemRequirements
from conans.tools import which

required_conan_version = ">=1.55.0"

Expand Down Expand Up @@ -125,11 +125,18 @@ def build(self):
sentry_project = self.conf.get("user.curaengine:sentry_project", "", check_type=str)
sentry_org = self.conf.get("user.curaengine:sentry_org", "", check_type=str)
if sentry_project == "" or sentry_org == "":
raise ConanInvalidConfiguration("sentry_project is not set")
output = StringIO()
self.run(f"sentry-cli -V", output=output)
if "sentry-cli" not in output.getvalue():
raise ConanInvalidSystemRequirements("sentry-cli is not installed")
raise ConanInvalidConfiguration("sentry_project or sentry_org is not set")
if which("sentry-cli") is None:
self.output.warn("sentry-cli is not installed, skipping uploading debug symbols")
return

if self.settings.os == "Linux":
self.output.info("Stripping debug symbols from binary")
ext = ".so" if self.options.shared else ".a"
self.run(f"objcopy --only-keep-debug --compress-debug-sections=zlib libArcus{ext} libArcus.debug")
self.run(f"objcopy --strip-debug --strip-unneeded libArcus{ext}")
self.run("objcopy --add-gnu-debuglink=libArcus.debug libArcus{ext}")

build_source_dir = self.build_path.parent.parent.as_posix()
self.output.info("Uploading debug symbols to sentry")
self.run(f"sentry-cli debug-files upload --include-sources -o {sentry_org} -p {sentry_project} {build_source_dir}")
Expand Down

0 comments on commit 09f3114

Please sign in to comment.