Swift包管理器(" Swift Build")在xcode中编译得很好

时间:2017-04-04 02:50:30

标签: swift xcode swift3 swift-package-manager

当尝试通过包管理器安装模板时,它会在我的项目导入模块libxml2中抱怨一些现有的源文件。

尽管库已正确链接并且在xcode中编译得很好。

有人可以解释我做错了吗?

以下是我的控制台输出



MacBook-Pro:XCUI-ReportGen zaid$ swift build -Xcc -fblocks -Xswiftc -I/usr/local/include -Xlinker -L/usr/local/lib
Fetching https://github.com/kylef/Stencil.git
Fetching https://github.com/kylef/PathKit.git
Fetching https://github.com/kylef/Spectre.git
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.7.2
Cloning https://github.com/kylef/Stencil.git
Resolving https://github.com/kylef/Stencil.git at 0.8.0
Cloning https://github.com/kylef/PathKit.git
Resolving https://github.com/kylef/PathKit.git at 0.8.0
Compile Swift Module 'Spectre' (8 sources)
Compile Swift Module 'PathKit' (1 sources)
Compile Swift Module 'Stencil' (19 sources)
/Users/zaid/XCUI-ReportGen/.build/checkouts/Stencil.git-7635584243355970173/Sources/Context.swift:46:25: warning: expression implicitly coerced from 'Any?' to Any
    return dictionaries.popLast()
                        ^~~~~~~
/Users/zaid/XCUI-ReportGen/.build/checkouts/Stencil.git-7635584243355970173/Sources/Context.swift:46:25: note: provide a default value to avoid this warning
    return dictionaries.popLast()
                        ^~~~~~~
                                ?? <#default value#>
/Users/zaid/XCUI-ReportGen/.build/checkouts/Stencil.git-7635584243355970173/Sources/Context.swift:46:25: note: force-unwrap the value to avoid this warning
    return dictionaries.popLast()
                        ^~~~~~~
                               !
/Users/zaid/XCUI-ReportGen/.build/checkouts/Stencil.git-7635584243355970173/Sources/Context.swift:46:25: note: explicitly cast to Any with 'as Any' to silence this warning
    return dictionaries.popLast()
                        ^~~~~~~
                                as Any
/Users/zaid/XCUI-ReportGen/.build/checkouts/Stencil.git-7635584243355970173/Sources/Loader.swift:55:14: warning: no calls to throwing functions occur within 'try' expression
      return try environment.templateClass.init(templateString: content, environment: environment, name: name)
             ^
/Users/zaid/XCUI-ReportGen/.build/checkouts/Stencil.git-7635584243355970173/Sources/Loader.swift:68:18: warning: no calls to throwing functions occur within 'try' expression
          return try environment.templateClass.init(templateString: content, environment: environment, name: templateName)
                 ^
Compile Swift Module 'XCUIReportGenerator' (13 sources)
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
/Users/zaid/XCUI-ReportGen/XCUIReportGenerator/ExternalLibs/Fuzi/Document.swift:23:8: error: no such module 'libxml2'
import libxml2
       ^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode8.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/zaid/XCUI-ReportGen/.build/debug.yaml
&#13;
&#13;
&#13;

Link to the output from my debug.yaml run

1 个答案:

答案 0 :(得分:0)

看起来你正在尝试使用libxml。这是一个C库,没有所需的包装器库,它不会在Swift中构建。另请参阅this question