rizinorg/rizin

Fix building Rizin with Capstone v5

Closed this issue · 0 comments

Do not build Xtensa plugin(s) when detected Capstone is not version 6

FAILED: librz/arch/librz_arch.so.0.8.0.p/isa_xtensa_xtensa_esil.c.o 
gcc -Ilibrz/arch/librz_arch.so.0.8.0.p -I. -I.. -Ilibrz -I../librz -Ilibrz/include -I../librz/include -I../librz/arch/isa -I../librz/arch/isa_gnu -Ilibrz/arch -I../librz/arch -Ilibrz/util/sdb/src -I../librz/util/sdb/src -I../librz/bin/format -I../librz/type/parser -I../subprojects/capstone-5.0.1/include -I../subprojects/capstone-5.0.1/include/capstone -Isubprojects/rzspp -I../subprojects/rzspp -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O3 --std=gnu99 -Werror=sizeof-pointer-memaccess -Wimplicit-fallthrough=3 -fvisibility=hidden -DRZ_PLUGIN_INCORE=1 -DSUPPORTS_PCRE2_JIT -D_GNU_SOURCE -DCC_SUPPORTS_W_ENUM_CONVERION -DCC_SUPPORTS_W_ENUM_COMPARE -Wno-cpp -fPIC -MD -MQ librz/arch/librz_arch.so.0.8.0.p/isa_xtensa_xtensa_esil.c.o -MF librz/arch/librz_arch.so.0.8.0.p/isa_xtensa_xtensa_esil.c.o.d -o librz/arch/librz_arch.so.0.8.0.p/isa_xtensa_xtensa_esil.c.o -c ../librz/arch/isa/xtensa/xtensa_esil.c
In file included from ../librz/arch/isa/xtensa/xtensa_esil.c:7:
../librz/arch/isa/xtensa/xtensa.h:16:35: error: ‘CS_MODE_XTENSA_ESP32’ undeclared here (not in a function)
   16 |         { .cpu = "esp32", .mode = CS_MODE_XTENSA_ESP32 },
      |                                   ^~~~~~~~~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:17:37: error: ‘CS_MODE_XTENSA_ESP32S2’ undeclared here (not in a function)
   17 |         { .cpu = "esp32s2", .mode = CS_MODE_XTENSA_ESP32S2 },
      |                                     ^~~~~~~~~~~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:18:37: error: ‘CS_MODE_XTENSA_ESP8266’ undeclared here (not in a function)
   18 |         { .cpu = "esp8266", .mode = CS_MODE_XTENSA_ESP8266 },
      |                                     ^~~~~~~~~~~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:35:15: error: unknown type name ‘cs_xtensa_op_mem’
   35 | static inline cs_xtensa_op_mem *xtensa_op_mem(cs_insn *insn, unsigned int index) {
      |               ^~~~~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h: In function ‘xtensa_op_mem’:
../librz/arch/isa/xtensa/xtensa.h:36:9: error: unknown type name ‘cs_xtensa_op’
   36 |         cs_xtensa_op *op = &insn->detail->xtensa.operands[index];
      |         ^~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:36:41: error: ‘cs_detail’ has no member named ‘xtensa’
   36 |         cs_xtensa_op *op = &insn->detail->xtensa.operands[index];
      |                                         ^~
In file included from ../librz/include/rz_vector.h:5,
                 from ../librz/include/rz_th.h:14,
                 from ../librz/include/rz_util.h:12,
                 from ../librz/arch/isa/xtensa/xtensa_esil.c:5:
../librz/arch/isa/xtensa/xtensa.h:37:27: error: request for member ‘type’ in something not a structure or union
   37 |         rz_warn_if_fail(op->type == XTENSA_OP_MEM);
      |                           ^~
../librz/arch/isa/xtensa/xtensa.h:37:9: note: in expansion of macro ‘rz_warn_if_fail’
   37 |         rz_warn_if_fail(op->type == XTENSA_OP_MEM);
      |         ^~~~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:37:37: error: ‘XTENSA_OP_MEM’ undeclared (first use in this function); did you mean ‘SH_OP_MEM’?
   37 |         rz_warn_if_fail(op->type == XTENSA_OP_MEM);
      |                                     ^~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:37:9: note: in expansion of macro ‘rz_warn_if_fail’
   37 |         rz_warn_if_fail(op->type == XTENSA_OP_MEM);
      |         ^~~~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:37:37: note: each undeclared identifier is reported only once for each function it appears in
   37 |         rz_warn_if_fail(op->type == XTENSA_OP_MEM);
      |                                     ^~~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:37:9: note: in expansion of macro ‘rz_warn_if_fail’
   37 |         rz_warn_if_fail(op->type == XTENSA_OP_MEM);
      |         ^~~~~~~~~~~~~~~
In file included from ../librz/arch/isa/xtensa/xtensa_esil.c:7:
../librz/arch/isa/xtensa/xtensa.h:38:19: error: request for member ‘mem’ in something not a structure or union
   38 |         return &op->mem;
      |                   ^~
../librz/arch/isa/xtensa/xtensa.h: At top level:
../librz/arch/isa/xtensa/xtensa.h:41:15: error: unknown type name ‘xtensa_reg’
   41 | static inline xtensa_reg xtensa_op_reg(cs_insn *insn, unsigned int index) {
      |               ^~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h: In function ‘xtensa_op_reg’:
../librz/arch/isa/xtensa/xtensa.h:42:9: error: unknown type name ‘cs_xtensa_op’
   42 |         cs_xtensa_op *op = &insn->detail->xtensa.operands[index];
      |         ^~~~~~~~~~~~
../librz/arch/isa/xtensa/xtensa.h:42:41: error: ‘cs_detail’ has no member named ‘xtensa’
   42 |         cs_xtensa_op *op = &insn->detail->xtensa.operands[index];
      |                                         ^~
In file included from ../librz/include/rz_vector.h:5,
                 from ../librz/include/rz_th.h:14,
                 from ../librz/include/rz_util.h:12,
                 from ../librz/arch/isa/xtensa/xtensa_esil.c:5:
../librz/arch/isa/xtensa/xtensa.h:43:27: error: request for member ‘type’ in something not a structure or union
   43 |         rz_warn_if_fail(op->type == XTENSA_OP_REG);
      |                           ^~
../librz/include/rz_util/rz_assert.h:37:23: note: in definition of macro ‘rz_warn_if_fail’
   37 |                 if (!(expr)) { \
      |                       ^~~~
../librz/arch/isa/xtensa/xtensa.h:43:37: error: ‘XTENSA_OP_REG’ undeclared (first use in this function); did you mean ‘SH_OP_REG’?
   43 |         rz_warn_if_fail(op->type == XTENSA_OP_REG);
      |                                     ^~~~~~~~~~~~~
../librz/include/rz_util/rz_assert.h:37:23: note: in definition of macro ‘rz_warn_if_fail’
   37 |                 if (!(expr)) { \
      |                       ^~~~
In file included from ../librz/arch/isa/xtensa/xtensa_esil.c:7:
../librz/arch/isa/xtensa/xtensa.h:44:18: error: request for member ‘reg’ in something not a structure or union
   44 |         return op->reg;
      |                  ^~
../librz/arch/isa/xtensa/xtensa.h: In function ‘xtensa_op_imm’:
../librz/arch/isa/xtensa/xtensa.h:48:9: error: unknown type name ‘cs_xtensa_op’
   48 |         cs_xtensa_op *op = &insn->detail->xtensa.operands[index];
      |         ^~~~~~~~~~~~

and so on...

https://github.com/rizinorg/rizin/actions/runs/11766822750/job/32774820694#step:12:2489