gtcarriere / iphone-gcc

Automatically exported from code.google.com/p/iphone-gcc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error unrecognized GNU C compiler

GoogleCodeExporter opened this issue · comments

Steps to prepare environment (running on firmware 2.0 5A347, jailbroken,
with Cydia):

1. on iPhone: apt-get install iphone-gcc make ldid
2. on Mac (Leopard, Xcode 3.0, iPhone SDK final version): rsync over
/Developer/SDKs/MacOSX10.4u.sdk/ from mac to iPhone
3. on iPhone: svn co
http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk
4. cd include-1.2-sdk ; ./configure ; chmod +x install-headers.sh ;
./install-headers.sh

Try to compile something on the iPhone, e.g.
arm-apple-darwin9-gcc -c -I/usr/local/arm-apple-darwin/include  MyExample.m
-o MyExample.o

This should compile the code and produce something ready to be linked

Instead we get this error (and LOTS more after):
In file included from
/usr/local/arm-apple-darwin/include/CarbonCore/ConditionalMacros.h:42,
                 from
/usr/local/arm-apple-darwin/include/CarbonCore/MacTypes.h:20,
                 from
/usr/local/arm-apple-darwin/include/CoreFoundation/CFBase.h:38,
                 from
/usr/local/arm-apple-darwin/include/CoreFoundation/CoreFoundation.h:38,
                 from MyExample.h:1,
                 from MyExample.m:1:
/usr/local/arm-apple-darwin/include/TargetConditionals.h:123:10: error:
#error unrecognized GNU C compiler
In file included from
/usr/local/arm-apple-darwin/include/CarbonCore/DriverServices.h:32,
                 from
/usr/local/arm-apple-darwin/include/CarbonCore/CarbonCore.h:125,
                 from
/usr/local/arm-apple-darwin/include/CoreServices/CoreServices.h:24,
                 from
/usr/local/arm-apple-darwin/include/CoreGraphics/CGEvent.h:17,
                 from
/usr/local/arm-apple-darwin/include/CoreGraphics/CoreGraphics.h:24,
                 from /usr/local/arm-apple-darwin/include/UIKit/UIKit.h:3,
                 from MyExample.h:2,
                 from MyExample.m:1:
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:286:
error: expected ')' before '*' token
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:287:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'ExceptionHandlerUPP'
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:297:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'NewExceptionHandlerUPP'
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:308:
error: expected ')' before 'userUPP'
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:320:
error: expected ')' before '*' token
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:331:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'ExceptionHandlerTPP'
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:332:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'ExceptionHandler'
/usr/local/arm-apple-darwin/include/CarbonCore/MachineExceptions.h:342:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'InstallExceptionHandler'
In file included from
/usr/local/arm-apple-darwin/include/CarbonCore/CarbonCore.h:161,
                 from
/usr/local/arm-apple-darwin/include/CoreServices/CoreServices.h:24,
[snip - lots more follows]


Original issue reported on code.google.com by hazzrich...@yahoo.co.uk on 23 Jul 2008 at 1:12

Ok - it looks like installing 'patch' is the fix, ie at the beginning:

apt-get install iphone-gcc make ldid patch

The headers are properly installed after that.  Now I've got a linking problem 
but it
looks more mundane

Original comment by hazzrich...@yahoo.co.uk on 23 Jul 2008 at 2:46

New problem now, with linking:
$ arm-apple-darwin9-gcc MyExample.o -o MyExample -framework CoreFoundation
-L"/usr/lib" -L"/usr/local/arm-apple-darwin/include" 
-F"/System/Library/Frameworks"
-F"/System/Library/PrivateFrameworks" -bind_at_load -lobjc
/usr/bin/ld: Undefined symbols:
_OBJC_CLASS_$_NSAutoreleasePool
_OBJC_CLASS_$_NSString
_OBJC_CLASS_$_UIApplication
_OBJC_CLASS_$_UIHardware
_OBJC_CLASS_$_UIView
_OBJC_CLASS_$_UIWindow
_OBJC_METACLASS_$_UIApplication
_UIApplicationMain
collect2: ld returned 1 exit status

Original comment by hazzrich...@yahoo.co.uk on 23 Jul 2008 at 4:36

Don't know if it makes a difference, but I didn't get my headers from
/Developer/SDKs/MacOSX10.4u.sdk/  I pulled them from
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/includ
e/ 
and then put them in /usr/include/ on the iPhone.  I didn't even copy all of 
them,
just the ones I needed.

Original comment by gordon.c...@gmail.com on 23 Jul 2008 at 5:04

Ok I tried that, same linking problem still

Original comment by hazzrich...@yahoo.co.uk on 24 Jul 2008 at 6:14

the best place to get them is from the apple website -> the Xcode disk img

win users (lin users have to resort to win or mac[ its easy on mac]) have to 
use 
transmac to unpack dmg's, mac users can just mount the image.

then the header files are in there (the ones that we used originally)

also, can you get Hello, World (printed to stdout)?

Original comment by david.m....@gmail.com on 9 Aug 2008 at 3:11

hey are you guys downloading this from cydia?

Original comment by david.m....@gmail.com on 1 Jan 2009 at 5:20