sentry-rust
                                
                                 sentry-rust copied to clipboard
                                
                                    sentry-rust copied to clipboard
                            
                            
                            
                        Rust cross compiling using MinGW
Hi,
I cross compile my code from Mac OS to Windows using MinGW and the target x86_64-pc-windows-gnu.
I use the RUSTFLAGS="-g -C opt-level=3" to generate debug information when being in release mode.
Then, I run the command,
x86_64-w64-mingw32-objcopy --only-keep-debug library.dll library.debug
x86_64-w64-mingw32-objcopy --strip-debug library.dll
x86_64-w64-mingw32-objcopy --add-gnu-debuglink=library.debug library.dll
After that, I use to have the library.debug file containing all the debug information but when I want to check if it is usable by Sentry using sentry-cli difutil check library.debug I have this result,
Debug Info File Check
  Type: pe
  Contained debug identifiers:
  Contained debug information:
    > none
  Usable: no (missing debug identifier, likely stripped)
Do you know, what I can do to get the debug information send to Sentry correctly to be able to map it with my library?
I believe this is because we do not (yet) support DWARF in PE. If you want to use DWARF as debug format, it has to be in an ELF or Mach-O file. Otherwise, Windows Debug Info usually is in PDB format. I’m not too familiar with MinGW myself, but you would have to teach it to output dwarf in an elf file I presume.
Also when I use the .dll file without stripping I got this result with the sentry-cli command,
Debug Info File Check
  Type: pe library
  Contained debug identifiers:
    > Debug ID: 00000000-0000-0000-0000-000000000000
      Code ID:  6494408637f90000
      Arch:     x86_64
  Contained debug information:
    > symtab, debug, unwind
  Usable: no (missing debug identifier, likely stripped)
I have the feature debug-images.
Another problem here is also that the file is missing a DebugId.
Yep, but why is it missing? I only cross compile using Rust and MinGW.
The issue is similar with https://github.com/getsentry/sentry-rust/issues/354, wdyt?
Any news, please?
It might have something to do with the mingw tools. The issue you linked above is using cv2pdb to create a pdb file, which appears to be usable.
Another member of our team is trying to reproduce this.
Ok, thx, if you need any help please keep in touch with me.
The team has had a look at this and we were able to reproduce this, though did not find a proper way to make this work.
In general we appreciate community contributions related to MinGW very much, but we do not actively support it, neither for the native SDK nor for Rust.
MinGW in general is a very broad target with a diverse set of tools. In general we need debug files/formats in their "native" container type. Which means that PDB needs to be in a PDB file, and DWARF needs to be in either an ELF or Mach-O container. We do support using ELF/DWARF debug info in combination with a PE executable though.
So you mean I need to convert the dwarf debug info to PDB?
Either convert the whole debuginfo to pdb, or just make sure that the DWARF is in a container format that is appropriate for it, like ELF.
Is it normal that after I used the ELF debug information format, I'm also missing the Debug ID?
Debug Info File Check
  Type: elf debug companion
  Contained debug identifiers:
    > Debug ID: 00000000-0000-0000-0000-000000000000
      Arch:     x86_64
  Contained debug information:
    > symtab, debug, unwind
  Usable: no (missing debug identifier, likely stripped)
I don't know how to read 😄 , everything is written here, https://docs.sentry.io/platforms/native/guides/minidumps/data-management/debug-files/identifiers/#gnu-build-identifiers.
But after doing that, I got the identifier for the executable, such as,
Debug Info File Check
  Type: pe library
  Contained debug identifiers:
    > Debug ID: c8627651-8de4-7cb7-f6ba-dc6faa7317b0-1
      Code ID:  65099b543f203000
      Arch:     x86_64
  Contained debug information:
    > symtab, debug, unwind
  Usable: yes
But when I used the command x86_64-w64-mingw32-objcopy --only-keep-debug -O elf64-x86-64 mylib.dll mylib.dbg, I lost the debug identifier.