OpenAnnePro / AnnePro2-Shine

Custom LED Matrix Firmware for Open Anne Pro 2 QMK Port
GNU General Public License v2.0
100 stars 51 forks source link

Can't compile C15 version on macOS #19

Closed astronautr closed 3 years ago

astronautr commented 4 years ago

Hello. After executing make C15 I'm getting an error, here's compilation log

Compiling crt0_v6m.S
Compiling vectors.S
Compiling chcoreasm_v6m.S
Compiling crt1.c
Compiling hal.c
Compiling hal_st.c
Compiling hal_buffers.c
Compiling hal_queues.c
Compiling hal_mmcsd.c
Compiling hal_gpt.c
Compiling hal_pal.c
Compiling hal_serial.c
Compiling hal_community.c
Compiling nvic.c
Compiling hal_lld.c
Compiling hal_st_lld.c
Compiling hal_gpt_lld.c
Compiling hal_pal_lld.c
./lib/chibios-contrib/os/hal/ports/HT32/LLD/GPIOv1/hal_pal_lld.c: In function '_pal_lld_init':
./lib/chibios-contrib/os/hal/ports/HT32/LLD/GPIOv1/hal_pal_lld.c:85:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (size_t i = 0; i < HT32_NUM_GPIO; i++) {
     ^
./lib/chibios-contrib/os/hal/ports/HT32/LLD/GPIOv1/hal_pal_lld.c:85:5: note: use option -std=c99 or -std=gnu99 to compile your code
./lib/chibios-contrib/os/hal/ports/HT32/LLD/GPIOv1/hal_pal_lld.c: In function '_pal_lld_setgroupmode':
./lib/chibios-contrib/os/hal/ports/HT32/LLD/GPIOv1/hal_pal_lld.c:113:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for (size_t i = 0; i < PAL_IOPORTS_WIDTH; i++) {
         ^
make: *** [build/C15/obj/hal_pal_lld.o] Error 1

I've fixed that myself by adding C15: CFLAGS += -std=c99 to Makefile but I'm not sure if it's the right solution on the project level so I didn't create PR

OS: macOS Catalina 10.15.6

Codetector1374 commented 4 years ago

I'm going to say feel free to add that flag for yourself. I'm pretty sure this is a compiler version problem? If you want to make an PR add that flag feel free. But since it compiles fine on our CI/most people with WSL/Linux (and on my own Mac) i can't be sure what is causing this. But if you want to share you compiler version (the arm-gcc version) that might help explain why this happened.

astronautr commented 4 years ago

Sure, here it is

➜ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.4 20140725 (release) [ARM/embedded-4_8-branch revision 213147]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Codetector1374 commented 3 years ago

This repository now has automatic builds. I will mark this as resolved. Since you don't need to compile yourself