Skip to content

Commit

Permalink
Turn off debug symbols for snaps (#7256)
Browse files Browse the repository at this point in the history
There isn't currently a good way to package debuginfo and symbols for snaps. Since we're building with full symbols in cargo and they aren't being stripped out during the snap build, our snap packages are much larger than they should be. This change disables the [debug](https://doc.rust-lang.org/cargo/reference/profiles.html#debug) setting in the cargo release profile for snaps only.

To test, I built the amd64 snap locally with these changes. It went from 78 MB down to 21 MB. I also ran ran the end-to-end tests against built packages and confirmed everything passes.

## Azure IoT Edge PR checklist:
  • Loading branch information
damonbarry authored Apr 2, 2024
1 parent 00e96ed commit 6cf7520
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
52 changes: 26 additions & 26 deletions edgelet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions edgelet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ panic = 'abort'
panic = 'abort'
# Release builds will have full symbols. The packaging phase will strip symbols from binaries and
# make them available in a separate package.
# Notes: Snaps don't have a good story for debug symbols, so for now we'll override this setting in
# the snapcraft.yaml file by setting CARGO_PROFILE_RELEASE_DEBUG=0.
debug = 2
1 change: 1 addition & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ parts:
- USER_AZIOTID: "root"
- USER_AZIOTTPM: "root"
- USER_IOTEDGE: "snap_aziotedge"
- CARGO_PROFILE_RELEASE_DEBUG: 0
override-build: |
rm -rf $CRAFT_PART_BUILD/target
SC_VERSION="$(cat $CRAFT_PART_SRC/version.txt)"
Expand Down

0 comments on commit 6cf7520

Please sign in to comment.