pixelspark / catena

Catena is a distributed database based on a blockchain, accessible using SQL.
MIT License
302 stars 23 forks source link

Error compiling (swift 3.1 or 4.0) and building a Docker - Ubuntu 16.04 #55

Closed anarkrypto closed 7 years ago

anarkrypto commented 7 years ago

First, cannot compile with swift 3.1. Prompts a message requiring swift 4.0 So I installed swift 4.0, but this error persists when I try compiling:

Compile Swift Module 'SSLService' (1 sources) Compile Swift Module 'SQLite' (1 sources) Compile Swift Module 'DNS' (5 sources) /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Integer+Data.swift:36:18: error: ambiguous use of 'reversed()' Data(Data(bytes: $0, count: MemoryLayout.size).reversed()) ^ Swift.Sequence:11:17: note: found this candidate public func reversed() -> [Self.Element] ^ Swift.RandomAccessCollection:29:17: note: found this candidate public func reversed() -> ReversedRandomAccessCollection ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:35: warning: redundant conformance constraint 'IPType': 'IP' public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:45: note: conformance constraint 'IPType': 'IP' inferred from type here public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:35: warning: redundant conformance constraint 'IPType': 'IP' public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:45: note: conformance constraint 'IPType': 'IP' inferred from type here public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:35: warning: redundant conformance constraint 'IPType': 'IP' public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:45: note: conformance constraint 'IPType': 'IP' inferred from type here public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:35: warning: redundant conformance constraint 'IPType': 'IP' public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:45: note: conformance constraint 'IPType': 'IP' inferred from type here public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Bytes.swift:306:30: warning: 'characters' is deprecated: Please use String or Substring directly let attr = label.characters.split(separator: "=", maxSplits: 1, omittingEmptySubsequences: false).map { String($0) } ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Data+Extensions.swift:6:24: warning: 'characters' is deprecated: Please use String or Substring directly var from = hex.characters.startIndex ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Data+Extensions.swift:7:26: warning: 'characters' is deprecated: Please use String or Substring directly while from < hex.characters.endIndex { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Data+Extensions.swift:8:32: warning: 'characters' is deprecated: Please use String or Substring directly guard let to = hex.characters.index(from, offsetBy: 2, limitedBy: hex.characters.endIndex) else { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Data+Extensions.swift:8:83: warning: 'characters' is deprecated: Please use String or Substring directly guard let to = hex.characters.index(from, offsetBy: 2, limitedBy: hex.characters.endIndex) else { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:35: warning: redundant conformance constraint 'IPType': 'IP' public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ /root/catena/.build/checkouts/DNS.git--4886994336064519561/Sources/DNS/Types.swift:185:45: note: conformance constraint 'IPType': 'IP' inferred from type here public static func == (lhs: HostRecord, rhs: HostRecord) -> Bool { ^ error: terminated(1): /root/Downloads/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-09-18-a-ubuntu16.04/usr/bin/swift-build-tool -f /root/catena/.build/debug.yaml mai

If I try build a docker image. I have this:

Step 1/17 : FROM swiftdocker/swift:latest ---> a77f5d2be432 Step 2/17 : ARG CATENA_CONFIGURATION=release ---> Using cache ---> 3acdfc6bb3e3 Step 3/17 : ENV CATENA_CONFIGURATION $CATENA_CONFIGURATION ---> Using cache ---> e28dd30eb985 Step 4/17 : RUN adduser --system --group catena ---> Using cache ---> d132b6510813 Step 5/17 : RUN apt-get install libcurl4-openssl-dev ---> Using cache ---> 27f79ac0b73f Step 6/17 : COPY . /root/ ---> Using cache ---> 4d663164251c Step 7/17 : RUN cd /root && rm -rf .build ---> Using cache ---> 799f20fec70c Step 8/17 : RUN cd /root && swift build -c $CATENA_CONFIGURATION ---> Running in 17cd084ec970 error: failed to clone; Cloning into bare repository '/root/.build/repositories/sqlite.git--3563016140443910907'... fatal: unable to access 'https://github.com/pixelspark/sqlite.git/': Could not resolve host: github.com error: product dependency 'SQLite' not found Fetching https://github.com/pixelspark/sqlite.git Fetching https://github.com/IBM-Swift/Kitura.git Fetching https://github.com/jatoben/CommandLine Fetching https://github.com/IBM-Swift/Kitura-Request.git Fetching https://github.com/IBM-Swift/BlueCryptor.git Fetching https://github.com/pixelspark/swift-parser-generator.git Fetching https://github.com/IBM-Swift/HeliumLogger.git Fetching https://github.com/IBM-Swift/Kitura-WebSocket Fetching https://github.com/vzsg/ed25519.git Fetching https://github.com/pixelspark/base58.git Fetching https://github.com/Bouke/NetService.git Fetching https://github.com/IBM-Swift/Kitura-TemplateEngine.git Fetching https://github.com/IBM-Swift/BlueSSLService.git error: product dependency 'Ed25519' not found error: product dependency 'Base58' not found error: product dependency 'HeliumLogger' not found error: product dependency 'Kitura' not found error: product dependency 'KituraRequest' not found error: product dependency 'Kitura-WebSocket' not found error: product dependency 'NetService' not found error: product dependency 'SwiftParser' not found error: product dependency 'CommandLine' not found The command '/bin/sh -c cd /root && swift build -c $CATENA_CONFIGURATION' returned a non-zero code: 1

swift --version

Swift version 4.0-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift e75a4a7b2b) Target: x86_64-unknown-linux-gnu

My OS: Ubuntu 16.04, running into Oracle VirtualBox

anarkrypto commented 7 years ago

I found 2 new bug messages when I try "# docker build -t pixelspark/catena" : error: failed to clone; Cloning into bare repository '/root/.build/repositories/sqlite.git--3563016140443910907'... fatal: unable to access 'https://github.com/pixelspark/sqlite.git/': Could not resolve host: github.com

Complete log: Sending build context to Docker daemon 167.8MB Step 1/17 : FROM swiftdocker/swift:latest ---> a77f5d2be432 Step 2/17 : ARG CATENA_CONFIGURATION=release ---> Using cache ---> 3acdfc6bb3e3 Step 3/17 : ENV CATENA_CONFIGURATION $CATENA_CONFIGURATION ---> Using cache ---> e28dd30eb985 Step 4/17 : RUN adduser --system --group catena ---> Using cache ---> d132b6510813 Step 5/17 : RUN apt-get install libcurl4-openssl-dev ---> Using cache ---> 27f79ac0b73f Step 6/17 : COPY . /root/ ---> Using cache ---> 4d663164251c Step 7/17 : RUN cd /root && rm -rf .build ---> Using cache ---> 799f20fec70c Step 8/17 : RUN cd /root && swift build -c $CATENA_CONFIGURATION ---> Running in 17cd084ec970 error: failed to clone; Cloning into bare repository '/root/.build/repositories/sqlite.git--3563016140443910907'... fatal: unable to access 'https://github.com/pixelspark/sqlite.git/': Could not resolve host: github.com error: product dependency 'SQLite' not found Fetching https://github.com/pixelspark/sqlite.git Fetching https://github.com/IBM-Swift/Kitura.git Fetching https://github.com/jatoben/CommandLine Fetching https://github.com/IBM-Swift/Kitura-Request.git Fetching https://github.com/IBM-Swift/BlueCryptor.git Fetching https://github.com/pixelspark/swift-parser-generator.git Fetching https://github.com/IBM-Swift/HeliumLogger.git Fetching https://github.com/IBM-Swift/Kitura-WebSocket Fetching https://github.com/vzsg/ed25519.git Fetching https://github.com/pixelspark/base58.git Fetching https://github.com/Bouke/NetService.git Fetching https://github.com/IBM-Swift/Kitura-TemplateEngine.git Fetching https://github.com/IBM-Swift/BlueSSLService.git error: product dependency 'Ed25519' not found error: product dependency 'Base58' not found error: product dependency 'HeliumLogger' not found error: product dependency 'Kitura' not found error: product dependency 'KituraRequest' not found error: product dependency 'Kitura-WebSocket' not found error: product dependency 'NetService' not found error: product dependency 'SwiftParser' not found error: product dependency 'CommandLine' not found

pixelspark commented 7 years ago

@kaiquenunes23 Apparently there is an error in the DNS dependency that causes both the Docker build and native Ubuntu build to fail in the Swift 4.0 development version. Apparently the Docker image uses that instead of the 4.0 release version. Using 4.0-release on my system, the DNS dependency compiles just fine (apart from the warnings).

So please try again with the 4.0 release version natively. I will fix the Dockerfile reference to that it uses the 4.0 release version as well.

(the 'cannot resolve github.com' error is probably an intermittent issue on your system - please try again).

pixelspark commented 7 years ago

Docker is being worked on here: https://github.com/swiftdocker/docker-swift/issues/79#issuecomment-331469907

pixelspark commented 7 years ago

@kaiquenunes23 this should be fixed, the docker image now uses a proper Swift 4.0 image. Can you verify?

pixelspark commented 7 years ago

Still fails apparently:

Step 10/17 : RUN mv /root/.build/$CATENA_CONFIGURATION/Catena /usr/bin/catena && mv /root/.build/$CATENA_CONFIGURATION/*.so /usr/lib/

 ---> Running in 5522d04f051e

mv: cannot stat '/root/.build/release/*.so': No such file or directory

https://hub.docker.com/r/pixelspark/catena/builds/beyw458cb6ztzmmgcipb8ew/

pixelspark commented 7 years ago

OK this should be fixed now (copying the *.so libraries is not necessary for swift 4 anymore apparently).