[swift-users] Undefined symbols preventing build

Max Howell max.howell at apple.com
Tue Dec 8 17:53:58 CST 2015


If you report the bug I can get the relevant people involved in solving this: https://bugs.swift.org

Otherwise from what I can see the Swift standard library is not being linked. I can’t say why. It may help if you run `swift build -v` and also which OS X is this?

> On Dec 8, 2015, at 12:36 PM, Kilian Koeltzsch via swift-users <swift-users at swift.org> wrote:
> 
> Hello all,
> 
> I've tried using the Swift 2.2 compiler from swift.org to compile a
> simple sample project locally on OS X containing nothing besides a
> hello-world example and a basic Package.swift but am failing to do so
> due to several "Undefined symbols for architecture x86_64". 
> 
> The sample project is as simple as possible with only a Package.swift
> and a Sources directory containing a main.swift with nothing but a
> print() statement. There is nothing declared in the Package.swift
> besides the name of the module and an empty dependencies array.
> 
> This is the complete output from running `swift build`:
> 
> Compiling Swift Module 'foo' (1 sources)
> Linking Executable:  .build/debug/foo
> Undefined symbols for architecture x86_64:
>  "__TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS",
>  referenced from:
>      _main in main.swift.o
>  "__TFs5printFTGSaP__9separatorSS10terminatorSS_T_", referenced from:
>      _main in main.swift.o
>  "__TIFs5printFTGSaP__9separatorSS10terminatorSS_T_A0_", referenced
>  from:
>      _main in main.swift.o
>  "__TIFs5printFTGSaP__9separatorSS10terminatorSS_T_A1_", referenced
>  from:
>      _main in main.swift.o
>  "__TMSS", referenced from:
>      _main in main.swift.o
>  "__TTSg5P____TFs27_allocateUninitializedArrayurFBwTGSax_Bp_",
>  referenced from:
>      _main in main.swift.o
>  "__TZvOs7Process11_unsafeArgvGSpGSpVs4Int8__", referenced from:
>      _main in main.swift.o
>  "__TZvOs7Process5_argcVs5Int32", referenced from:
>      _main in main.swift.o
>  "_globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5", referenced
>  from:
>      _main in main.swift.o
>  "_globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5", referenced
>  from:
>      _main in main.swift.o
> ld: symbol(s) not found for architecture x86_64
> <unknown>:0: error: build had 1 command failures
> swift-build: exit(1):
> ["/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain/usr/bin/swift-build-tool",
> "-f", "/Users/kilian/Desktop/foo/.build/debug/foo.o/llbuild.yaml"]
> 
> This minimal example seems to be working fine on other installs of OS X
> and also inside an Ubuntu VM.
> 
> Any help on how to fix this would be much appreciated. Anything I can
> find online on this refers to adjusting Xcode build setting to link with
> external libraries.
> 
> There's also a StackOverflow question for this here[0].
> 
> Thank you very much in advance!
> 
> 
> [0]
> http://stackoverflow.com/questions/34162636/swift-2-2-undefined-symbols-preventing-build
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list