Problem enabling debugging symbols on Mac OS Catalina

Hello there!

I was playing around with enabling debugging symbols for a package and bumped into Debug Symbols - NixOS Wiki

So i tried with a simple example:

nix-build -E 'with import <nixpkgs> {}; enableDebugging hello'

This compiles fine, but when I open it with gdb this is what happens:

$ gdb /nix/store/cxd2mxzy6zxsjig914cqcic2afbj3rbq-hello-2.10/bin/hello
GNU gdb (GDB) 10.1
Copyright (C) 2020 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-apple-darwin19.6.0".
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 /nix/store/cxd2mxzy6zxsjig914cqcic2afbj3rbq-hello-2.10/bin/hello...

warning: Could not open OSO archive file "/private/var/folders/9h/0j3p28r17xv2_rd06db5548h0000gn/T/nix-build-hello-2.10.drv-0/hello-2.10/./lib/libhello.a"

warning: `/private/var/folders/9h/0j3p28r17xv2_rd06db5548h0000gn/T/nix-build-hello-2.10.drv-0/hello-2.10/src/hello.o': can't open to read symbols: No such file or directory.
(No debugging symbols found in /nix/store/cxd2mxzy6zxsjig914cqcic2afbj3rbq-hello-2.10/bin/hello)

It appears that the debug info has been installed in temp folder which has since been deleted. Is this process not supported on Mac OS?


Here are some debug infos:

# Mac OS X version: Catalina 10.15.7

$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz
nixpkgs https://nixos.org/channels/nixpkgs-20.09-darwin

$ ls -l $(readlink -f ~/.nix-defexpr/channels/)
total 0
lrwxr-xr-x 1 arkham wheel 75 Jan  1  1970 home-manager -> /nix/store/njwlw5myd2s5v9dpzl6rg154y05xr7mx-home-manager-20.09/home-manager/
lrwxr-xr-x 1 arkham wheel 60 Jan  1  1970 manifest.nix -> /nix/store/k0f0va5lpfzg6phzwqq5xf839j1wx0gy-env-manifest.nix
lrwxr-xr-x 1 arkham wheel 86 Jan  1  1970 nixpkgs -> /nix/store/9hwyaiaa2inbbs5fwnplvqpxmlfhkcr6-nixpkgs-20.09pre246348.d395190b24b/nixpkgs/

# from https://discourse.nixos.org/t/how-to-see-what-commit-is-my-channel-on/4818/6
# it looks like the commit is https://github.com/NixOS/nixpkgs/commit/d395190b24b

I’m not sure if this helps since I haven’t played with it, but I saw a post a few days ago that may help: Adding debug symbols to package from nixpkgs - #3 by danieldk