Build digikam with debug symbols?

Thanks for following up. I’ve been able to get the debugger to recognize the source code. If I remember correctly, the steps were:

  1. Clone the repo locally

  2. Edit the digikam default.nix, adding:

    NIX_CFLAGS_COMPILE="-g ";
     enableDebugging = true;
     separateDebugInfo = true;
    

    to the derivation, and "-DCMAKE_BUILD_TYPE=Debug" to the cmakeFlags.

    (I’m not sure if all of this is required)

  3. In the digikam directory, run:
    nix-build -I /home/mike/src/nixpkgs/ -E '(import <nixpkgs> { config = { cudaSupport = false; }; }).libsForQt5.callPackage ./default.nix { }'. This put the results in /nix/store/d9w4hzwb4sb42sfzg5d297j237xivl15-digikam-8.1.0.

  4. Find the debug symbols by running: nix show-derivation /nix/store/d9w4hzwb4sb42sfzg5d297j237xivl15-digikam-8.1.0| grep debug. They are in /nix/store/1c8npncnaxg9jm98bs27f1n2vl1vp5r9-digikam-8.1.0-debug`.

  5. Download the source, and apply the patch. Store the source in /build/digikam-8.1.0.

  6. At some point, I added set auto-load safe-path / to ~/.config/gdb/gdbinit to allow gdb to load the debug symbols.

  7. digikam sets up a bunch of environment variables, then runs digikam-wrapped. Capture the set-up to `~/tmp.bash~ with

head --lines=-1 /nix/store/d9w4hzwb4sb42sfzg5d297j237xivl15-digikam-8.1.0/bin/digikam > ~/tmp.bash
  1. Start a new shell and set up the environment for digikam:
    bash
    . ~/tmp.bash
    
7.  Start the program, telling `gdb` where to find the symbols:

NIX_DEBUG_INFO_DIRS=/nix/store/1c8npncnaxg9jm98bs27f1n2vl1vp5r9-digikam-8.1.0-debug/lib/debug gdb /nix/store/d9w4hzwb4sb42sfzg5d297j237xivl15-digikam-8.1.0/bin/.digikam-wrapped

8. Get the program to lock up by right-clicking in the album view, then interrupt it in the debugger and dump the backtrace:
#0  0x00007ffff3ef4c89 in ?? () from /nix/store/im7q5f5j9q8x5whs4d2hz9m8il47iidp-qtbase-5.15.3/lib/libQt5Core.so.5
#1  0x00007ffff3ef981a in QString::fromLatin1_helper(char const*, int) () from /nix/store/im7q5f5j9q8x5whs4d2hz9m8il47iidp-qtbase-5.15.3/lib/libQt5Core.so.5
#2  0x00007ffff4133a71 in ?? () from /nix/store/im7q5f5j9q8x5whs4d2hz9m8il47iidp-qtbase-5.15.3/lib/libQt5Core.so.5
#3  0x00007ffff4125f77 in ?? () from /nix/store/im7q5f5j9q8x5whs4d2hz9m8il47iidp-qtbase-5.15.3/lib/libQt5Core.so.5
#4  0x00007ffff412646b in ?? () from /nix/store/im7q5f5j9q8x5whs4d2hz9m8il47iidp-qtbase-5.15.3/lib/libQt5Core.so.5
#5  0x00007ffff4126b62 in ?? () from /nix/store/im7q5f5j9q8x5whs4d2hz9m8il47iidp-qtbase-5.15.3/lib/libQt5Core.so.5
#6  0x00007ffff584bf27 in KBuildServiceFactory::populateServiceTypes() () from /nix/store/ysablxbzzb7jys1i48cph38n7dnd1zb1-kservice-5.93.0/lib/libKF5Service.so.5
#7  0x00007ffff58535e4 in KBuildSycoca::save(QDataStream*) () from /nix/store/ysablxbzzb7jys1i48cph38n7dnd1zb1-kservice-5.93.0/lib/libKF5Service.so.5
#8  0x00007ffff5856ddd in KBuildSycoca::recreate(bool) () from /nix/store/ysablxbzzb7jys1i48cph38n7dnd1zb1-kservice-5.93.0/lib/libKF5Service.so.5
#9  0x00007ffff5836d30 in KSycocaPrivate::buildSycoca() () from /nix/store/ysablxbzzb7jys1i48cph38n7dnd1zb1-kservice-5.93.0/lib/libKF5Service.so.5
#10 0x00007ffff5837ca0 in KSycoca::ensureCacheValid() () from /nix/store/ysablxbzzb7jys1i48cph38n7dnd1zb1-kservice-5.93.0/lib/libKF5Service.so.5
#11 0x00007ffff57fa552 in KApplicationTrader::queryByMimeType(QString const&, std::function<bool (QExplicitlySharedDataPointer<KService> const&)>) ()
   from /nix/store/ysablxbzzb7jys1i48cph38n7dnd1zb1-kservice-5.93.0/lib/libKF5Service.so.5
#12 0x00007ffff662a929 in Digikam::DServiceMenu::servicesForOpenWith (urls=...) at /build/digikam-8.1.0/core/libs/threadimageio/engine/dservicemenu_linux.cpp:247

`digikam` makes a call to `KApplicationTrader::queryByMimeType`, which never returns. 

So, I've gotten past the problem raised here--thanks for your help!

I guess I need to dig deeper to solve the original problem, though. I suppose I'll need to build some of the libraries for debugging as well.
1 Like