I’m writing some C++ code that uses a framework (Geant4) which I have installed from nixpkgs. Debug symbols seem to be missing. How would I go about adding them?
I would expect debug symbols to be needed quite frequently, and therefore I would hope that there is a simple switch for enabling them, but if there is such a thing, I haven’t managed to find it.
In my specific case, Geant4 is compiled with cmake, so I guess that I could
add an overlay which adds -DCMAKE_BUILD_TYPE=Debug to cmakeFlags
Unless you want to run a debug build of the library, you probably just want debug information, which can be enabled using separateDebugInfo, which is described in the manual:
Unfortunately, this is only enabled for a small number of derivations in nixpkgs (e.g. glibc), so for all other packages this means that you have to rebuild them. IIRC the main concern for enabling separate debug info for all packages was the amount of storage required in the binary cache.
There is also a nice FUSE filesystem dwarffs, which will automatically download debug info for the packages for which it is available when using gdb: