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

msys2-runtime: attempt to use makepkg's split debuginfo feature #4596

Closed
wants to merge 2 commits into from

Conversation

jeremyd2019
Copy link
Member

To avoid additional changes to msys2-runtime's build (such as changing flags due to 'debug' being set), I didn't set debug at the top level of the PKGBUILD, but rather just in the msys2-runtime package. This means that makepkg didn't attempt to actually package an msys2-runtime-debug package, so I included the files in msys2-runtime-devel.

It doesn't look like the debug info produced is large enough to be complete, and objdump seems to back this up. Also, there are some extra files around the .exe files (whatever.exe.debug.exe in addition to some having whatever.exe.debug which is the name I would expect).

I think the makepkg procedure to produce split debuginfo is broken, but I wanted to open this as a draft to start the discussion.

Fixes #4595

To avoid additional changes to msys2-runtime's build (such as changing flags due to 'debug' being set), I didn't set debug at the top level of the PKGBUILD, but rather just in the msys2-runtime package.  This means that makepkg didn't attempt to actually package an msys2-runtime-debug package, so I included the files in msys2-runtime-devel.
My theory for msys2/msys2-pacman#52 is that the logic for identifying files that need to be stripped is picking up the .debug files, resulting the the debug info being stripped from them.  Try not stripping msys2-runtime-devel to see if the debug info is intact.
@jeremyd2019
Copy link
Member Author

jeremyd2019 commented May 14, 2024

An alternative to this approach would be the below patch, which results in the same msys-2.0.dbg file as before. I don't know which would be preferred.

diff --git a/msys2-runtime/PKGBUILD b/msys2-runtime/PKGBUILD
index a889ddf9279..787a1fcda38 100644
--- a/msys2-runtime/PKGBUILD
+++ b/msys2-runtime/PKGBUILD
@@ -4,7 +4,7 @@
 pkgbase=msys2-runtime
 pkgname=('msys2-runtime' 'msys2-runtime-devel')
 pkgver=3.5.3
-pkgrel=2
+pkgrel=3
 pkgdesc="Cygwin POSIX emulation engine"
 arch=('x86_64')
 url="https://www.cygwin.com/"
@@ -214,6 +214,11 @@ build() {
   LC_ALL=C make -j1 DESTDIR="${srcdir}"/dest install
 
   rm -rf "${srcdir}"/dest/etc
+
+  # split debug info from msys-2.0.dll
+  objcopy --add-gnu-debuglink=/dev/null --only-keep-debug "${srcdir}"/dest/usr/bin/msys-2.0.dll "${srcdir}"/dest/usr/bin/msys-2.0.dbg
+  objcopy -g --add-gnu-debuglink="${srcdir}"/dest/usr/bin/msys-2.0.dbg "${srcdir}"/dest/usr/bin/msys-2.0.dll "${srcdir}"/dest/usr/bin/msys-2.0.dll.new
+  mv -f "${srcdir}"/dest/usr/bin/msys-2.0.dll.new "${srcdir}"/dest/usr/bin/msys-2.0.dll
 }
 
 package_msys2-runtime() {
@@ -228,6 +233,7 @@ package_msys2-runtime() {
   rm -f "${pkgdir}"/usr/bin/cyglsa.dll
   rm -f "${pkgdir}"/usr/bin/cyglsa64.dll
   rm -f "${pkgdir}"/usr/bin/cygserver-config
+  rm -f "${pkgdir}"/usr/bin/msys-2.0.dbg
   cp -rf "${srcdir}"/dest/usr/share "${pkgdir}"/usr/
 }
 
@@ -236,8 +242,10 @@ package_msys2-runtime-devel() {
   depends=("msys2-runtime=${pkgver}")
   conflicts=('libcatgets-devel' 'msys2-runtime-3.4-devel' 'msys2-runtime-3.5-devel')
   replaces=('libcatgets-devel' 'msys2-runtime-3.5-devel')
+  options=('!strip')
 
   mkdir -p "${pkgdir}"/usr/bin
+  cp -f "${srcdir}"/dest/usr/bin/msys-2.0.dbg "${pkgdir}"/usr/bin/
   cp -rLf "${srcdir}"/dest/usr/${CHOST}/include "${pkgdir}"/usr/
   rm -f "${pkgdir}"/usr/include/iconv.h
   rm -f "${pkgdir}"/usr/include/unctrl.h

@jeremyd2019
Copy link
Member Author

I'm inclined to go with the msys-2.0.dbg version. Closing this

@jeremyd2019 jeremyd2019 deleted the jeremyd2019-msys2-runtime-debuginfo branch May 14, 2024 22:47
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.

msys2-runtime-devel: missing debug info
1 participant