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

[SR-12532] swift run --repl crashes with C/C++ dependencies #4471

Open
swift-ci opened this issue Apr 6, 2020 · 0 comments
Open

[SR-12532] swift run --repl crashes with C/C++ dependencies #4471

swift-ci opened this issue Apr 6, 2020 · 0 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@swift-ci
Copy link

swift-ci commented Apr 6, 2020

Previous ID SR-12532
Radar https://feedbackassistant.apple.com/feedback/7654249
Original Reporter yaroslav_ya (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: 6dac3de1a9206b54e6e2f1fcb1a58ee5

Issue Description:

The swift compiler with versions 5.1.3, 5.2 crashes if you run any project containing C/C++ dependencies with --repl attribute: `swift run --repl`.

This behavior appears on macOS only, on Ubuntu 18 same packages works well in the same situation. The crash appears on import Swift Package that contains the C/C++ dependencies into repl.

  • The `swift test` command within the same setup works properly.

  • The same project, but as executable (e.g. MyLibrary.swift renamed to main.swift) works properly with `swift run` command.

Steps to reproduce:

  1. `swift package init --type library MyLibrary`.
    2.1 Add the following dependency to the package dependencies: `.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.0.0")`.
    2.2 Add follow dependency to MyLibrary target dependencies: `.product(name: "AsyncHTTPClient", package: "async-http-client"),`.
  2. Run `swift run --repl`.
  3. In swift console console type: `import MyLibrary`.

Expected behavior:

Package loads and its public types and methods are available within repl runtime.

Current behavior:

Repl crashes with the following stacktrace:

warning: Swift error in fallback scratch context: <module-includes>:1:9: note: in file included from <module-includes>:1:
 #import "/Volumes/devel/Programming/swift/CourtParser/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSLShims/include/CNIOBoringSSLShims.h"
 ^
error: /Volumes/devel/Programming/swift/CourtParser/.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 0x0000000103a43f08 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
 1 lldb 0x0000000103a434c5 llvm::sys::RunSignalHandlers() + 85
 2 lldb 0x0000000103a44550 SignalHandler(int) + 272
 3 libsystem_platform.dylib 0x00007fff7218f5fd _sigtramp + 29
 4 libsystem_platform.dylib 0x000070000baca650 _sigtramp + 2576593008
 5 LLDB 0x0000000103caa957 lldb_private::IOHandlerEditline::Run() + 375
 6 LLDB 0x0000000103c92b89 lldb_private::Debugger::ExecuteIOHandlers() + 105
 7 LLDB 0x0000000103c95463 lldb_private::Debugger::IOHandlerThread(void*) + 19
 8 LLDB 0x0000000103d3c547 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 103
 9 libsystem_pthread.dylib 0x00007fff7219b109 _pthread_start + 148
 10 libsystem_pthread.dylib 0x00007fff72196b8b thread_start + 15
 [1] 7804 segmentation fault swift run --repl
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

1 participant