无法使用Postgres适配器和Swift 3.1构建Kitura Server

时间:2017-05-21 02:23:16

标签: swift postgresql kitura

我目前正在尝试构建一个访问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 et.al.指定?我在哪里可以纠正这个。它不在包管理器文件中。

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)
    ]
)  

将非常感谢帮助或指向其他文档。

1 个答案:

答案 0 :(得分:1)

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

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

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

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