0
votes

This might seem like a very specific question but central idea is quite broad.

I have a simple hello world console application in C. I've compiled it on Mac OS X using following command:

$ export PLATFORM=/Developer/Platforms/iPhoneOS.platform
$ $PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 -o hello hello.c -isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk/

It compiles successfully but gives this warning:

ld: warning: -force_cpusubtype_ALL will become unsupported for ARM architectures

Now, when I run lipo -info hello I get Non-fat file: hello is architecture: arm

Which specific arm is it and how to compile it to armv7 specifically?

1
"Which specific arm is it" - it? What "it"? Are you trying to run that on an iOS device?user529758

1 Answers

1
votes

A) "Lipo" is only for fat binaries (that is , multi-architecture). You're running it on a Mach-O file, single architecture. If you tried "file hello" it would tell you "mach-o Executable arm".

B) "arm" is , if memory serves, armv6. You can compile to armv6 by specifying "-arch armv7". You also specify "armv7s" (for Apple A6 devices), and now also arm64 (technically armv8) for 5S/iPad Air/Mini 2. Though technically, all ARM architectures are also v6 compatible, and the v7/v7s only makes a difference for NEON/SIMD instructions.

C) You can compile multiple times for different architectures (even x86_64) with different -arch specifiers, then use lipo -create to fuse all the binaries together to one big binary (hence the name "fat" binary), which would work on all devices.