Hi developers,
I've successfully built the swift compiler using Ninja by following the instructions listed in the Getting Started document. However, when I tried to execute swiftc
and swift
respectively in the build directory, I got the following errors:
Command I used to invoke swiftc
:
<my build directory>/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swiftc test.swift -o test
The output I got:
ld: library not found for -lobjc
:0: error: link command failed with exit code 1 (use -v to see invocation)
and after I added the -v
option, I got the following output
Swift version 5.4-dev (LLVM 1044437905e95a4, Swift d622bdca3a5d1fd)
Target: x86_64-apple-darwin20.3.0
<my build direcory>
/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-frontend -frontend -c -primary-file test.swift -target x86_64-apple-darwin20.3.0 -enable-objc-interop -module-name test -o /var/folders/zx/1t__6cgd5rdblpb72g6fbz2h0000gn/T/test-e50629.o
/usr/bin/ld /var/folders/zx/1t__6cgd5rdblpb72g6fbz2h0000gn/T/test-e50629.o<my build directory>
/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/swift/clang/lib/darwin/libclang_rt.osx.a -lobjc -lSystem -arch x86_64 -L<my build direcotry>
/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/swift/macosx -platform_version macos 11.0.0 0.0.0 -no_objc_category_merging -o test
ld: library not found for -lobjc
:0: error: link command failed with exit code 1 (use -v to see invocation)
Command I used to invoke swift
:
<my build directory>/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift
and I got the following output:
<unknown>
:0: error: fatal error encountered during compilation; please submit a bug report (Swift.org - Contributing) and include the project
:0: note: Compiler-internal integrated REPL has been removed; use the LLDB-enhanced REPL instead.
Please submit a bug report (Swift.org - Contributing) and include the project and the crash backtrace.
Stack dump:
0. Program arguments:<my build directory>
/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-frontend -frontend -repl -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -color-diagnostics -target-sdk-version 11.1 -module-name REPL
- Swift version 5.4-dev (LLVM 1044437905e95a4, Swift d622bdca3a5d1fd)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment varLLVM_SYMBOLIZER_PATH
to point to it):
0 swift-frontend 0x0000000105680497 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1 swift-frontend 0x000000010567f565 llvm::sys::RunSignalHandlers() + 85
2 swift-frontend 0x0000000105680ac6 SignalHandler(int) + 262
3 libsystem_platform.dylib 0x00007fff2053ed7d _sigtramp + 29
4 libsystem_platform.dylib 0x000000011af946c0 _sigtramp + 18446603344721303904
5 libsystem_c.dylib 0x00007fff2044d720 abort + 120
6 swift-frontend 0x00000001009a2305 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_2::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) + 725
7 swift-frontend 0x00000001055d14db llvm::report_fatal_error(llvm::Twine const&, bool) + 267
8 swift-frontend 0x00000001055d13cb llvm::report_fatal_error(char const*, bool) + 43
9 swift-frontend 0x00000001009a1e8d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 10941
10 swift-frontend 0x000000010093ade7 main + 519
11 libdyld.dylib 0x00007fff20515621 start + 1
zsh: abort
My development environment:
Xcode 12.4
Python 3.8.2
macOS 11.2
cmake 3.19.4
ninja 1.10.2
All commands were invoked with the working directory being the directory that contains the swift source code I want to run those two programs on
Could you help me with that?
Thank you so much