bombela/backward-cpp

Looks like this doesn't work with more recent versions of libdwarf

fzakaria opened this issue · 3 comments

I am seeing a bunch of failures with a recent version of libdwarf

In file included from third_party/backward-cpp/suicide.cc:38:
bazel-out/k8-dbg/bin/external/backward-cpp/_virtual_includes/backward-cpp/backward/backward.hpp:2252:12: error: no matching function for call to 'dwarf_finish'
    return dwarf_finish(dwarf, NULL);
           ^~~~~~~~~~~~
bazel-out/k8-dbg/bin/external/libdwarf/_virtual_includes/libdwarf/libdwarf.h:1578:12: note: candidate function not viable: requires single argument 'dw_dbg', but 2 arguments were provided
DW_API int dwarf_finish(Dwarf_Debug dw_dbg);
           ^
In file included from third_party/backward-cpp/suicide.cc:38:
bazel-out/k8-dbg/bin/external/backward-cpp/_virtual_includes/backward-cpp/backward/backward.hpp:2467:57: error: use of undeclared identifier 'DW_DLC_READ'
    int dwarf_result = dwarf_elf_init(elf_handle.get(), DW_DLC_READ, NULL, NULL,
                                                        ^
bazel-out/k8-dbg/bin/external/backward-cpp/_virtual_includes/backward-cpp/backward/backward.hpp:2570:21: error: no matching function for call to 'dwarf_formref'
                if (dwarf_formref(attr_mem, &spec_offset, &error) ==
                    ^~~~~~~~~~~~~
bazel-out/k8-dbg/bin/external/libdwarf/_virtual_includes/libdwarf/libdwarf.h:2694:12: note: candidate function not viable: requires 4 arguments, but 3 were provided
DW_API int dwarf_formref(Dwarf_Attribute dw_attr,
           ^
In file included from third_party/backward-cpp/suicide.cc:38:
bazel-out/k8-dbg/bin/external/backward-cpp/_virtual_includes/backward-cpp/backward/backward.hpp:2584:22: error: use of undeclared identifier 'dwarf_siblingof'
        int result = dwarf_siblingof(dwarf, current_die, &sibling_die, &error);
                     ^
bazel-out/k8-dbg/bin/external/backward-cpp/_virtual_includes/backward-cpp/backward/backward.hpp:2614:18: error: no matching function for call to 'dwarf_formref'
        result = dwarf_formref(attr_mem, &offset, &error);

@fzakaria Yes, the issue for that is #232 . The newer versions have a completely different API, so it would require a different macro for the support. However, there may not be a significant increase in information when compared to using libbfd instead, to justify adding the new libdwarf API.

Cool thanks.
Maybe worth a disclaimer..

I also finally got this all working in my own repo with Bazel....not sure if all that effort for Bazel is worth the cost. Love everything about it except third party stuff.

Recent libdwarf seems to skip libelf as dependency which would simplify compilation from strach of the lib