Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get GNU C Compiler working on iOS 6.x

I have a jailbroken (evasi0n) 4th generation iPad, with iOS 6.1 firmware.

Through Cydia I've installed Mobile Terminal, version 520-2.
Then, following this tutorial, I've downloaded and installed CSU, Link Identify Editor, LibGCC, GCC and Headers/Libraries.

During installation there were not any problems.

The tutorial and the project are updated respectively to Feb 15, 2012 and Feb 18, 2012, so they work fine till iOS 5.x (I've tested the procedure on my iPhone 4S, iOS 5.1.1 and it works, so I can compile and execute C code on the device)

But in Mobile Terminal, on iPad (iOS 6.1) when I type

$ gcc

I get

Illegal instruction: 4

I searched a lot during these days, but I can't find anything about GCC on iOS 6.x, since the last recent discussion about that is updated at Oct 12, 2012, while evasi0n jailbreak procedure has been possible starting from Feb 4, 2013.

Thanks for any help.

UPDATE

It seems (from the answers) that the problem is not related to iOS 6.x firmware, but to A6/A6X Chip, respectively on iPhone 5 and iPad 4th generation.

like image 986
user2043441 Avatar asked Feb 05 '13 15:02

user2043441


3 Answers

Some software must be rebuilt with ARMv7s support. GCC is one of them.

To recompile with ARMv7 you have to run gcc with the -arch ARMv7 option and use latest SDK (6.0 or 6.1, I don't think it will work with old SDK versions but you can try). Next, create a fat binary using lipo so it will work on multiple architectures.

[This issue in official iphone-gcc-full page] (http://code.google.com/p/iphone-gcc-full/issues/detail?id=6)

like image 55
Sergio Avatar answered Nov 11 '22 02:11

Sergio


Some users of my cydia project have the same "Illegal instruction 4" problem. They have iPad4 and iPhone5 (all evasi0n jailbroken iOS 6.1).

I compiled it with the cross compiler arm-apple-darwin gcc/g++ version 4.2.1 .

I always use CFLAGS='-O2 -mthumb'.

Regarding I don't have access to an Apple A6/A6X Chip iOS Device (iPad4, iPhone5) I can't test anything :-(

like image 38
J.Anrugas Avatar answered Nov 11 '22 01:11

J.Anrugas


Please get the new GCC for iPhone 5 from the following link. download

like image 1
Ali Avatar answered Nov 11 '22 01:11

Ali