swift build failure using current Development Swift

Installed the latest Trunk version of Swift from Swift.org - swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain


This is correctly set as the latest Toolchain /Library/Developer/Toolchains/swift-latest.xctoolchain -> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain


"swift build --help" works


If I create an empty directory, "cd" into it and run "swift build --init executable" it creates the correct file structure


When I run "swift build -v -c debug" the command fails:



/usr/bin/xcrun --find swiftc
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/abizern/tmp/testspm/Package.swift -fileno 3
/Users/abizern/tmp/testspm/Package.swift:1:8: error: no such module 'PackageDescription'
import PackageDescription
       ^
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/abizern/tmp/testspm/Package.swift -fileno 3


But if I change the toolchain to the previous month's version:


"swift-latest.xctoolchain -> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-25-a.xctoolchain"


It seems strange that I can't find anyone else having this problem on the forums.

Answered by abizer in 130781022

It seems that the toolchain I downloaded didn't have a `swiftc` binary in the /usr/bin subfolder so it was defaulting to my system `/usr/bin/swiftc` No idea why it happened, or why multiple reinstalls didn't fix it. Just reinstalled the latest toolchain and it's there and it works.


/shrugs/

Accepted Answer

It seems that the toolchain I downloaded didn't have a `swiftc` binary in the /usr/bin subfolder so it was defaulting to my system `/usr/bin/swiftc` No idea why it happened, or why multiple reinstalls didn't fix it. Just reinstalled the latest toolchain and it's there and it works.


/shrugs/

i am still getting these


$ swift build

Package.swift:17:8: error: no such module 'PackageDescription'

import PackageDescription

error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/tkhuran/Kitura-TodoList/Package.swift -fileno 3

I am also getting


$ swift

dyld: Library not loaded: @rpath/LLDB.framework/LLDB

Referenced from: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/lldb

Reason: image not found

Trace/BPT trap: 5


Any help will be highly appreciated !

人品不行吧

What are the contents of "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/"?


This is what I have:


-rwxr-xr-x  1 root  wheel    58K 24 Mar 17:47 lldb
-rwxr-xr-x  1 root  wheel   1.2M 24 Mar 17:47 lldb-mi
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:45 lldb-mi.dSYM
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:45 lldb.dSYM
-rwxr-xr-x  1 root  wheel    62M 24 Mar 17:47 swift
-rwxr-xr-x  1 root  wheel   1.4M 24 Mar 17:47 swift-build
-rwxr-xr-x  1 root  wheel   1.5M 24 Mar 17:47 swift-build-tool
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:45 swift-build-tool.dSYM
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:45 swift-build.dSYM
-rwxr-xr-x  1 root  wheel   635K 24 Mar 17:47 swift-demangle
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:45 swift-demangle.dSYM
-rwxr-xr-x  1 root  wheel   2.3K 24 Mar 17:47 swift-stdlib-tool
-rwxr-xr-x  1 root  wheel   733K 24 Mar 17:47 swift-test
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:45 swift-test.dSYM
drwxr-xr-x  3 root  wheel   102B 24 Mar 17:46 swift.dSYM
lrwxr-xr-x  1 root  wheel     5B 12 Apr 18:27 swiftc -> swift

-rwxr-xr-x 1 root wheel 73612 Mar 24 12:45 lldb

-rwxr-xr-x 1 root wheel 1750744 Mar 24 12:45 lldb-mi

drwxr-xr-x 3 root wheel 102 Mar 24 12:45 lldb-mi.dSYM

drwxr-xr-x 3 root wheel 102 Mar 24 12:45 lldb.dSYM

-rwxr-xr-x 1 root wheel 76567740 Mar 24 12:44 swift

-rwxr-xr-x 1 root wheel 1786048 Mar 24 12:45 swift-build

-rwxr-xr-x 1 root wheel 2163708 Mar 24 11:38 swift-build-tool

drwxr-xr-x 3 root wheel 102 Mar 24 12:45 swift-build-tool.dSYM

drwxr-xr-x 3 root wheel 102 Mar 24 12:45 swift-build.dSYM

-rwxr-xr-x 1 root wheel 807308 Mar 24 12:44 swift-demangle

drwxr-xr-x 3 root wheel 102 Mar 24 12:45 swift-demangle.dSYM

-rwxr-xr-x 1 root wheel 937976 Mar 24 12:45 swift-test

drwxr-xr-x 3 root wheel 102 Mar 24 12:45 swift-test.dSYM

drwxr-xr-x 3 root wheel 102 Mar 24 12:46 swift.dSYM

lrwxr-xr-x 1 root wheel 95 Apr 13 08:58 swiftc -> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/swift

Maybe it is a bug for apple, now you can see the new version in https://swift.org/download/#snapshots, the date is April 12, 2016 ...

The problem happens due to the fact that you installed "Debugging Symbols" package and not installed the swift package itself.

The snapshot appears as two links on swift.org Download page: "Xcode" and "Debugging Symbols", which point to
swift-DEVELOPMENT-SNAPSHOT-<snapshot date>-a-osx.pkg and swift-DEVELOPMENT-SNAPSHOT-<snapshot date>-a-osx-symbols.pkg, respectively.


If you install swift-DEVELOPMENT-SNAPSHOT-<snapshot date>-a-osx-symbols.pkg only, you get the Toolchain with swift executable and without swiftc, and this swift executable will fail to run as REPL. You have to install swift-DEVELOPMENT-SNAPSHOT-<snapshot date>-a-osx.pkg.

im using xcode 8/MacOS Sierra and get the error:


no such module 'PackageDescription'


when i import PackageDescription in the Package.swift file



am i missing something here?

swift build failure using current Development Swift
 
 
Q