I’m trying to add debug symbols to a customized version of a nixpkgs
package, as an output package of a flake. The customization (which I achieve with override
) seems to interfere with the debug-symbol-enabling (which I achieve with overrideAttrs
).
Steps to reproduce
Note: this takes a non-trivial amount of time to compile (around 45 minutes on a GHA Linux runner; a few minutes on my development machine):
nix build github:jacg/nain4/missing-debug-symbols#my-geant4
gdb result/lib/libG4event.so
and gdb
output contains the disappointing line
(No debugging symbols found in result/lib/libG4event.so)
However, repeating the same exercise with
nix build github:jacg/nain4/present-debug-symbols#my-geant4
(instead of missing-debug-symbols
) gives a result with debug symbols.
Details
I have a flake which provides a customized version of pkgs.geant4
:
let
...
g4 = { thread ? false , qt ? false, ...etc... }:
(pkgs.geant4.override {
enableMultiThreading = thread;
enableQt = qt;
...etc...
});
my-geant4 = g4 { qt = true; ...etc... };
in {
packages.my-geant4 = my-geant4;
}
I want debug symbols to be included, which I try to achieve by overriding the dontStrip
and cmakeBuildType
attributes:
g4 = { thread ? false , qt ? false, ...etc... }:
...
- });
+ }).overrideAttrs (oldAttrs: {
+ dontStrip = true;
+ cmakeBuildType = "Debug";
+ });
but this produces results without debug symbols. However, if I remove the customization, leaving only
the debug-symbol-enabling overrideAttrs
:
my-geant4 = pkgs.geant4.overrideAttrs (oldAttrs: {
dontStrip = true;
cmakeBuildType = "Debug";
});
in {
packages.my-geant4 = my-geant4;
}
then the symbols appear in the result.