Beginners question:
I'm trying to test some changes to the stdlib and compiler for the upcoming pitch. I'm happy with generated SIL and IR, and now I want to compile and run a complete executable.
If I run without specifying SDK, I'm getting a linker error:
../build/Ninja+cmark-DebugAssert+llvm-RelWithDebInfoAssert+swift-DebugAssert+stdlib-DebugAssert/swift-macosx-arm64/bin/swiftc -parse-as-library ~/foo.swift -o ~/foo -v
Swift version 5.8-dev (LLVM 85bf33908e790ef, Swift 49ab8fe05889d16)
Target: arm64-apple-macosx12.0
/Users/npohilets/git_tree/swift-project/build/Ninja+cmark-DebugAssert+llvm-RelWithDebInfoAssert+swift-DebugAssert+stdlib-DebugAssert/swift-macosx-arm64/bin/swift-frontend -frontend -c -primary-file /Users/npohilets/foo.swift -target arm64-apple-macosx12.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -color-diagnostics -new-driver-path /Users/npohilets/git_tree/swift-project/build/Ninja+cmark-DebugAssert+llvm-RelWithDebInfoAssert+swift-DebugAssert+stdlib-DebugAssert/swift-macosx-arm64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/npohilets/git_tree/swift-project/build/Ninja+cmark-DebugAssert+llvm-RelWithDebInfoAssert+swift-DebugAssert+stdlib-DebugAssert/swift-macosx-arm64/lib/swift -module-name foo -parse-as-library -o /var/folders/f6/qllm_pk56m56tdvyx0g_4d3m0000gp/T/TemporaryDirectory.eOx5zj/foo-1.o
/Applications/Xcode-13.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld /var/folders/f6/qllm_pk56m56tdvyx0g_4d3m0000gp/T/TemporaryDirectory.eOx5zj/foo-1.o /Users/npohilets/git_tree/swift-project/build/Ninja+cmark-DebugAssert+llvm-RelWithDebInfoAssert+swift-DebugAssert+stdlib-DebugAssert/swift-macosx-arm64/lib/swift/clang/lib/darwin/libclang_rt.osx.a -lobjc -lSystem -arch arm64 -L /Users/npohilets/git_tree/swift-project/build/Ninja+cmark-DebugAssert+llvm-RelWithDebInfoAssert+swift-DebugAssert+stdlib-DebugAssert/swift-macosx-arm64/lib/swift/macosx -platform_version macos 12.0.0 0.0.0 -o /Users/npohilets/foo
error: link command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lobjc
If I specify SDK in the compiler invocation, it picks up standard library from the OS, and does not find new runtime function.
How can I produce a binary that links with custom stdlib for testing purposes?