I downloaded the latest developer snapshot (swift-DEVELOPMENT-SNAPSHOT-2018-05-26-a-ubuntu16.04.tar.gz) from Swift.org - Download Swift, verified the signature and extracted the archive. Then
# cd swift-DEVELOPMENT-SNAPSHOT-2018-05-26-a-ubuntu16.04
# usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM 5913b477db, Clang 8c9b467e0e, Swift ec5b51ec7c). Type :help for assistance.
1> print(1)
error: Couldn't lookup symbols:
type metadata for Swift.Int
Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
Swift._allocateUninitializedArray<A>(Builtin.Word) -> (Swift.Array<A>, Builtin.RawPointer)
swift_bridgeObjectRelease
default argument 1 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
default argument 2 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
swift_release
type metadata for Any
swift_retain
1>
Importing Foundation first seems to solve the problem:
# cd swift-DEVELOPMENT-SNAPSHOT-2018-05-26-a-ubuntu16.04
# usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM 5913b477db, Clang 8c9b467e0e, Swift ec5b51ec7c). Type :help for assistance.
1> import Foundation
2> print(1)
1
3>
With swift-4.1.1-RELEASE-ubuntu16.04.tar.gz I can use print() without importing Foundation first:
# cd swift-4.1.1-RELEASE-ubuntu16.04
# usr/bin/swift
Welcome to Swift version 4.1.1 (swift-4.1.1-RELEASE). Type :help for assistance.
1> print(1)
1
2>
This looks like a bug to me. Or am I doing something wrong?
(All tests were done on Ubuntu 16.04, running under VirtualBox.)
The missing symbols all come from the standard library and runtime. Out of curiosity, what happens if you import Swift first? It may be failing to load anything implicitly.
$ cd swift-DEVELOPMENT-SNAPSHOT-2018-05-26-a-ubuntu16.04/
$ usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM 5913b477db, Clang 8c9b467e0e, Swift ec5b51ec7c). Type :help for assistance.
1>
2> import Swift
3>
4> print(1)
error: Couldn't lookup symbols:
type metadata for Swift.Int
Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
Swift._allocateUninitializedArray<A>(Builtin.Word) -> (Swift.Array<A>, Builtin.RawPointer)
swift_bridgeObjectRelease
default argument 1 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
default argument 2 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()
swift_release
type metadata for Any
swift_retain
4>
5> import Foundation
6> print(1)
1
7>
Another example:
$ usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM 5913b477db, Clang 8c9b467e0e, Swift ec5b51ec7c). Type :help for assistance.
1> import Swift
2> let a = min(1.0, 2.0)
a: Double = <extracting data from value failed>
error: Couldn't lookup symbols:
protocol witness table for Swift.Double : Swift.Comparable in Swift
type metadata for Swift.Double
Swift.min<A where A: Swift.Comparable>(A, A) -> A
2>
3> import Foundation
4> let a = min(1.0, 2.0)
a: Double = 1
5>