Compile errors
thSoft opened this issue · comments
I tried to use the package with the following Package.swift file:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "Notation",
dependencies: [
.package(
url: "https://github.com/objecthub/swift-numberkit.git",
from: "2.0.1"
)
],
targets: [
.target(
name: "Notation",
dependencies: ["NumberKit"],
path: "Sources"
),
]
)
When building my package, I get the following errors:
MacBook-Pro-of-thSoft:Notation thsoft$ swift build
Cloning https://github.com/objecthub/swift-numberkit.git
Resolving https://github.com/objecthub/swift-numberkit.git at 2.0.1
Compile Swift Module 'NumberKit' (6 sources)
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/Rational.swift:327:12: error: argument labels '(numerator:, denominator:)' do not match any available overloads
self.init(numerator: rat.numerator, denominator: rat.denominator)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/Rational.swift:327:12: note: overloads for 'Rational<T>.init' exist with these partially matching parameter lists: (T, T), (from: String, radix: Int)
self.init(numerator: rat.numerator, denominator: rat.denominator)
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/Rational.swift:360:13: error: 'Rational<T>' initializer is inaccessible due to 'private' protection level
return (Rational(numerator: numer, denominator: denom),
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/Rational.swift:123:11: note: 'init(numerator:denominator:)' declared here
private init(numerator: T, denominator: T) {
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:728:18: error: 'uwords' is inaccessible due to 'private' protection level
return (self.uwords.count * UInt32.bitWidth) + 1
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:737:20: error: 'uwords' is inaccessible due to 'private' protection level
while i < self.uwords.count && self.uwords[i] == 0 {
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:740:21: error: 'uwords' is inaccessible due to 'private' protection level
return i < self.uwords.count ? i * UInt32.bitWidth + self.uwords[i].trailingZeroBitCount
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:749:31: error: 'uwords' is inaccessible due to 'private' protection level
res.reserveCapacity((self.uwords.count + 1) / 2)
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:751:20: error: 'uwords' is inaccessible due to 'private' protection level
while i < self.uwords.count {
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:752:31: error: 'uwords' is inaccessible due to 'private' protection level
let current = UInt(self.uwords[i])
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:754:28: error: 'uwords' is inaccessible due to 'private' protection level
let next = i == self.uwords.count ? 0 : (UInt(self.uwords[i]) << UInt32.bitWidth)
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:759:13: error: 'negative' is inaccessible due to 'private' protection level
if self.negative {
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:44:15: note: 'negative' declared here
private let negative: Bool
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:788:26: error: 'uwords' is inaccessible due to 'private' protection level
return BigInt(words: uwords, negative: false)
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:897:27: error: 'uwords' is inaccessible due to 'private' protection level
self.init(words: bi.uwords, negative: bi.negative)
^
/Users/thsoft/Swift/Notation/.build/checkouts/swift-numberkit.git-6882174132934804157/Sources/NumberKit/BigInt.swift:41:15: note: 'uwords' declared here
private let uwords: [UInt32]
^
warning: dependency 'NumberKit' is missing; cloning again
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f '/Users/thsoft/Swift/Notation/.build/debug.yaml' main
Sorry, I forgot to increase the version number of Swift. This is now a Swift 4 package. I've updated the Package.swift file. Does that work for you now?
Thanks, but unfortunately now I get:
MacBook-Pro-of-thSoft:Notation thsoft$ swift build
Updating https://github.com/objecthub/swift-numberkit.git
error: manifest parse error(s):
/var/folders/d7/qt541tgd3vzfk32m544ks8mw0000gn/T/TemporaryFile.QsjaGR.swift:29:3: error: argument 'exclude' must precede argument 'targets'
exclude: []
~~^~~~~~~~~~~
So I think your still using the SwiftPM version 3 syntax for a Swift 4 package.
I had to make these changes:
diff --git a/Package.swift b/Package.swift
index c997af7..a6a7089 100644
--- a/Package.swift
+++ b/Package.swift
@@ -23,8 +23,19 @@ import PackageDescription
let package = Package(
name: "NumberKit",
- targets: [Target(name: "NumberKit")],
+ products: [
+ .library(
+ name: "NumberKit",
+ targets: ["NumberKit"]),
+ ],
dependencies: [],
- swiftLanguageVersions: [4],
- exclude: []
+ targets: [
+ .target(
+ name: "NumberKit",
+ dependencies: []),
+ .testTarget(
+ name: "NumberKitTests",
+ dependencies: ["NumberKit"]),
+ ],
+ swiftLanguageVersions: [4]
)
Then swift test
would run for me.
Thanks for the advice. I've adapted the version 4 API and tested it. Should work now.
Thanks, I confirm that the update works.