使用静态库创建私有cocoapod

时间:2016-05-17 15:10:48

标签: ios xcode cocoapods podspec

我尝试构建一个新的私人cocoapods库,它嵌入了一个静态库(由外部供应商提供)。静态库由两种文件组成:XX-libs-simulator.a和XX-libs.a。

当我跑步时

"pod spec lint . --verbose --use-libraries"

我得到了

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

The following build commands failed:
    Ld /Users/damien/Library/Developer/Xcode/DerivedData/App-fvzzowxkmpidjrgpraveufngzgnl/Build/Intermediates/App.build/Release-iphonesimulator/App.build/Objects-normal/x86_64/App normal x86_64
(1 failure)
 -> MyOwnLibrary (1.0.1)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
    - NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXX-1.1.5.a, missing required architecture i386 in file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXX-1.1.5.a (2 slices)
    - NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXXB-2.11.1.a, missing required architecture i386 in file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXXB-2.11.1.a (2 slices)
    - NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXX-1.1.5.a, missing required architecture x86_64 in file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXX-1.1.5.a (2 slices)
    - NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXXB-2.11.1.a, missing required architecture x86_64 in file MyOwnLibrary/MyOwnLibrary/ExternalLibs/XX-libs/libXXB-2.11.1.a (2 slices)
    - NOTE  | [iOS] xcodebuild:  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Analyzed 1 podspec.

当我使用Xcode编译它时,我没有任何问题。我已经尝试更改以下值:

  • “有效架构”:armv7,arm64和x86_64,i386

  • “仅建立活动建筑”:两者(是/否)

有关您的信息,外部库的lipo输出是:

lipo -info libXX.a
libXX.a are: armv7 arm64 

lipo -info libXX-simulator.a
libXX-simulator.a are i386 x86_64 

如何让pod像XCode一样编译我的库?

1 个答案:

答案 0 :(得分:0)

我没有得到我的问题的答案,但为了避免这个问题,我选择创建我自己的库,没有cocoapods。我认为当你需要一个特定的配置时,它可能是使用旧学校方法手动完成它的最简单和最好的方式。