Mac M1 Build fails: Invalid casts from uint8_t * to uint32_t *
Building on Mac M1 with clang-1500.3.9.4 I get the following error:
src/target/riscv/batch.c:194:24: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] uint32_t *data_in = (uint32_t *)batch->data_in;
As batch->data_in is uint8_t * this doesn't make a lot of sense. Reading the code I can't work out what is meant to be trying to do.
If this issue is still actual, apply this patch & rebuild: 0001-riscv-batch.c-fix-compilation-error-on-macos.patch
This error still exists as of the date of this comment. 23 May 2025
The patch mentioned above fixes the error. Thank You!
BTW, to apply patch after download, from the openocd directory use:
patch -p 1 -i ~/Downloads/0001-riscv-batch.c-fix-compilation-error-on-macos.patch