Get GNU C Compiler working on iOS 6.x

2019-03-10 14:16发布

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.

4条回答
聊天终结者
2楼-- · 2019-03-10 14:57

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

查看更多
Ridiculous、
3楼-- · 2019-03-10 14:59

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

查看更多
▲ chillily
4楼-- · 2019-03-10 15:07

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

查看更多
迷人小祖宗
5楼-- · 2019-03-10 15:10

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)

查看更多
登录 后发表回答