iPhone - Why can the compiler not find some includes when building for ARM architecture?

I am trying to make use of a C library in an iPhone project. I am very green with iPhone development. My Library

I have been battling for days now to try and get this library build into a static library that I can use for both the simulator (i386) and ARM7.

Using the the library's include configuration and makefile I can build the library without issue. However if I edit the makefile to try and build this same library but target the armv7 architecture I get many errors. The errors seem to be reporting that some header files cannot be located.

So does the compiler attempt to look in different places for header files depending on the target architecture?

This is the make file that I have edited to attempt to build for the armv7:

 # $Id: Makefile.in 62 2005-03-09 21:11:53Z gyunaev $
CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 
CFLAGS = -Wall -DIN_BUILDING_LIBIRC -O3 -DENABLE_THREADS -D_REENTRANT
AR=ar cr
RANLIB=ranlib
INCLUDES=-I../include


OBJS = libircclient.o

all:    lib

lib:    libircclient.a

install: lib
    -mkdir /usr/local/include
    -mkdir /usr/local/lib
    cp ../include/libircclient.h /usr/local/include/libircclient.h
    cp ../include/libirc_errors.h /usr/local/include/libirc_errors.h
    cp ../include/libirc_events.h  /usr/local/include/libirc_events.h 
    cp libircclient.a /usr/local/include/lib/libircclient.a

$(OBJS): utils.c dcc.c errors.c portable.c sockets.c colors.c

libircclient.a: $(OBJS)
    $(AR) libircclient.a $(OBJS)
    $(RANLIB) libircclient.a

clean:
    rm -f libircclient.a $(OBJS)

distclean: clean
    -rm -f Makefile

.c.o:
    @echo "Compiling  $<"
    @$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

Here is a sample of the compilation errors I am experiencing:

Compiling  libircclient.c
In file included from /usr/include/sys/_types.h:33,
             from /usr/include/_types.h:27,
             from /usr/include/stdio.h:64,
             from portable.c:18,
             from libircclient.c:15:
/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 portable.c:18,
             from libircclient.c:15:
/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’

Am I going about this all wrong? Is editing the makefile dumb? :) How do you unix ninjas handle this situation? Some research has lead me to believe that I need to create a universal library...

Thanks!

5
задан egrunin 5 February 2013 в 21:31
поделиться