ARM Cross-Compiling in C
Posted: Sat Jun 11, 2011 1:13 pm
Hey guys. Trying to get a simple Hello World application to compile on:
*i386
*ppc
*armv6
I'm using this Makefile:
When compiling Main.c into Main.o and then linking Main.o into iOS_Test for the ARM architecture it fails with these errors:
Any ideas how to fix this?
EDIT: I think stdio.h can't be compiled for the ARM architecture if so how do I over come this obstacle?
*i386
*ppc
*armv6
I'm using this Makefile:
Code: Select all
I386_GCC=/Developer/usr/llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-gcc-4.2
PPC_GCC=/Developer/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2
ARM_GCC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2
APP=iOS_Test
Main: Main.o
$(I386_GCC) -o bin//$(APP) obj/i386/*.c
$(PPC_GCC) -o bin/ppc/$(APP) obj/ppc/*.c
$(ARM_GCC) -o bin/armv6/$(APP) obj/armv6/*.c
Main.o:
$(I386_GCC) -o obj/i386/$(APP).o src/*.c
$(PPC_GCC) -o obj/ppc/$(APP).o src/*.c
$(ARM_GCC) -o obj/armv6/$(APP).o src/*.c
Seems to be compatibility issues between stdio.h and the ARM architecture.Last login: Sat Jun 11 18:58:24 on ttys000
Marc-A-Reeds-MacBook-Pro:~ MarcAReed$ cd iOS_Test
Marc-A-Reeds-MacBook-Pro:iOS_Test MarcAReed$ make
/Developer/usr/llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-gcc-4.2 -o obj/i386/iOS_Test.o src/*.c
/Developer/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 -o obj/ppc/iOS_Test.o src/*.c
/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2 -o obj/armv6/iOS_Test.o src/*.c
In file included from /usr/include/sys/_types.h:33,
from /usr/include/_types.h:27,
from /usr/include/stdio.h:64,
from src/Main.c:1:
/usr/include/machine/_types.h:36:24: error: arm/_types.h: No such file or directory
In file included from /usr/include/_types.h:27,
from /usr/include/stdio.h:64,
from src/Main.c:1:
/usr/include/sys/_types.h:94: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_blkcnt_t’
/usr/include/sys/_types.h:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_blksize_t’
/usr/include/sys/_types.h:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_dev_t’
/usr/include/sys/_types.h:99: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_gid_t’
/usr/include/sys/_types.h error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_id_t’
/usr/include/sys/_types.h:101: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_ino64_t’
/usr/include/sys/_types.h:103: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_ino_t’
/usr/include/sys/_types.h:107: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mach_port_name_t’
/usr/include/sys/_types.h:108: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mach_port_t’
/usr/include/sys/_types.h:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mode_t’
/usr/include/sys/_types.h:110: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_off_t’
/usr/include/sys/_types.h:111: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_pid_t’
/usr/include/sys/_types.h:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_sigset_t’
/usr/include/sys/_types.h:132: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_suseconds_t’
/usr/include/sys/_types.h:133: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_uid_t’
/usr/include/sys/_types.h:134: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_useconds_t’
In file included from src/Main.c:1:
/usr/include/stdio.h:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘va_list’
/usr/include/stdio.h:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘off_t’
/usr/include/stdio.h:80: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘size_t’
/usr/include/stdio.h:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fpos_t’
/usr/include/stdio.h:145: error: expected specifier-qualifier-list before ‘fpos_t’
/usr/include/stdio.h:255: error: expected declaration specifiers or ‘...’ before ‘fpos_t’
/usr/include/stdio.h:265: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:270: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
/usr/include/stdio.h:272: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:290: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:296: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:297: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:298: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:301: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:322: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:331: error: expected declaration specifiers or ‘...’ before ‘off_t’
/usr/include/stdio.h:332: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ftello’
/usr/include/stdio.h:353: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:355: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:356: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:357: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:357: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:358: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/stdio.h:372: error: expected declaration specifiers or ‘...’ before ‘fpos_t’
/usr/include/stdio.h:385: error: expected declaration specifiers or ‘...’ before ‘va_list’
In file included from /usr/include/stdio.h:443,
from src/Main.c:1:
/usr/include/secure/_stdio.h:42: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/secure/_stdio.h:49: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/secure/_stdio.h:49: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/secure/_stdio.h:56: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/secure/_stdio.h:57: error: expected declaration specifiers or ‘...’ before ‘va_list’
/usr/include/secure/_stdio.h:63: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/secure/_stdio.h:63: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/secure/_stdio.h:64: error: expected declaration specifiers or ‘...’ before ‘va_list’
make: *** [Main.o] Error 1
Marc-A-Reeds-MacBook-Pro:iOS_Test MarcAReed$ 1
Any ideas how to fix this?
EDIT: I think stdio.h can't be compiled for the ARM architecture if so how do I over come this obstacle?