[swift-users] Is there a simple direct way to compile with libdispatch on Ubuntu?
Isaac Gouy
igouy2 at yahoo.com
Fri Jan 29 14:09:19 CST 2016
I guess I'm still doing something wrong?
module CBlock [system] { header "/usr/include/Block.h"
link "BlocksRuntime"
export *
}
module Cdispatch [system] {
header "/usr/include/dispatch/dispatch.h"
link "dispatch"
export *
}
$ ls /usr/include/Block.h
/usr/include/Block.h
$ ls /usr/include/dispatch/dispatch.h
/usr/include/dispatch/dispatch.h
$ ls
CBlock Cdispatch mandelbrot.swift
mandelbrot.swift
import Glibc
import CBlock
import Cdispatch
$ /usr/local/src/swift-2.2-SNAPSHOT-2016-01-25-a-ubuntu15.10/usr/bin/swiftc -o mandelbrot -Ounchecked -whole-module-optimization mandelbrot.swift -Xcc -F-module-map=CBlock/module.modulemap -Xcc -F-module-map=Cdispatch/module.modulemap -Xcc -fblocks -I /usr/include -I ./CBlock -I ./Cdispatch
mandelbrot.swift:23:20: error: use of undeclared type 'dispatch_io_t'
func writeLine(io: dispatch_io_t, _ data: dispatch_data_t, _ queue: dispatch_queue_t, _ last: Bool) {
^~~~~~~~~~~~~
mandelbrot.swift:23:43: error: use of undeclared type 'dispatch_data_t'
func writeLine(io: dispatch_io_t, _ data: dispatch_data_t, _ queue: dispatch_queue_t, _ last: Bool) {
^~~~~~~~~~~~~~~
mandelbrot.swift:24:5: error: use of unresolved identifier 'dispatch_io_write'
dispatch_io_write(io, 0, data, queue) {
^~~~~~~~~~~~~~~~~
etc etc
On Wednesday, January 27, 2016 9:57 PM, francisbailey <francisbailey at protonmail.com> wrote:
>I recently came across this issue as well. You can use the command specified in this answer: http://stackoverflow.com/questions/34680816/swift-in-linux-use-of-unresolved-identifier-dispatch-async
>
>Basically adding -Xcc -fblocks should get it to work.
More information about the swift-users
mailing list