RLovelett / langserver-swift

A Swift implementation of the open Language Server Protocol.
Apache License 2.0
177 stars 16 forks source link

Still not able to compile :( #8

Closed oderwat closed 7 years ago

oderwat commented 7 years ago

I still can't compile (tried the new 3.0.2 release and the 12/8 Snapshot). This time for a reason I really don't get?

> swift build -c release -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11
...
...
Compile Swift Module 'LanguageServerProtocol' (37 sources)
/Users/.../langserver-swift/Sources/LanguageServerProtocol/Extenstions/URL.swift:20:16: error: 'init(fileURLWithPath:isDirectory:relativeTo:)' is only available on OS X 10.11 or newer
...

sad face..

RLovelett commented 7 years ago

It would seem that you are not actually using the snapshot version of SwiftPM. Did you properly set your PATH environment variable before running swift build?

I was able to reproduce what you are seeing when running with SwiftPM that comes with Swift 3.0.2 but not with the snapshot.

Before running swift build run swift build --version if you don't see something like: Swift Package Manager - Swift 3.0.0-dev I would expect it to fail.

Failure Example

$ swift build --version
Apple Swift Package Manager - Swift 3.0.2 (swiftpm-11750)
$ swift build -c release -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11
...
...
Compile Swift Module 'LanguageServerProtocol' (37 sources)
/private/tmp/langserver-swift/Sources/LanguageServerProtocol/Extenstions/URL.swift:20:16: error: 'init(fileURLWithPath:isDirectory:relativeTo:)' is only available on OS X 10.11 or newer
        self = URL(fileURLWithPath: bar, isDirectory: false, relativeTo: root)
               ^
...
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/langserver-swift/.build/release.yaml

Building Example

$ export PATH=$HOME/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
$ swift build --version
Swift Package Manager - Swift 3.0.0-dev
$ swift build -c release -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11
Fetching https://github.com/RLovelett/SourceKitten.git
Fetching https://github.com/RLovelett/Argo.git
Fetching https://github.com/thoughtbot/Curry.git
Fetching https://github.com/behrang/YamlSwift.git
Fetching https://github.com/drmohundro/SWXMLHash.git
Fetching https://github.com/norio-nomura/Clang_C.git
Fetching https://github.com/Carthage/Commandant.git
Fetching https://github.com/thoughtbot/Runes.git
Fetching https://github.com/antitypical/Result.git
Fetching https://github.com/norio-nomura/SourceKit.git
Cloning https://github.com/RLovelett/SourceKitten.git
Resolving https://github.com/RLovelett/SourceKitten.git at 0.15.1-beta6
Cloning https://github.com/behrang/YamlSwift.git
Resolving https://github.com/behrang/YamlSwift.git at 3.1.0
Cloning https://github.com/thoughtbot/Curry.git
Resolving https://github.com/thoughtbot/Curry.git at 3.0.0
Cloning https://github.com/norio-nomura/SourceKit.git
Resolving https://github.com/norio-nomura/SourceKit.git at 1.0.1
Cloning https://github.com/antitypical/Result.git
Resolving https://github.com/antitypical/Result.git at 3.1.0
Cloning https://github.com/RLovelett/Argo.git
Resolving https://github.com/RLovelett/Argo.git at 4.1.2-beta1
Cloning https://github.com/Carthage/Commandant.git
Resolving https://github.com/Carthage/Commandant.git at 0.11.3
Cloning https://github.com/drmohundro/SWXMLHash.git
Resolving https://github.com/drmohundro/SWXMLHash.git at 3.0.3
Cloning https://github.com/norio-nomura/Clang_C.git
Resolving https://github.com/norio-nomura/Clang_C.git at 1.0.2
Cloning https://github.com/thoughtbot/Runes.git
Resolving https://github.com/thoughtbot/Runes.git at 4.0.1
Compile Swift Module 'SWXMLHash' (2 sources)
Compile Swift Module 'Yaml' (6 sources)
Compile Swift Module 'Result' (2 sources)
Compile Swift Module 'Curry' (1 sources)
Compile Swift Module 'Runes' (3 sources)
Compile Swift Module 'Argo' (19 sources)
Compile Swift Module 'Commandant' (9 sources)
Compile Swift Module 'SourceKittenFramework' (33 sources)
/private/tmp/langserver-swift/.build/checkouts/SourceKitten.git--5781163794506590952/Source/SourceKittenFramework/library_wrapper.swift:20:55: warning: string interpolation produces a debug description for an optional value; did you mean to make this explicit?
        fatalError("Finding symbol \(symbol) failed: \(errorString)")
                                                      ^~~~~~~~~~~~~
/private/tmp/langserver-swift/.build/checkouts/SourceKitten.git--5781163794506590952/Source/SourceKittenFramework/library_wrapper.swift:20:56: note: use 'String(describing:)' to silence this warning
        fatalError("Finding symbol \(symbol) failed: \(errorString)")
                                                      ~^~~~~~~~~~~~
                                                       String(describing:  )
/private/tmp/langserver-swift/.build/checkouts/SourceKitten.git--5781163794506590952/Source/SourceKittenFramework/library_wrapper.swift:20:56: note: provide a default value to avoid this warning
        fatalError("Finding symbol \(symbol) failed: \(errorString)")
                                                      ~^~~~~~~~~~~~
                                                                   ?? <#default value#>
Compile Swift Module 'sourcekitten' (9 sources)
Compile Swift Module 'Ogra' (1 sources)
Compile Swift Module 'JSONRPC' (6 sources)
Linking ./.build/release/sourcekitten
Compile Swift Module 'LanguageServerProtocol' (37 sources)
Compile Swift Module 'LanguageServer' (2 sources)
Linking ./.build/release/LanguageServer
oderwat commented 7 years ago

Oh my.. I am using swiftenv and I somehow deleted the pinning to the snapshot.

Building with the snappshot works but with test I get 9 failures of the 27 tests (6 unexpected) and it does not work in visual studio code (which is why I want the language server in the first place).

RLovelett commented 7 years ago

The test failures are unfortunately expected. I need to fix those. Though pull-requests are welcome/appreciated.

However, as far as the "does not work in visual studio code" part goes. I'll need a little bit more information in order to solve that one.

Please feel free to open a new issue for that.

boozook commented 7 years ago

OS: 10.11.6 (15G1217) xcodebuild: Xcode 8.0 (Build version 8A218a)

~/Developer/objCpp/swift-vsc-langserve > (1) swift build -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11 -c release
Compile CYaml src/writer.c
Compile CYaml src/scanner.c
Compile CYaml src/reader.c
Compile CYaml src/parser.c
Compile CYaml src/loader.c
Compile CYaml src/emitter.c
Compile CYaml src/dumper.c
Compile CYaml src/api.c
Compile Swift Module 'SWXMLHash' (2 sources)
Compile Swift Module 'Result' (2 sources)
Compile Swift Module 'Curry' (1 sources)
Compile Swift Module 'Runes' (3 sources)
Linking CYaml
Compile Swift Module 'Argo' (19 sources)
Compile Swift Module 'Yams' (9 sources)
Compile Swift Module 'Commandant' (9 sources)
/Users/ak/Developer/objCpp/swift-vsc-langserve/Packages/Yams-0.2.0/Sources/Yams/Emitter.swift:324:13: error: value of type 'ContiguousArray<CChar>' (aka 'ContiguousArray<Int8>') has no member 'withUnsafeMutableBytes'
        _ = value.withUnsafeMutableBytes { value in
            ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~
/Users/ak/Developer/objCpp/swift-vsc-langserve/Packages/Yams-0.2.0/Sources/Yams/Emitter.swift:346:13: error: value of type 'ContiguousArray<CChar>' (aka 'ContiguousArray<Int8>') has no member 'withUnsafeMutableBytes'
        _ = tag.withUnsafeMutableBytes { tag in
            ^~~ ~~~~~~~~~~~~~~~~~~~~~~
/Users/ak/Developer/objCpp/swift-vsc-langserve/Packages/Yams-0.2.0/Sources/Yams/Emitter.swift:367:13: error: value of type 'ContiguousArray<CChar>' (aka 'ContiguousArray<Int8>') has no member 'withUnsafeMutableBytes'
        _ = tag.withUnsafeMutableBytes { tag in
            ^~~ ~~~~~~~~~~~~~~~~~~~~~~
/Users/ak/Developer/objCpp/swift-vsc-langserve/Packages/Yams-0.2.0/Sources/Yams/Parser.swift:130:9: error: value of type 'ContiguousArray<CChar>' (aka 'ContiguousArray<Int8>') has no member 'withUnsafeBytes'
        utf8CString.withUnsafeBytes { bytes in
        ^~~~~~~~~~~ ~~~~~~~~~~~~~~~
Compile Swift Module 'Ogra' (1 sources)
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/ak/Developer/objCpp/swift-vsc-langserve/.build/release.yaml
RLovelett commented 7 years ago

@fzzr- It requires a newer build of Xcode than that. You need something like 8.2 or higher.

boozook commented 7 years ago

Thank you. I did it. With Xcode 8.2.