Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift run --repl fails #820

Closed
JonasVautherin opened this issue Jun 4, 2020 · 2 comments
Closed

swift run --repl fails #820

JonasVautherin opened this issue Jun 4, 2020 · 2 comments
Labels

Comments

@JonasVautherin
Copy link
Contributor

From a place where swift build works (e.g. from the root of the repo), it should be possible to run a REPL with:

swift run --repl

With grpc-swift on 1.0.0-alpha.12, I get the following error:

% swift run --repl
Fetching https://github.com/apple/swift-log.git
Fetching https://github.com/apple/swift-nio-ssl.git
Fetching https://github.com/apple/swift-nio-http2.git
Fetching https://github.com/apple/swift-protobuf.git
Fetching https://github.com/apple/swift-nio.git
Fetching https://github.com/apple/swift-nio-transport-services.git
Completed resolution in 19.98s
Cloning https://github.com/apple/swift-nio-http2.git
Resolving https://github.com/apple/swift-nio-http2.git at 1.12.1
Cloning https://github.com/apple/swift-nio-transport-services.git
Resolving https://github.com/apple/swift-nio-transport-services.git at 1.3.0
Cloning https://github.com/apple/swift-nio-ssl.git
Resolving https://github.com/apple/swift-nio-ssl.git at 2.7.1
Cloning https://github.com/apple/swift-log.git
Resolving https://github.com/apple/swift-log.git at 1.2.0
Cloning https://github.com/apple/swift-nio.git
Resolving https://github.com/apple/swift-nio.git at 2.15.0
Cloning https://github.com/apple/swift-protobuf.git
Resolving https://github.com/apple/swift-protobuf.git at 1.8.0
[878/878] Linking Echo
Launching Swift REPL with arguments: -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug -L/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug -lgrpc-swift__REPL -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIOBoringSSL.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIOBoringSSLShims.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIOAtomics.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIODarwin.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIOSHA1.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CGRPCZlib.build -I/private/tmp/grpc-swift/.build/x86_64-apple-macosx/debug/CNIOLinux.build
Welcome to Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15).
Type :help for assistance.
  1> import GRPC
warning: Swift error in fallback scratch context: <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/private/tmp/grpc-swift/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSLShims/include/CNIOBoringSSLShims.h"
        ^

error: /private/tmp/grpc-swift/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSLShims/include/CNIOBoringSSLShims.h:22:10: error: 'CNIOBoringSSL.h' file not found
#include "CNIOBoringSSL.h"
         ^

error: could not build Objective-C module 'CNIOBoringSSLShims'


note: This error message is displayed only once. If the error displayed above is due to conflicting search paths to Clang modules in different images of the debugged executable, this can slow down debugging of Swift code significantly, since a fresh Swift context has to be created every time a conflict is encountered.

0  lldb                     0x00000001099d5705 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  lldb                     0x00000001099d4d77 llvm::sys::RunSignalHandlers() + 39
2  lldb                     0x00000001099d5d58 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff73d6942d _sigtramp + 29
4  libsystem_malloc.dylib   0x00007fff73d2b167 free_tiny + 468
5  LLDB                     0x000000010a333643 std::__1::pair<std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, swift::ValueDecl*>, void*>*>, std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, swift::ValueDecl*>, void*>*> > std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, swift::ValueDecl*>, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, swift::ValueDecl*>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, swift::ValueDecl*>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, swift::ValueDecl*> > >::__equal_range_multi<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 19
6  LLDB                     0x000000010a333215 lldb_private::SwiftPersistentExpressionState::SwiftDeclMap::FindMatchingDecls(lldb_private::ConstString, std::__1::vector<swift::ValueDecl*, std::__1::allocator<swift::ValueDecl*> > const&, std::__1::vector<swift::ValueDecl*, std::__1::allocator<swift::ValueDecl*> >&) + 213
7  LLDB                     0x000000010a33341c lldb_private::SwiftPersistentExpressionState::GetSwiftPersistentDecls(lldb_private::ConstString, std::__1::vector<swift::ValueDecl*, std::__1::allocator<swift::ValueDecl*> > const&, std::__1::vector<swift::ValueDecl*, std::__1::allocator<swift::ValueDecl*> >&) + 28
8  LLDB                     0x000000010a0ca8d5 lldb_private::ExpressionSourceCode::GetText(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, lldb::LanguageType, unsigned int, lldb_private::EvaluateExpressionOptions const&, lldb_private::ExecutionContext&, unsigned int&) const + 4677
9  LLDB                     0x000000010a337d6d lldb_private::SwiftUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) + 509
10 LLDB                     0x000000010a0e608a lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::Status&, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<lldb_private::Module>*) + 2858
11 LLDB                     0x000000010a0e3d21 lldb_private::REPL::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 2129
12 LLDB                     0x000000010a059100 lldb_private::IOHandlerEditline::Run() + 368
13 LLDB                     0x000000010a0404db lldb_private::Debugger::ExecuteIOHandlers() + 123
14 LLDB                     0x000000010a042f23 lldb_private::Debugger::IOHandlerThread(void*) + 19
15 LLDB                     0x000000010a0ed7e7 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 103
16 libsystem_pthread.dylib  0x00007fff73d74e65 _pthread_start + 148
17 libsystem_pthread.dylib  0x00007fff73d7083b thread_start + 15
zsh: segmentation fault  swift run --repl

This means that any project depending on grpc-swift cannot use the REPL, as far as I understand.

Would you have an idea about what's happening there? 😕

@weissi
Copy link
Contributor

weissi commented Jun 4, 2020

@JonasVautherin that's a SwiftPM bug manifesting as an LLDB problem: https://bugs.swift.org/browse/SR-12050

The Swift REPL is using LLDB to work which is why you're seeing it here.

@JonasVautherin
Copy link
Contributor Author

Oh, that's very good to know! Thanks 😊.

Feel free to close this issue, or otherwise I'll close it when the SwiftPM bug is fixed 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants