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
- wait 2 hours for the whole thing to compile
but I hope that there’s a better way. Is there?
Edit: See danieldk’s response after this one first
It looks like you can set the build type with
cmakeBuildType = "Debug";:
I found a small number of examples in Nixpkgs, including:
(but I doubt you’ll be spared from waiting for it to compile? Unless maybe someone’s intentionally caching debug builds?)
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