0

我目前正在尝试构建一个访问 Postgres 数据库的示例 Kitura 服务器。github 中有几个示例项目,最初由 IBM 发布。但是顶部有一个很大的评论说他们不再支持这个项目。

我正在使用的当前项目是 TodoList-SWiftKuery

如说明中所述,我克隆项目并输入构建命令

swift build

链接步骤失败......这是事情开始失败时的控制台日志。当它开始变得多余时,我会剪掉它。

Linking ./.build/debug/Server
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftDispatch.dylib', /usr/local/lib/libswiftDispatch.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftIOKit.dylib', /usr/local/lib/libswiftIOKit.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftObjectiveC.dylib', /usr/local/lib/libswiftObjectiveC.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftDarwin.dylib', /usr/local/lib/libswiftDarwin.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftFoundation.dylib', /usr/local/lib/libswiftFoundation.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftCoreGraphics.dylib', /usr/local/lib/libswiftCoreGraphics.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
ld: warning: Auto-Linking supplied '/usr/local/lib/libswiftCore.dylib', /usr/local/lib/libswiftCore.dylib compiled with older version of Swift language (2.0) than previous files (3.0)
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SwiftObject", referenced from:
      __TMC6Server6Config in Config.swift.o
      __TMC9LoggerAPI3Log in Logger.swift.o
      __TMC6Socket6Socket in Socket.swift.o
      __TMC10SSLService10SSLService in SSLService.swift.o
      __TMC9KituraNet10BufferList in BufferList.swift.o
      __TMC9KituraNet13ClientRequest in ClientRequest.swift.o
      __TMC9KituraNetP33_49D1A1CDD172EED7D059EF5A54A69CBD11CurlInvoker in ClientRequest.swift.o

我的基本问题是如何解决这个问题!

但一个具体的引入问题是,旧的 Swift 2.0 库等在哪里libswiftDispatch.dylib。指定的?我在哪里可以纠正这个。它不在包管理器文件中。

import PackageDescription

let package = Package(
    name: "TodoList",
    targets: [
        Target(
            name: "Server",
            dependencies: [.Target(name: "TodoList")]
        ),
        Target(
            name: "TodoList"
        )
    ],
    dependencies: [
        .Package(url: "https://github.com/IBM-Swift/Kitura.git",                 majorVersion: 1),
        .Package(url: "https://github.com/IBM-Swift/HeliumLogger.git",           majorVersion: 1),
        .Package(url: "https://github.com/IBM-Swift/Swift-cfenv.git",            majorVersion: 1),
        .Package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", majorVersion: 0)
    ]
)  

帮助或指向其他文档的指针将不胜感激。

4

1 回答 1

1

原来我有一个旧版本的“kylef/swiftenv:Swift 版本管理器”......我做了一个brew remove swiftgen,解决了问题。

我用这个命令找到了它......当我研究旧图书馆的来源时。

ls -l /usr/local/lib/libswift*

很多这样的结果 libswiftObjectiveC.dylib -> ../Cellar/swiftgen/2.0.0/lib/libswiftObjectiveC.dylib

于 2017-05-21T16:17:46.577 回答