ThoughtGang / opdis

libopcodes-based disassembler
GNU General Public License v2.0
35 stars 10 forks source link

Compiler error on Fedora #20

Open nmosier opened 5 years ago

nmosier commented 5 years ago

[opdis]$ ./bootstrap [opdis]$ ./configure [opdis]$ make ... opdis/opdis.c: In function ‘opdis_config_from_bfd’: opdis/opdis.c:220:18: error: incompatible type for argument 1 of ‘disassembler’ disassembler(abfd) ); ^~~~ In file included from ./opdis/opdis.h:14, from opdis/opdis.c:14: /usr/include/dis-asm.h:276:63: note: expected ‘enum bfd_architecture’ but argument is of type ‘bfd ’ {aka ‘struct bfd ’} extern disassembler_ftype disassembler (enum bfd_architecture arc,


opdis/opdis.c:220:5: error: too few arguments to function ‘disassembler’
     disassembler(abfd) );
     ^~~~~~~~~~~~
In file included from ./opdis/opdis.h:14,
                 from opdis/opdis.c:14:
/usr/include/dis-asm.h:276:27: note: declared here
 extern disassembler_ftype disassembler (enum bfd_architecture arc,
                           ^~~~~~~~~~~~
opdis/opdis.c: In function ‘opdis_set_disassembler_options’:
opdis/opdis.c:258:18: warning: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   free( o->config.disassembler_options );
         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from opdis/opdis.c:11:
/usr/include/stdlib.h:563:25: note: expected ‘void *’ but argument is of type ‘const char *’
 extern void free (void *__ptr) __THROW;
                   ~~~~~~^~~~~
opdis/opdis.c: In function ‘opdis_set_x86_syntax’:
opdis/opdis.c:265:26: error: ‘print_insn_i386_intel’ undeclared (first use in this function); did you mean ‘print_insn_rl78_g14’?
  disassembler_ftype fn = print_insn_i386_intel;
                          ^~~~~~~~~~~~~~~~~~~~~
                          print_insn_rl78_g14
opdis/opdis.c:265:26: note: each undeclared identifier is reported only once for each function it appears in
opdis/opdis.c:273:8: error: ‘print_insn_i386_att’ undeclared (first use in this function); did you mean ‘print_insn_rl78_g14’?
   fn = print_insn_i386_att;
        ^~~~~~~~~~~~~~~~~~~
        print_insn_rl78_g14
make: *** [Makefile:877: opdis/opdis.lo] Error 1
oxavelar commented 5 years ago

To me I think this error happens when trying to compile with GCC 8.2+

If I compile with GCC 6.x the warning is not present.... mmm

It looks like:

gcc/8.2.0/include/dis-asm.h

Doesn't have print_insn_i386_intel defined anymore here, look @

6394c606997f88acfc80de4dff33a4ae2de987b4

Looks like on top of

#include "dis-asm.h"

We will now only need:

#include "disassemble.h"

Do you also see this?