我正在iMac上开发SSD1306(OLED屏幕驱动程序)的库。为了测试它,我必须在已连接OLED屏幕的树莓上运行它。因此,我通过SMB将文件夹共享到了树莓派零。我已成功将其安装在/home/pi/SwiftOLED
上。现在,为了测试它,我在/home/pi/test
创建了一个名为test的项目。它是清单文件:
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "test",
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(path: "/home/pi/SwiftOLED/"),
.package(url: "https://github.com/uraimo/SwiftyGPIO.git", .exact("1.1.3")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "test",
dependencies: ["SwiftyOLED", "SwiftyGPIO"]),
]
)
如您所见,我正在使用this way of defining a package dependency来避免提交,标记和推送我的库,只是为了测试是否可行。
错误 不幸的是,当我运行
pi@raspberrypi:~/test $ swift build
Updating https://github.com/uraimo/SwiftyGPIO.git
error: /home/pi/SwiftOLED has no manifest
我收到此错误,只有当我没有清单文件时,这才是合理的。
pi@raspberrypi:~/test $ cat /home/pi/SwiftOLED/Package.swift
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "SwiftyOLED",
products: [
.library(
name: "SwiftyOLED",
targets: ["SwiftyOLED"]),
],
dependencies: [
.package(url: "https://github.com/uraimo/SwiftyGPIO.git", .exact("1.1.3")),
],
targets: [
.target(
name: "SwiftyOLED",
dependencies: ["SwiftyGPIO"]),
]
)
是的,权限似乎还可以,因为在安装集期间,已安装文件的所有权为pi
pi@raspberrypi:~/SwiftOLED $ ll
total 28
drwxr-xr-x 2 pi pi 0 Jun 8 02:30 .
drwxr-xr-x 12 pi pi 4096 Jun 9 00:36 ..
-rwxr-xr-x 1 pi pi 6148 Jun 8 02:13 .DS_Store
drwxr-xr-x 2 pi pi 0 Jun 8 22:09 .build
drwxr-xr-x 2 pi pi 0 Jun 9 01:17 .git
-rwxr-xr-x 1 pi pi 38 Jun 8 02:13 .gitignore
-rwxr-xr-x 1 pi pi 326 Jun 8 02:30 Package.resolved
-rwxr-xr-x 1 pi pi 439 Jun 8 02:30 Package.swift
-rwxr-xr-x 1 pi pi 167 Jun 8 02:29 README.md
drwxr-xr-x 2 pi pi 0 Jun 8 02:09 Sources