kismetwireless / kismet

Github mirror of official Kismet repository
Other
1.57k stars 306 forks source link

backward.h binutils compilation issue #507

Open shrout1 opened 7 months ago

shrout1 commented 7 months ago

When building kismet from source on Kali-Rolling 2023.4 64 bit I encounter the following error:

In file included from backward_wrapper.h:28,
                 from kismet_server.cc:25:
backward.h: In member function ‘void backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::find_in_section(bfd_vma, bfd_vma, bfd_fileobject&, asection*, find_sym_result&)’:
backward.h:1082:22: error: ‘bfd_get_section_flags’ was not declared in this scope; did you mean ‘bfd_set_section_flags’?
 1082 |                 if ((bfd_get_section_flags(fobj.handle.get(), section)
      |                      ^~~~~~~~~~~~~~~~~~~~~
      |                      bfd_set_section_flags
backward.h:1086:36: error: ‘bfd_get_section_vma’ was not declared in this scope; did you mean ‘bfd_set_section_vma’?
 1086 |                 bfd_vma sec_addr = bfd_get_section_vma(fobj.handle.get(), section);
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    bfd_set_section_vma
backward.h:1087:38: error: ‘bfd_get_section_size’ was not declared in this scope; did you mean ‘bfd_set_section_size’?
 1087 |                 bfd_size_type size = bfd_get_section_size(section);
      |                                      ^~~~~~~~~~~~~~~~~~~~
      |                                      bfd_set_section_size

The problem is present in the file kismet-master/backward.h. By changing this code in the following fashion (per this stack overflow article) this resolves the compilation issue:

if ((bfd_section_flags(section)                                         
                        & SEC_ALLOC) == 0)
        return; // a debug section is never loaded automatically.

bfd_vma sec_addr = bfd_section_vma(section);
bfd_size_type size = bfd_section_size(section);

The application then properly installs and can be accessed at 127.0.0.1:2501 via a web browser after the kismet service is started.

I saw this fix linked in an aws_lambda_cpp issue

My current configuration includes:

GNU Make 4.3 Kali GNU/Linux Rolling 2023.4 OS architecture: aarch64 g++ (Debian 13.2.0-5) 13.2.0a