Closed zijiren233 closed 2 months ago
Make sure the target CPU/arch is correctly set.
Add -v
here in build.sh
to see what's wrong:
echo "int main(){return 0;}" | $TRIPLE-clang -v -xc -O2 -o test - 1>/dev/null || exit 1
It should be due to me setting export IPHONEOS_DEPLOYMENT_TARGET=5.0
, which caused the compilation to succeed when I removed this environment variable.
I see that the TARGET_CPU parameter is only used by the wrapper, and its purpose is to add a default -arch parameter value in the wrapper.
Does this mean I can compile once and use the wrapper toolchain to build for other architectures, for example, using arm-apple-darwin11-clang -arch x86_64
, without having to recompile bash usage_examples/ios_toolchain/build.sh $SDK_FILE x86_64
? Or do I need to change TRIPLE to x86_64-apple-darwin11 to use -arch x86_64?
IDK why the wrapper.c file is used when a simple shell script would work better. The target should be x86_64-apple-darwin11. The wrapper.c should pass -miphoneos-version-min=4.2
automatically which will make clang target the iphone simulator. Then you just need an iphone simulator sdk (the normal iOS and macOS SDKs will not work)
An error occurred when I built using the iPhoneSimulator SDK. This is how I compiled it:
The error appeared, how should I fix it?