Compilation fails on 32-bit Windows

Asked by Murat Belge

I am using the GNU ARM Embedded tools for STM32F4-Discovery board. Everything works fine on my 64-bit Windows machine. However, on a 32-bit windows computer I get compilation errors with exactly the same source code and makefile:

gmake -C buildARM_ert_rtw -f buildARM.mk build
gmake: Entering directory `C:/TEMP/tp031f6623_bat440703win32/buildARM_ert_rtw'
### Compiling syscalls.c ...
arm-none-eabi-gcc -MD -std=c99 -ffunction-sections -fdata-sections -Wall -c -O0 -mcpu=cortex-m3 -mthumb -mlittle-endian -mthumb-interwork -fsingle-precision-constant -DMODEL=buildARM -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DTID01EQ=0 -DNULL=0 -D__NO_SYSTEM_INIT -DARM_MATH_CM3=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DTID01EQ=0 -DMODEL=buildARM -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/TEMP/tp031f6623_bat440703win32/buildARM_ert_rtw -IC:/TEMP/tp031f6623_bat440703win32 -IY:/Aslrtw/matlab/extern/include -IY:/Aslrtw/matlab/simulink/include -IY:/Aslrtw/matlab/rtw/c/src -IY:/Aslrtw/matlab/rtw/c/src/ext_mode/common -IY:/Aslrtw/matlab/rtw/c/ert -ID:/share/apps/RTT/Arm_CortexM/cmsis/Device/TI/LM3S/Include -ID:/share/apps/RTT/Arm_CortexM/cmsis/CMSIS/Include -IC:/TEMP/tpc86c5ce4_bat440703win32/arm_cortex_m/include -o "syscalls.o" "syscalls.c"
syscalls.c:14:29: warning: 'struct stat' declared inside parameter list [enabled by default]
syscalls.c:14:29: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
syscalls.c: In function '_fstat':
syscalls.c:16:7: error: dereferencing pointer to incomplete type
syscalls.c:16:19: error: 'S_IFCHR' undeclared (first use in this function)
syscalls.c:16:19: note: each undeclared identifier is reported only once for each function it appears in
syscalls.c: At top level:
syscalls.c:52:1: error: unknown type name 'caddr_t'
syscalls.c:53:1: error: unknown type name 'caddr_t'
syscalls.c: In function '_sbrk':
syscalls.c:54:5: error: unknown type name 'caddr_t'
syscalls.c:55:5: error: unknown type name 'caddr_t'
syscalls.c:58:21: error: 'caddr_t' undeclared (first use in this function)
syscalls.c:66:25: error: expected ';' before numeric constant
gmake: *** [syscalls.o] Error 1
gmake: Leaving directory `C:/TEMP/tp031f6623_bat440703win32/buildARM_ert_rtw'

Compiler seems not being able to locate <sys/stat.h> include file for some reason. Has anybody else encounter this issue? Any 32-bit Windows users out there?

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Murat Belge
Solved:
Last query:
Last reply:
Revision history for this message
Murat Belge (mbelge) said :
#1

I figured the problem. In the 32-bit Windows machine, there is an environment variable defined this way:

C_INCLUDE_PATH=D:\win32\apps\gnat\3.15p\pentium-mingw32msv\include

So the compiler pulls in a different <sys/stat.h> based on this additional include path. Once I remove the environment variable, things work correctly.