openocd icon indicating copy to clipboard operation
openocd copied to clipboard

Mac M1 Build fails: Invalid casts from uint8_t * to uint32_t *

Open jondurrant opened this issue 1 year ago • 2 comments

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.

jondurrant avatar Aug 25 '24 08:08 jondurrant

If this issue is still actual, apply this patch & rebuild: 0001-riscv-batch.c-fix-compilation-error-on-macos.patch

AndreyLalaev avatar Aug 30 '24 14:08 AndreyLalaev

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

Uthedris avatar May 23 '25 20:05 Uthedris