Snap explicitly stripping debug symbols
Metadata
Current evaluation
Closed as invalid. Snapcraft does not strip symbols; the issue stemmed from deprecated --gdb usage and snapd confinement. The reporter opened a new issue #5652 to track --gdbserver debugging support.
Suggested action: —
No scores available.
Issue body
### Bug Description
I replaced `-DCMAKE_BUILD_TYPE` to `RelWithDebInfo` and remove `-s` from `LDFLAGS` on `snapcraft.yaml` from https://github.com/telegramdesktop/tdesktop
But build result hasn't any debug symbols.
### To Reproduce
```
git clone https://github.com/telegramdesktop/tdesktop
cd ./tdesktop
```
Replace `snapcraft.yaml` to code below.
```
snapcraft
```
After build is complete:
```
sudo snap install --dangerous _recently_built_snap_.snap
gdb telegram-desktop
```
### Environment
snapcraft 8.10.2
KUbuntu 25.04
### snapcraft.yaml
```yaml
name: telegram-desktop
adopt-info: telegram
base: core24
grade: stable
confinement: strict
compression: lzo
apps:
telegram-desktop:
command: usr/bin/telegram-desktop
common-id: org.telegram.desktop
desktop: usr/share/applications/org.telegram.desktop.desktop
autostart: telegram-desktop_telegram-desktop.desktop
extensions: [gnome]
plugs:
- audio-playback
- audio-record
- camera
- hardware-observe
- home
- network
- network-bind
- network-status
- removable-media
- unity7
slots:
- mpris
parts:
telegram:
plugin: cmake
source: .
source-type: git
parse-info: [usr/share/metainfo/org.telegram.desktop.metainfo.xml]
build-environment:
- LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
- LDFLAGS: ${LDFLAGS:+$LDFLAGS} -Wl,-push-state,-no-as-needed,-ldav1d,-lhwy,-pop-state
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/
- -DTDESKTOP_API_ID=611335
- -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
override-pull: |
craftctl default
version_file=Telegram/build/version
version=$(sed -n "s/AppVersionStr[ ]\+\(.*\)\+/\1/p" $version_file)
beta=$(sed -n "s/BetaChannel[ ]\+\(.*\)\+/\1/p" $version_file)
if [ "$beta" != "0" ]; then
version="$version-beta"
fi
version="${version}$(git describe --tags | sed 's,^v[^-]\+,,')"
craftctl set version="$version"
override-build: |
craftctl default
mv "$CRAFT_PART_INSTALL"/usr/bin/{Telegram,telegram-desktop}
APP_ID=org.telegram.desktop
sed -i "s/^Icon=$APP_ID$/Icon=snap.telegram-desktop./g" "$CRAFT_PART_INSTALL/usr/share/applications/$APP_ID.desktop"
for i in $(find "$CRAFT_PART_INSTALL/usr/share/icons" -name "$APP_ID*.svg" -o -name "$APP_ID*.png"); do
PREFIXED="$(dirname "$i")/snap.$CRAFT_PROJECT_NAME.$(basename "$i" | sed "s/$APP_ID//")"
mv "$i" "$PREFIXED"
DEST="$(dirname "$i" | sed 's@usr/share@meta/gui@')"
mkdir -p "$DEST"
cp -r "$PREFIXED" "$DEST"
done
after:
- ada
- avif
- ffmpeg
- geoclue
- jpegli
- openal
- protobuf
- qt
- rnnoise
- tde2e
- webrtc
pkgs:
plugin: nil
build-packages:
- clang
- gperf
- nasm
- wget
- libboost-regex-dev
- libdav1d-dev
- libheif-dev
- libhwy-dev
- libjxl-dev
- libopenh264-dev
- libopus-dev
- libpipewire-0.3-dev
- libssl-dev
- libvdpau-dev
- libvpx-dev
- libxcb-cursor-dev
- libxcb-glx0-dev
- libxcb-icccm4-dev
- libxcb-image0-dev
- libxcb-keysyms1-dev
- libxcb-randr0-dev
- libxcb-record0-dev
- libxcb-render-util0-dev
- libxcb-screensaver0-dev
- libxcb-shape0-dev
- libxcb-sync-dev
- libxcb-util-dev
- libxcb-xfixes0-dev
- libxcb-xkb-dev
- libxkbcommon-x11-dev
- libxv-dev
stage-packages:
- libopenh264-7
- libxcb-cursor0
- libxcb-glx0
- libxcb-randr0
- libxcb-record0
- libxcb-screensaver0
- libxcb-sync1
- libxcb-xfixes0
patches:
source: https://github.com/desktop-app/patches.git
source-depth: 1
source-commit: 1ffcb17817a2cab167061d530703842395291e69
plugin: dump
override-pull: |
craftctl default
cp -r . "$CRAFT_STAGE/patches"
override-prime: |
rm -rf patches
stage: [-./*]
ada:
source: https://github.com/ada-url/ada.git
source-depth: 1
source-tag: v3.2.4
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -DADA_TESTING=OFF
- -DADA_TOOLS=OFF
- -DADA_INCLUDE_URL_PATTERN=OFF
prime: [-./*]
avif:
source: https://github.com/AOMediaCodec/libavif.git
source-depth: 1
source-tag: v1.3.0
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -DBUILD_SHARED_LIBS=OFF
- -DAVIF_CODEC_DAV1D=SYSTEM
- -DAVIF_LIBYUV=OFF
prime: [-./*]
after:
- pkgs
ffmpeg:
source: https://github.com/FFmpeg/FFmpeg.git
source-depth: 1
source-branch: n6.1.1
plugin: autotools
autotools-configure-parameters:
- --prefix=/usr
- --libdir=/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
- --extra-cflags="-DCONFIG_SAFE_BITSTREAM_READER=1"
- --extra-cxxflags="-DCONFIG_SAFE_BITSTREAM_READER=1"
- --disable-debug
- --disable-programs
- --disable-doc
- --disable-network
- --disable-autodetect
- --disable-everything
- --enable-libdav1d
- --enable-libopenh264
- --enable-libopus
- --enable-libvpx
- --enable-vaapi
- --enable-vdpau
- --enable-xlib
- --enable-libdrm
- --enable-ffnvcodec
- --enable-nvdec
- --enable-cuvid
- --enable-protocol=file
- --enable-hwaccel=av1_vaapi
- --enable-hwaccel=av1_nvdec
- --enable-hwaccel=h264_vaapi
- --enable-hwaccel=h264_vdpau
- --enable-hwaccel=h264_nvdec
- --enable-hwaccel=hevc_vaapi
- --enable-hwaccel=hevc_vdpau
- --enable-hwaccel=hevc_nvdec
- --enable-hwaccel=mpeg2_vaapi
- --enable-hwaccel=mpeg2_vdpau
- --enable-hwaccel=mpeg2_nvdec
- --enable-hwaccel=mpeg4_vaapi
- --enable-hwaccel=mpeg4_vdpau
- --enable-hwaccel=mpeg4_nvdec
- --enable-hwaccel=vp8_vaapi
- --enable-hwaccel=vp8_nvdec
- --enable-decoder=aac
- --enable-decoder=aac_fixed
- --enable-decoder=aac_latm
- --enable-decoder=aasc
- --enable-decoder=ac3
- --enable-decoder=alac
- --enable-decoder=av1
- --enable-decoder=av1_cuvid
- --enable-decoder=eac3
- --enable-decoder=flac
- --enable-decoder=gif
- --enable-decoder=h264
- --enable-decoder=hevc
- --enable-decoder=libdav1d
- --enable-decoder=libvpx_vp8
- --enable-decoder=libvpx_vp9
- --enable-decoder=mp1
- --enable-decoder=mp1float
- --enable-decoder=mp2
- --enable-decoder=mp2float
- --enable-decoder=mp3
- --enable-decoder=mp3adu
- --enable-decoder=mp3adufloat
- --enable-decoder=mp3float
- --enable-decoder=mp3on4
- --enable-decoder=mp3on4float
- --enable-decoder=mpeg4
- --enable-decoder=msmpeg4v2
- --enable-decoder=msmpeg4v3
- --enable-decoder=opus
- --enable-decoder=pcm_alaw
- --enable-decoder=pcm_f32be
- --enable-decoder=pcm_f32le
- --enable-decoder=pcm_f64be
- --enable-decoder=pcm_f64le
- --enable-decoder=pcm_lxf
- --enable-decoder=pcm_mulaw
- --enable-decoder=pcm_s16be
- --enable-decoder=pcm_s16be_planar
- --enable-decoder=pcm_s16le
- --enable-decoder=pcm_s16le_planar
- --enable-decoder=pcm_s24be
- --enable-decoder=pcm_s24daud
- --enable-decoder=pcm_s24le
- --enable-decoder=pcm_s24le_planar
- --enable-decoder=pcm_s32be
- --enable-decoder=pcm_s32le
- --enable-decoder=pcm_s32le_planar
- --enable-decoder=pcm_s64be
- --enable-decoder=pcm_s64le
- --enable-decoder=pcm_s8
- --enable-decoder=pcm_s8_planar
- --enable-decoder=pcm_u16be
- --enable-decoder=pcm_u16le
- --enable-decoder=pcm_u24be
- --enable-decoder=pcm_u24le
- --enable-decoder=pcm_u32be
- --enable-decoder=pcm_u32le
- --enable-decoder=pcm_u8
- --enable-decoder=pcm_zork
- --enable-decoder=vorbis
- --enable-decoder=vp8
- --enable-decoder=wavpack
- --enable-decoder=wmalossless
- --enable-decoder=wmapro
- --enable-decoder=wmav1
- --enable-decoder=wmav2
- --enable-decoder=wmavoice
- --enable-encoder=aac
- --enable-encoder=libopenh264
- --enable-encoder=libopus
- --enable-encoder=pcm_s16le
- --enable-filter=atempo
- --enable-parser=aac
- --enable-parser=aac_latm
- --enable-parser=flac
- --enable-parser=gif
- --enable-parser=h264
- --enable-parser=hevc
- --enable-parser=mpeg4video
- --enable-parser=mpegaudio
- --enable-parser=opus
- --enable-parser=vorbis
- --enable-demuxer=aac
- --enable-demuxer=flac
- --enable-demuxer=gif
- --enable-demuxer=h264
- --enable-demuxer=hevc
- --enable-demuxer=matroska
- --enable-demuxer=m4v
- --enable-demuxer=mov
- --enable-demuxer=mp3
- --enable-demuxer=ogg
- --enable-demuxer=wav
- --enable-muxer=mp4
- --enable-muxer=ogg
- --enable-muxer=opus
- --enable-muxer=wav
override-pull: |
craftctl default
sed -i 's/disable ffnvcodec cuvid nvdec nvenc/:/g' configure
prime: [-./*]
after:
- nv-codec-headers
- pkgs
geoclue:
plugin: nil
stage-packages:
- libgeoclue-2-0
stage:
- ./usr/lib/x86_64-linux-gnu/libgeoclue-2.so*
jpegli:
source: https://github.com/libjxl/libjxl.git
source-depth: 1
source-tag: v0.11.1
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -DBUILD_SHARED_LIBS=OFF
- -DBUILD_TESTING=OFF
- -DJPEGXL_ENABLE_DEVTOOLS=OFF
- -DJPEGXL_ENABLE_TOOLS=OFF
- -DJPEGXL_INSTALL_JPEGLI_LIBJPEG=ON
- -DJPEGXL_ENABLE_DOXYGEN=OFF
- -DJPEGXL_ENABLE_MANPAGES=OFF
- -DJPEGXL_ENABLE_BENCHMARK=OFF
- -DJPEGXL_ENABLE_EXAMPLES=OFF
- -DJPEGXL_ENABLE_JNI=OFF
- -DJPEGXL_ENABLE_SJPEG=OFF
- -DJPEGXL_ENABLE_OPENEXR=OFF
- -DJPEGXL_ENABLE_SKCMS=OFF
- -DJPEGXL_FORCE_SYSTEM_BROTLI=ON
- -DJPEGXL_FORCE_SYSTEM_LCMS2=ON
- -DJPEGXL_FORCE_SYSTEM_HWY=ON
override-build: |
craftctl default
cp lib/libjpegli-static.a "$CRAFT_PART_INSTALL"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libjpeg.a
ar rcs "$CRAFT_PART_INSTALL"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libjpeg.a lib/CMakeFiles/jpegli-libjpeg-obj.dir/jpegli/libjpeg_wrapper.cc.o
stage:
- ./usr/include/jconfig.h
- ./usr/include/jmorecfg.h
- ./usr/include/jpeglib.h
- ./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libjpeg.a
prime: [-./*]
after:
- pkgs
openal:
source: https://github.com/kcat/openal-soft.git
source-depth: 1
source-tag: 1.24.3
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -DLIBTYPE=STATIC
- -DALSOFT_DLOPEN=OFF
- -DALSOFT_EXAMPLES=OFF
- -DALSOFT_UTILS=OFF
- -DALSOFT_INSTALL_CONFIG=OFF
- -DALSOFT_BACKEND_PIPEWIRE=OFF
prime: [-./*]
after:
- pkgs
nv-codec-headers:
source: https://github.com/FFmpeg/nv-codec-headers.git
source-depth: 1
source-branch: n12.1.14.0
plugin: make
make-parameters:
- PREFIX=/usr
- LIBDIR=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
prime: [-./*]
protobuf:
source: https://github.com/protocolbuffers/protobuf.git
source-depth: 1
source-tag: v30.2
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -Dprotobuf_BUILD_TESTS=OFF
prime: [-./*]
after:
- pkgs
qt:
source: https://github.com/qt/qt5.git
source-depth: 1
source-tag: v6.9.1
source-submodules:
- qtbase
- qtdeclarative
- qtimageformats
- qtshadertools
- qtsvg
- qtwayland
plugin: cmake
build-environment:
- LDFLAGS: ${LDFLAGS:+$LDFLAGS} -Wl,-push-state,-no-as-needed,-lhwy,-pop-state
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -DINSTALL_LIBDIR=/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
- -DBUILD_SHARED_LIBS=OFF
- -DQT_QPA_PLATFORMS="wayland;xcb"
- -DFEATURE_eglfs=OFF
- -DINPUT_openssl=linked
override-pull: |
craftctl default
QT="$(grep 'set(QT_REPO_MODULE_VERSION' qtbase/.cmake.conf | sed -r 's/.*"(.*)".*/\1/')"
cd qtbase
find $CRAFT_STAGE/patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply
cd ../qtwayland
find $CRAFT_STAGE/patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply
cd ..
prime: [-./*]
after:
- jpegli
- patches
- pkgs
rnnoise:
source: https://github.com/xiph/rnnoise.git
source-depth: 1
source-tag: v0.2
plugin: autotools
autotools-configure-parameters:
- --prefix=/usr
- --libdir=\${exec_prefix}/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
- --disable-shared
- --disable-examples
- --disable-doc
override-pull: |
craftctl default
sed -i 's/os_support.h/common.h/g;s/OPUS_CLEAR/RNN_CLEAR/g' src/vec{,_neon}.h
prime: [-./*]
after:
- pkgs
systemd:
plugin: nil
stage-packages:
- systemd
stage:
- ./usr/bin/systemd-detect-virt
tde2e:
source: https://github.com/tdlib/td.git
source-depth: 1
source-commit: 51743dfd01dff6179e2d8f7095729caa4e2222e9
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_INSTALL_LIBDIR=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
- -DTD_E2E_ONLY=ON
prime: [-./*]
after:
- pkgs
webrtc:
source: https://github.com/desktop-app/tg_owt.git
source-depth: 1
source-commit: 62321fd7128ab2650b459d4195781af8185e46b5
plugin: cmake
cmake-generator: Ninja
cmake-parameters:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_INSTALL_PREFIX=/usr
prime: [-./*]
after:
- ffmpeg
- jpegli
- pkgs
```
### Relevant log output
```shell
GNU gdb (Ubuntu 16.2-8ubuntu1) 16.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from telegram-desktop...
(No debugging symbols found in telegram-desktop)
```
### Additional context
_No response_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed as invalid. Snapcraft does not strip symbols; the issue stemmed from deprecated --gdb usage and snapd confinement. The reporter opened a new issue #5652 to track --gdbserver debugging support. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as not a Snapcraft issue. Symbols were not stripped by Snapcraft; the failure resulted from deprecated snap run --gdb sandboxing restrictions. The reporter opened a new issue to track --gdbserver debugging support. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as not a Snapcraft bug. Maintainers found no evidence of symbol stripping and attributed the issue to snapd or GDB invocation. The reporter confirmed --gdb is deprecated and opened new bug reports for snapd and a new snapcraft issue. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as not a Snapcraft bug. Debug symbol loss was attributed to snapd runtime behavior and deprecated --gdb usage. User confirmed the deprecation, switched to --gdbserver, and filed new reports for snapd and Snapcraft. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as no evidence of Snapcraft stripping symbols. The problem was identified as a snapd debugging workflow issue, not a build bug. Maintainers recommended using --gdbserver instead of the deprecated --gdb flag, leading the author to open a new issue #5652. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #5652 Snaps can't be debugged via gdb even in `Debug` builds. | snapcraft | open | GDB fails to load symbols from large snap Debug binaries via remote gdbserver. Investigation showed it's a GDB limitation with large debug binaries over remote connections, not a snapcraft/snapd bug. Stalled ~12 months awaiting a minimal non-snap repro to file with GDB. | |
| #2120751 Snaps can't be debugged via gdb even in Debug builds. | snapcraft (launchpad) | open | Debugging snaps via gdb fails even in Debug builds. Issue references snapcraft#5652 which appears to be the same issue, stalled for ~12 months awaiting a minimal repro for GDB. | |
| #2875 split debug information | snapcraft | closed | Experimental feature to strip debug symbols from ELF files and reduce snap sizes. The pull request was closed and superseded by #2910. |