stephenrkell / libdwarfpp

A high-level API for accessing DWARF debugging information, in C++
http://www.cl.cam.ac.uk/~srk31/
Other
23 stars 12 forks source link

Build problems Ubuntu 23.10, gcc 13.2.0 #21

Open eibach opened 1 month ago

eibach commented 1 month ago

I have some problems building on Ubuntu 23.10.

First of all I get an error when running autogen.sh:

checking dependency style of g++... gcc3
./configure: line 16930: syntax error near unexpected token `ext,'
./configure: line 16930: `AX_CXX_COMPILE_STDCXX_14(ext, optional)'

I patched this, but when building I get a lot of errors like:

In file included from src/libdwarf-handles.cpp:14:
include/dwarfpp/abstract-inl.hpp: In member function 'dwarf::core::basic_die* dwarf::core::factory::make_payload(dwarf::core::abstract_die&&, dwarf::core::root_die&)':
include/dwarfpp/abstract-inl.hpp:32:88: error: cannot convert 'dwarf::core::compile_unit_die*' to 'dwarf::core::basic_die*' in return
   32 |                         if (d.tag_here() == DW_TAG_compile_unit) return make_cu_payload(std::move(d), r);
      |                                                                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
      |                                                                                        |
      |                                                                                        dwarf::core::compile_unit_die*
include/dwarfpp/abstract.hpp:37:24: note: class type 'dwarf::core::compile_unit_die' is incomplete
   37 |                 struct compile_unit_die;

I could help cleaning this up, but I would like to see the library in working condition first. Which build environment do you recommend?

stephenrkell commented 1 month ago

Hi. Thanks for your interest! Short version: for demo purposes I recommend you try the config that is tested in CI. That is Ubuntu 18.04 which I realise is now rather antiquated, but it should work.

The autoconf thing seems like standard compiler and/or autoconf churn -- if you have the workaround I'd happily take a PR.

For the incomplete type error, I haven't seen that before and it is slightly surprising. If you can add -save-temps to the CXXFLAGS and use that to generate a .ii file for one or more of the affected files, that would help me debug.

The main problem with this library right now is (#12) it needs a major update to the underlying DWARF library API. Without that, it can't deal with DWARF 5 features. The right thing to do is switch to libdw. The newer versions of libdwarf do support DWARF 5 but also have an incompatible API. libdw is just faster and better maintained. I am working on the libdw port so am hoping to get it working in the next week or two, but can't promise just now.

eibach commented 1 month ago

Hi. Thanks for your interest! Short version: for demo purposes I recommend you try the config that is tested in CI. That is Ubuntu 18.04 which I realise is now rather antiquated, but it should work.

Great, thanks.

The autoconf thing seems like standard compiler and/or autoconf churn -- if you have the workaround I'd happily take a PR.

I took the quick and dirty approach and simply removed the check from the generated configure-script. So nothing to share yet.

For the incomplete type error, I haven't seen that before and it is slightly surprising. If you can add -save-temps to the CXXFLAGS and use that to generate a .ii file for one or more of the affected files, that would help me debug.

I have attached an archive containing the .ii files from my tree.

The main problem with this library right now is (#12) it needs a major update to the underlying DWARF library API. Without that, it can't deal with DWARF 5 features. The right thing to do is switch to libdw. The newer versions of libdwarf do support DWARF 5 but also have an incompatible API. libdw is just faster and better maintained. I am working on the libdw port so am hoping to get it working in the next week or two, but can't promise just now.

Understood. I am working on a Dear ImGui-based tool for examining data structures. For now I am using libdw to get the information from the dwarf data. I was checking if there are already tools that can parse the die attributes. eu-readelf is a terrible reference ...

temps.zip

stephenrkell commented 4 weeks ago

From a quick look, my guess is that the build of include/dwarfpp/dwarf-current-adt.h has failed. Do you have a python2 installed?

It's my bad that this fails so confusingly. I just pushed 006035b which is a mostly untested attempt to prevent this happening in future.