[swift-dev] Compiling on FreeBSD

K Staring qdk at quickdekay.net
Sun Sep 18 15:08:58 CDT 2016


Hi,

While trying to port the current swift code to FreeBSD, some swift code fails to compile. The failures are concentrated in SwiftPrivatePthreadExtras.swift and code which depends on it.

Can someone shed some light on the following errors? I am having some difficulty understanding why the C headers would be interpreted so slightly differently than expected?

--(start compile failure)
/home/qdk/src/swift-source/swift/stdlib/private/SwiftPrivatePthreadExtras/SwiftPrivatePthreadExtras.swift:75:42: error: cannot convert value of type 'UnsafePointer<pthread_attr_t>?' to expected argument type 'UnsafePointer<pthread_attr_t?>!'
  let result = pthread_create(&threadID, attr,
                                         ^~~~
/home/qdk/src/swift-source/swift/stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift:72:46: error: cannot convert value of type 'UnsafeMutablePointer<pthread_mutex_t>' (aka 'UnsafeMutablePointer<OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_mutex_t?>' (aka 'UnsafeMutablePointer<Optional<OpaquePointer>>')
  if pthread_mutex_init(barrier.pointee.mutex!, nil) != 0 {
                        ~~~~~~~~~~~~~~~~~~~~~^
/home/qdk/src/swift-source/swift/stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift:77:44: error: cannot convert value of type 'UnsafeMutablePointer<pthread_cond_t>' (aka 'UnsafeMutablePointer<OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_cond_t?>' (aka 'UnsafeMutablePointer<Optional<OpaquePointer>>')
  if pthread_cond_init(barrier.pointee.cond!, nil) != 0 {
                       ~~~~~~~~~~~~~~~~~~~~^

--(end compile failure)

Thanks for any suggestions or pointers!

-- 
Kind regards,

K Staring <qdk at quickdekay.net>




More information about the swift-dev mailing list