Skip to content

Xcode 升级到 10.2 造成的编译错误 #28

Open
@Beyond-Chao

Description

@Beyond-Chao
Contributor

问题描述:

用 Xcode 10.2 以下的版本 打包生成的 RokidSDK.framework(lipo -create 合并之后的) 在 Xcode 10.2上编译无法通过,
错误如下:

ld: xxx/RokidSDK/RokidSDK.framework/RokidSDK compiled with other version of Swift language (`unkown ABI version 0x06`) than previous files (`unknown ABI version 0x07`)file 'xxx/RokidSDK/RokidSDK.framework/RokidSDK' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

尝试方案

Xcode 升级到 10.2 之后,重新打包生成的 RokidSDK.framework(lipo -create 合并之后的) 放到 RokidMobileSDKiOSDemo 项目中时,在模拟器上无法编译通过,报一些文件无法找到的错误,但在真机上市可以编译通过。

最终方案

最终发现在 Xcode 更新日志有段描述:

Known Issues
If you’re building a framework containing Swift code and using lipo to create a binary that supports both device and simulator platforms, you must also combine the generated Framework-Swift.h headers for each platform to create a header that supports both device and simulator platforms. (48635615)

For example, if you’ve built:

  • iOS/Framework.framework

  • iOS Simulator/Framework.framework

Take:

  • iOS/Framework.framework/Headers/Framework-Swift.h

  • iOS Simulator/Framework.framework/Framework-Swift.h

Create a new:

  • iOS + iOS Simulator/Framework.framework/Headers/Framework-Swift.h

The contents of the new Framework-Swift.h should be:

#if TARGET_OS_SIMULATOR
<contents of original iOS Simulator/Framework.framework/Framework-Swift.h>
#else
<contents of original iOS/Framework.framework/Framework-Swift.h>
#endif

需要把模拟器和用lipo create 合并之后的 framework 中的 Framework-Swift.h 头文件用一个宏 TARGET_OS_SIMULATOR 手动拼接到一起,生成一个完整的 Framework-Swift.h 的头文件。

Activity

Beyond-Chao

Beyond-Chao commented on Apr 24, 2019

@Beyond-Chao
ContributorAuthor

類似問題 Carthage #2718

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Beyond-Chao@KingBo0259

        Issue actions

          Xcode 升级到 10.2 造成的编译错误 · Issue #28 · rokid/RokidMobileSDKiOSDemo