且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Clang(LLVM)使用框架进行编译

更新时间:2023-11-10 11:12:46

在不使用Xcode的情况下编译iOS并不容易。在您的情况下,您尝试使用iOS框架,但您既不使用iOS工具链的编译器也不使用iOS SDK。

Compiling for iOS without using Xcode is not easy. In your case, you're trying to use an iOS framework but you're using neither the iOS toolchain's compiler nor the iOS SDK.

如果查看Xcode项目的编译脚本,你会看到一些必要的标志。你需要的东西包括:

If you look at the compile transcript for an Xcode project you'll see some of the flags that are necessary. Things you'll need include:


  • xcrun -sdk iphoneos clang 选择正确的编译器和SDK

  • -arch armv7s 选择正确的CPU架构

  • -mios-version-min = 6.1 设置最低部署目标

  • xcrun -sdk iphoneos clang to choose the correct compiler and SDK
  • -arch armv7s to choose the correct CPU architecture
  • -mios-version-min=6.1 to set a minimum deployment target

一些旧的Xcode的版本还需要 -isysroot = / path / to / iPhoneOS6.1.sdk 来选择正确的SDK,因为 xcrun 没有自动完成。

Some older versions of Xcode also require -isysroot=/path/to/iPhoneOS6.1.sdk to choose the correct SDK because xcrun did not do it automatically.