[swift-users] X11/Xlib linker error
Kelvin Ma
kelvin13ma at gmail.com
Mon May 22 10:24:25 CDT 2017
Tried that, doesn’t help
On Mon, May 22, 2017 at 4:23 AM, Alex Blewitt <alblue at apple.com> wrote:
>
> On 21 May 2017, at 20:48, Kelvin Ma via swift-users <swift-users at swift.org>
> wrote:
>
> I’m trying to get Swift working with X11, and I keep getting this linker
> error when I try to compile:
>
> ~/dev/cloudgen$ swift build -v
> /usr/bin/lsb_release -r
> /home/kelvin/devtools/swift-3.1-dev/usr/bin/swiftc --driver-mode=swift -I
> /home/kelvin/devtools/swift-3.1-dev/usr/lib/swift/pm -L
> /home/kelvin/devtools/swift-3.1-dev/usr/lib/swift/pm -lPackageDescription
> /home/kelvin/dev/cloudgen/Package.swift -fileno 5
> /home/kelvin/devtools/swift-3.1-dev/usr/bin/swift-build-tool -f
> /home/kelvin/dev/cloudgen/.build/debug.yaml -v
> '/home/kelvin/devtools/swift-3.1-dev/usr/bin/swiftc' -Xlinker
> '-rpath=$ORIGIN' -g -L/home/kelvin/dev/cloudgen/.build/debug -o
> /home/kelvin/dev/cloudgen/.build/debug/cloudgen '-lX11' -emit-executable
> /home/kelvin/dev/cloudgen/.build/debug/cloudgen.build/main.swift.o
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:22: error:
> undefined reference to 'XOpenDisplay'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:29: error:
> undefined reference to 'XDefaultScreenOfDisplay'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:35: error:
> undefined reference to 'XCreateSimpleWindow'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:38: error:
> undefined reference to 'XSelectInput'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:41: error:
> undefined reference to 'XMapWindow'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:47: error:
> undefined reference to 'XNextEvent'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:52: error:
> undefined reference to 'XFillRectangle'
> /home/kelvin/dev/cloudgen/Sources/cloudgen/main.swift:53: error:
> undefined reference to 'XDrawString'
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> <unknown>:0: error: link command failed with exit code 1 (use -v to see
> invocation)
> <unknown>:0: error: build had 1 command failures
>
> Here is the module.modulemap file I am using:
>
> module X11 [system] {
> module Xlib {
> header "/usr/include/X11/Xlib.h"
> }
> module X {
> header "/usr/include/X11/X.h"
> }
> link "X11"
> }
>
>
> If they are umbrella headers that include other header file dependencies,
> you may need an 'export *' in order to make them visible -- otherwise you
> only get the contents of that header file.
>
> http://clang.llvm.org/docs/Modules.html#export-declaration
>
> Alex
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170522/fffcaa8b/attachment.html>
More information about the swift-users
mailing list