Perfect-Thread icon indicating copy to clipboard operation
Perfect-Thread copied to clipboard

Perfect-Thread build fails

Open JoeFerrucci opened this issue 9 years ago • 1 comments

Following the instructions on https://github.com/PerfectlySoft/Perfect to build Starter Project. Once I try to run swift build I get the terminal output below. I have tried to build using Swift 2.2, 3.0, DEVELOPMENT-SNAPSHOT-2016-05-03-a and DEVELOPMENT-SNAPSHOT-2016-05-09-a. All fail on this pThreadFunc error.

 → [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
 → [PerfectTemplate] on (master)

JoeFerrucci avatar Jun 21 '16 06:06 JoeFerrucci

I ran into similar problems with swift build. It turned out I wasn't really using the DEVELOPMENT-SNAPSHOT to build. I followed the "1. Installation on OSX" instructions here: https://developer.ibm.com/recipes/tutorials/configuring-the-swift-toolchain-cross-platform/

Short version:

  1. Change the default Swift toolchain from Xcode embedded to snapshot:
$ export TOOLCHAINS=swift

. 2. Verify

$ xcrun –find swift
> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a.xctoolchain/usr/bin/swift 

Also note the master branch of this project currently compiles with DEVELOPMENT-SNAPSHOT-2016-06-20-a released June 20th, 2016 using Swift Package Manager.

I hope that helps.

jeffreyfultonca avatar Jun 28 '16 16:06 jeffreyfultonca