Reputation: 131
I want to compile a simple helloworld.c on my Mac and then send it to my iphone 4 to run.
the code is pretty simple:
#include <stdio.h>
int main( ) {
printf("Hello, world!\n");
return 0;
}
My setup:
OSX El Capitain 10.11
Xcode 7.2
Iphone4 with iOS 7.1.4 JB
clang -v Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.3.0 Thread model: posix
gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.3.0 Thread model: posix
iPhoneOS9.0.2.sdk
All the info that I found on the web are not useful, because of new Xcode or because of the new compilers on recent OSX.
Upvotes: 5
Views: 4220
Reputation: 131
The correct configuration for the compiler was
clang -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch armv7 hello.c -o hello
This will produce a arm binary unsigned.
If your JB device need file signing, use ldid for this.
Upvotes: 7