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

Debug symbols not available despite following manual #51872

Open
vandenoever opened this issue Dec 11, 2018 · 7 comments
Open

Debug symbols not available despite following manual #51872

vandenoever opened this issue Dec 11, 2018 · 7 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@vandenoever
Copy link
Contributor

Issue description

I'd like to debug an application on NixOS. The application crashes in libQt5Script.so.5 from the package qtscript. I've looked at the manual for adding debug symbols.

Simply adding environment.enableDebugInfo = true does not give me the debug symbols.

A second attempt is to use packageOverrides. I've explicitly put separateDebugInfo = true; in the qtscript package. But it still does not let nixos-rebuild install any debug info.

This is the relevant fragment from /etc/nixos/configuration.nix:

  environment.enableDebugInfo = true;
  nixpkgs.config.packageOverrides = pkgs: {
    qt5 = pkgs.qt5 // {
      qtscript = pkgs.qt5.qtscript.overrideAttrs (attrs: {
        separateDebugInfo = true;
      });
    };
    qt511 = pkgs.qt511 // {
      qtscript = pkgs.qt511.qtscript.overrideAttrs (attrs: {
        separateDebugInfo = true;
      });
    };
  };

Technical details

 - system: `"x86_64-linux"`
 - host os: `Linux 4.18.20, NixOS, 18.09.1636.b144dfa3b27 (Jellyfish)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.1.3`
 - channels(root): `"nixos-18.09.1636.b144dfa3b27"`
 - channels(oever): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@symphorien
Copy link
Member

The separate debug files provided for qtscript are empty shells containing no actual debug symbols.

$  tree -as /nix/store/ix8vc9krrsajbfn2rcn118hgr2g0f9vw-qtscript-5.11.1-debug/lib/debug                          
/nix/store/ix8vc9krrsajbfn2rcn118hgr2g0f9vw-qtscript-5.11.1-debug/lib/debug
├── [       4096]  .build-id
│   ├── [       4096]  8c
│   │   └── [       2680]  f0d4a5c60e629b4c9b241539710e5e9e9bd1de.debug
│   └── [       4096]  f0
│       └── [       2680]  b975465eef50ed3be72bf9d6a697f44e8fc1d9.debug
├── [         57]  libQt5Script.so.5.11.1 -> .build-id/8c/f0d4a5c60e629b4c9b241539710e5e9e9bd1de.debug
└── [         57]  libQt5ScriptTools.so.5.11.1 -> .build-id/f0/b975465eef50ed3be72bf9d6a697f44e8fc1d9.debug

Probably qtScrip's build system already strips the libs aggressively before the fixupPhase saves the debug info in the separate output ?

@symphorien
Copy link
Member

Also maybe you will find this article of interest: https://nixos.wiki/wiki/Debug_Symbols

@vandenoever
Copy link
Contributor Author

The Debug_Symbols article has educated me some.

I've tried to read the derivation for the QtScript on my system, but it's missing:

$ realpath "$(type -P "kmail")"
/nix/store/37angcmf0npkfxa3m7rr988na52pcln1-kmail-18.08.0/bin/kmail
$ ldd /nix/store/37angcmf0npkfxa3m7rr988na52pcln1-kmail-18.08.0/bin/kmail | grep qtscript
        libQt5Script.so.5 => /nix/store/vk1ifz8540zrzchs93y6z07wfxmwh62k-qtscript-5.11.1/lib/libQt5Script.so.5 (0x00007f41e994f000)
$ nix-store --query --deriver /nix/store/vk1ifz8540zrzchs93y6z07wfxmwh62k-qtscript-5.11.1/
/nix/store/92jkrjd1hx2df3l4c2mvdwgirj95cn8v-qtscript-5.11.1.drv
$ ls /nix/store/92jkrjd1hx2df3l4c2mvdwgirj95cn8v-qtscript-5.11.1.drv
ls: cannot access '/nix/store/92jkrjd1hx2df3l4c2mvdwgirj95cn8v-qtscript-5.11.1.drv': No such file or directory

@symphorien
Copy link
Member

afaik derivations don't always live on disk, sometimes they are only in the nix database. Does nix show-derivation still work ?
In any case, you can probably download the .drv from the cache with nix copy.

@stale
Copy link

stale bot commented Jun 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2020
@waldheinz
Copy link
Contributor

I think the problem is that environment.enableDebugInfo pulls in debug info only for packages that are directly listed in environment.systemPackages, not their dependencies.

So having separateDebugInfo = true on a lib causes the debug output to be built, but because nobody lists a lib in systemPackages, the enableDebugInfo flag does not cause that output to be pulled in. Listing a lib in systemPackages causes the debug info to be available. I just verified this for another lib because I did not want to wait for qt to compile.

Following the code through debug-info.nix, system-path.nix and finally buildenv/default.nix shows that this is what happens.

The documentation for environment.enableDebugInfo is not explicit if this is the intended behavior, but it sure came as a surprise for me just like @vandenoever .

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 4, 2021
@stale
Copy link

stale bot commented Aug 4, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

3 participants