PerfectlySoft / Perfect

Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)
https://www.perfect.org
Apache License 2.0
13.84k stars 946 forks source link

Unable to build template (xcode 8 beta) #192

Open YarGnawh opened 8 years ago

YarGnawh commented 8 years ago

`$ swift build Cloning https://github.com/PerfectlySoft/Perfect.git HEAD is now at faa8ac8 Some code cleanup and performance improvements Resolved version: 0.35.0 Cloning https://github.com/PerfectlySoft/Perfect-Net.git HEAD is now at 8c0a909 Renamed socket blocking control related functions. Simplified forEachAccept Resolved version: 0.10.0 Cloning https://github.com/PerfectlySoft/Perfect-OpenSSL.git HEAD is now at 7811035 OpenSSL package Resolved version: 0.3.0 Cloning https://github.com/PerfectlySoft/Perfect-Thread.git HEAD is now at 23b5feb Some code cleanup and performance improvements Resolved version: 0.6.0 Compile Swift Module 'PerfectThread' (2 sources) /Users/rayhwang/Projects/PerfectTemplate/Packages/PerfectThread-0.6.0/Sources/Threading.swift:227:3: error: 'pthread_once' is unavailable in Swift: Use lazily initialized globals instead pthread_once(&threadOnce, onceFunc) ^~~~ Darwin.pthread_once:3:13: note: 'pthread_once' has been explicitly marked unavailable here public func pthreadonce(: UnsafeMutablePointer, _: @convention(c) () -> Swift.Void) -> Int32 ^ /Users/rayhwang/Projects/PerfectTemplate/Packages/PerfectThread-0.6.0/Sources/Threading.swift:227:3: warning: result of call to 'pthread_once' is unused pthread_once(&threadOnce, onceFunc) ^ ~~~~~~~ /Users/rayhwang/Projects/PerfectTemplate/Packages/PerfectThread-0.6.0/Sources/ThreadQueue.swift:197:74: error: cannot convert value of type 'UnsafeMutablePointer' (aka 'UnsafeMutablePointer<()>') to expected argument type 'OpaquePointer' let unleakyObject = Unmanaged.fromOpaque(pCheck).takeRetainedValue() ^~ /Users/rayhwang/Projects/PerfectTemplate/Packages/PerfectThread-0.6.0/Sources/ThreadQueue.swift:202:37: error: value of type 'Unmanaged' has no member 'toOpaque' let leakyObject = Unmanaged.passRetained(holderObject).toOpaque()


<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/rayhwang/Projects/PerfectTemplate/.build/debug.yaml`
ghost commented 8 years ago

I am running into the same problem, any pointers will be good in resolving this. I am also running on xcode 8 beta.

GJNilsen commented 8 years ago

Perfect has probably not been rewritten for Swift 3 yet, and Xcode 8 is pretty buggy, so being a bit patient is my advice.

taplin commented 8 years ago

While the master branch of Perfect builds for Swift 3 on the June 6 snapshot, the Xcode8 beta introduced some unexpected issues which have not been resolved yet.

kjessup commented 8 years ago

Yes, we have supported Swift 3.0 for a good while now and update for every snapshot as soon as possible. However, we are seeing a problem with the version included in Xcode 8. After updating the code to compile with this new version on the command line with SPM, the generated Xcode projects do not compile. We are holding off on tagging the updated code for now.

We continue to compile with the 3.0 DEVELOPMENT-SNAPSHOT-2016-06-06-a toolchain for the time being.

rymcol commented 8 years ago

https://github.com/kylef/swiftenv helps enormously to manage this against different projects.

JoeFerrucci commented 8 years ago

I'm having a similar issue. I tried the latest Swift 3.0 with Xcode 8 Beta, and also DEVELOPMENT-SNAPSHOT-2016-05-09-a. -- I am running swiftenv.

Here is my terminal log that shows cloning the PerfectTemplate and then attempting to run swift build

 → [Developer]  git clone https://github.com/PerfectlySoft/PerfectTemplate.git
Cloning into 'PerfectTemplate'...
remote: Counting objects: 48, done.
remote: Total 48 (delta 0), reused 0 (delta 0), pack-reused 48
Unpacking objects: 100% (48/48), done.
Checking connectivity... done.
 → [Developer]  cd PerfectTemplate
 → [PerfectTemplate] on (master)  swift build
Cloning https://github.com/PerfectlySoft/Perfect.git
HEAD is now at 81a57a1 Updated comments
Resolved version: 0.38.0
Cloning https://github.com/PerfectlySoft/Perfect-Net.git
HEAD is now at fbce424 Added .swift-version file
Resolved version: 0.11.0
Cloning https://github.com/PerfectlySoft/Perfect-OpenSSL.git
HEAD is now at 7811035 OpenSSL package
Resolved version: 0.3.0
Cloning https://github.com/PerfectlySoft/Perfect-Thread.git
HEAD is now at 96d240f Added @discardableResult to a few funcs
Resolved version: 0.9.0
Compile Swift Module 'PerfectThread' (2 sources)
/Users/joe/Developer/PerfectTemplate/Packages/PerfectThread-0.9.0/Sources/ThreadQueue.swift:221:41: error: cannot convert value of type 'ThreadFunction' (aka '@convention(c) UnsafeMutablePointer<()> -> Optional<UnsafeMutablePointer<()>>') to expected argument type '(@convention(c) (UnsafeMutablePointer<Void>?) -> UnsafeMutablePointer<Void>?)!'
        pthread_create(&thrdSlf, &attr, pthreadFunc, leakyObject)
                                        ^~~~~~~~~~~
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/joe/Developer/PerfectTemplate/.build/debug.yaml
rymcol commented 8 years ago

@JoeFerrucci make sure you go into Xcode and set command line tools to Xcode 8, then make sure you check out the master branch of perfect in git.

iamjono commented 8 years ago

I agree with @rymcol - that's likely the difference as it's all working for me on Xcode 8 beta and default Swift 3 install from that, and using the command line tools for Xcode 8.

Closing for now, please reopen if the issue remains. Thanks!

sunlyear commented 8 years ago

I am having exactly the same issue @JoeFerrucci. Could not solve it at all.

iamjono commented 8 years ago

@sunlyear have you selected both settings as mentioned in https://github.com/PerfectlySoft/Perfect readme? Also can you post the exact version of Xcode and Swift that you are using please. Thanks!

sverrisson commented 8 years ago

I had the same issues while following the instructions and compiling from the Terminal. I solved it by packing for Xcode: swift package generate-xcodeproj and compiling the project in Xcode.

jordonedavidson commented 8 years ago

Similar issue for me: `Jordons-MacBook-Pro:PerfectTemplate jordondavidson$ swift build Compile Swift Module 'PerfectThread' (2 sources) /Users/jordondavidson/GITRepos/PerfectTemplate/Packages/PerfectThread-0.10.0/Sources/ThreadQueue.swift:210:97: error: cannot convert value of type 'UnsafeMutablePointer' (aka 'UnsafeMutablePointer<()>') to expected argument type 'UnsafeMutablePointer<>' let unleakyObject = Unmanaged.fromOpaque(UnsafeMutablePointer(p)).takeRetainedValue() ^ /Users/jordondavidson/GIT_Repos/PerfectTemplate/Packages/PerfectThread-0.10.0/Sources/ThreadQueue.swift:233:37: error: value of type 'Unmanaged' has no member 'toOpaque' let leakyObject = Unmanaged.passRetained(holderObject).toOpaque()


<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/jordondavidson/GIT_Repos/PerfectTemplate/.build/debug.yaml`

I've updated the tools location as instructed.

xcode Version 8.0 beta (8S128d)
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)
jordonedavidson commented 8 years ago

Additionally I tried the Xcode method but the following build errors occurred:

/Users/jordondavidson/GIT_Repos/PerfectTemplate/Packages/PerfectThread-0.10.0/Sources/ThreadQueue.swift:210:97: Cannot convert value of type 'UnsafeMutablePointer<Void>' (aka 'UnsafeMutablePointer<()>') to expected argument type 'UnsafeMutablePointer<_>'
/Users/jordondavidson/GIT_Repos/PerfectTemplate/Packages/PerfectThread-0.10.0/Sources/ThreadQueue.swift:233:37: Value of type 'Unmanaged<IsThisRequired>' has no member 'toOpaque'

I've been following the instructions outlined on the website's getting started page

kjessup commented 8 years ago

swift --version should report Apple Swift version 3.0 (swiftlang-800.0.33.1 clang-800.0.31)

The Xcode > Preferences > Locations CLI Tools should say: Xcode 8.0 (8S162m)

The Xcode app menu "Toolchains" submenu should either not be present (because you only have the default chain installed) of should be set to "Xcode 8.0".

xcodebuild -version should report:

Xcode 8.0
Build version 8S162m