How to make a module created by Swift Package Manager importable by swift repl

Karl, thanks for your reply. I am trying both of the ideas you suggested.

(1a) About swift run --repl, I gather that is a very recently implemented idea (Oct 2018). I guess it's necessary to rebuild swift in order to make that work; is that correct? Is it perhaps only necessary to rebuild swift-package-manager? I did rebuild SPM, and found swift-run in the build artifacts, but that swift-run didn't seem to recognize the --repl option. Perhaps I'm doing something wrong?

(1b) With the goal of rebuilding swift, I have cloned GitHub - apple/swift: The Swift Programming Language and attempted to rebuild it.

First I tried: utils/build-script --release-debuginfo, but that soon stops with an error, namely: ld: unknown option: --color-diagnostics.

Following a suggestion mentioned in the thread Swift compilation failed, I tried: utils/build-script --release-debuginfo --xcode That runs for longer, but eventually stops with: Configuring incomplete, errors occurred! When I look at the log files, I don't see a clearly marked error, although CMakeError.log does contain the following:

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Checking whether the ASM compiler is Clang using "--version" did not match "(clang version)":
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Do I understand from this that Cmake is looking for a known assembler, either GCC or Xcode, and not recognizing the output from as --version? The version string returned is Apple LLVM version 10.0.0 (clang-1000.11.45.2) which doesn't match "(clang version)", therefore Cmake concludes it doesn't have a known assembler?

Assuming that maybe Cmake needs a newer assembler, I'm rebuilding llvm and clang; looks like that will be going on for some time.

(2) About using -I options to tell swift about where to look for modules, that seems to work to some extent. I find that, after swift package init --library in a test directory named Foo, and creating a simple class Bar within that, I can execute

swift -I ./.build/x86_64-apple-macosx10.10/debug\
 -I /Library/Developer/CommandLineTools/usr/lib/swift/macosx/x86_64

At the swift repl, I can now import Foo and it appears to succeed. However, any attempt to access the class Bar fail with error: Couldn't lookup symbols. (For the record, Bar is declared public and all its functions including init are declared public.) E.g.

$ PATH=/usr/bin:$PATH swift -I ./.build/x86_64-apple-macosx10.10/debug -I /Library/Developer/CommandLineTools/usr/lib/swift/macosx/x86_64
Welcome to Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1). Type :help for assistance.
  1> import Foo
  2> Bar.self
error: Couldn't lookup symbols:
  type metadata accessor for Foo.Bar

  2> Bar(text: "hello")
error: Couldn't lookup symbols:
  type metadata accessor for Foo.Bar
  Foo.Bar.__allocating_init(text: Swift.String) -> Foo.Bar

Any ideas about how to help the swift repl find the symbols it wants?

Thanks for any comments, I appreciate your help very much.
best,
Robert Dodier