11

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.

user2043441
  • 200
  • 2
  • 2
  • 8

4 Answers4

6

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)

0xcaff
  • 13,085
  • 5
  • 47
  • 55
Sergio
  • 76
  • 3
  • Thanks Sergio for your complete and detailed reply. In order to re-compile the software, source code is needed, but in official _iphone-gcc-full_ page this is not available. So is the developer of the project supposed to re-compile? – user2043441 Feb 09 '13 at 13:21
  • I hope team _iphone-gcc-full_ will recompile it soon. Also you can try build ur own from official gcc sources, but it wont be simple I think... – Sergio Feb 09 '13 at 16:43
2

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 :-(

J.Anrugas
  • 21
  • 3
  • Thanks J.Anrugas for your reply. Regarding you answer, which device have you used? And which is the firmware installed on? So, is the `Illegal instruction: 4` error due to the A6/A6X Chip and not to iOS 6.x firmware? – user2043441 Feb 07 '13 at 11:47
  • I used iPhone4, iPad2 and AppleTV2 with iOS 5.1.x and iOS 6.1. On bothe firmware I don't have problems. Some user of my Cydia project uses iPhone5 and iPad4 with iOS 6.1 . Just they have the Illegal Instruction problem. – J.Anrugas Feb 07 '13 at 17:37
1

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

Ali
  • 287
  • 2
  • 4
  • 13
  • a comment, I see an error once I compile the code with new gcc. In order to fix it do the following patch. `sed -i'' 's/\x00\x30\x93\xe4/\x00\x30\x93\xe5/g;s/\x00\x30\xd3\xe4/\x00\x30\xd3\xe5/g;' hello` hello is the name of the out put file – Ali Apr 02 '13 at 21:17
  • if you don't want to patch it every time you compile your code you have to replace `crt1.o` and `dylib1.o` in `/usr/lib` iPhone's folder with new iOS. Someone in the following [link](https://code.google.com/p/iphone-gcc-full/issues/detail?id=6) has posted all the lib files required. the link for downloading is [here](http://www.mediafire.com/?kd2fuu7m1xdt3w8). – Ali Apr 02 '13 at 21:56
0

Try CppCode ios app - C/C++ IDE & Compiler. No jailbreak, no internet connection required, free(mium) http://www.cppcode.info

4ntoine
  • 19,816
  • 21
  • 96
  • 220