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-5632] Swift REPL does not start on Linux #4624

Closed
swift-ci opened this issue Aug 4, 2017 · 9 comments
Closed

[SR-5632] Swift REPL does not start on Linux #4624

swift-ci opened this issue Aug 4, 2017 · 9 comments
Labels

Comments

@swift-ci
Copy link

swift-ci commented Aug 4, 2017

Previous ID SR-5632
Radar None
Original Reporter Vladislav (JIRA User)
Type Bug
Status Resolved
Resolution Cannot Reproduce
Environment

Linux ved-hp-gentoo 4.12.5-gentoo #1 SMP Wed Aug 16 20:24:09 MSK 2017 x86_64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz GenuineIntel GNU/Linux

clang version 3.9.1 (tags/RELEASE_391/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug, Linux, REPL
Assignee None
Priority Medium

md5: efedf513595f314a593fddcd9377e69c

Issue Description:

Today after fresh checkout I did build Swift from sources abu unable to run REPL. I have got the following error:
vedg@ved-hp-gentoo /mnt/swift $ swift
error: Could not construct an expression context for the REPL.

The environment is:
Fresh gentoo but Pyhon 2 is the default

clang version 3.9.1 (tags/RELEASE_391/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Swift has been installed using the command
utils/build-script --preset=buildbot_linux,no_test install_destdir=/mnt/swift/gentoo installable_package=/mnt/swift/gentoo/swift-gentoo.tar.gz
and I have copied /mnt/swift/gentoo/usr into /

Swift version 4.0-dev (LLVM 98499e0a26, Clang 337d432629, Swift ae6c61e)
Target: x86_64-unknown-linux-gnu

@swift-ci
Copy link
Author

swift-ci commented Aug 7, 2017

Comment by Vladislav Dembskiy (JIRA)

Today I did fresh checkout and got the same error on LFS. My LFS systems has another tools then Gentoo but the error is the same.

@swift-ci
Copy link
Author

swift-ci commented Aug 7, 2017

Comment by Vladislav Dembskiy (JIRA)

I have renamed the issue because I have got the same eroor on Gentoo and LFS.

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

On updated Gentoo I have go the same error:

vedg@ved-hp-gentoo /mnt/swift/swift-source/swift $ swift
error: Could not construct an expression context for the REPL.

@dcci
Copy link
Mannequin

dcci mannequin commented May 29, 2019

Can't repro anymore.

@Bouke
Copy link

Bouke commented Nov 1, 2019

It happens for me, on Raspbian Stretch with the current Swift 5.1 arm release:

pi@pi3:~ $ swift --version
Swift version 5.1 (swift-5.1-RELEASE)
Target: armv6-unknown-linux-gnueabihf 
 
pi@pi3:~ $ swift
error: Could not construct an expression context for the REPL.

@dcci
Copy link
Mannequin

dcci mannequin commented Nov 1, 2019

I think it's a different issue [arm vs x86-64].

@dcci
Copy link
Mannequin

dcci mannequin commented Nov 1, 2019

also, arm is not really officially supported on swift/Linux

@swift-ci
Copy link
Author

Comment by Cebtenzzre (JIRA)

I'm getting this error too. I built Swift from commit e3409e4 on the tensorflow branch.

$ swift --version
Swift version 5.2-dev
Target: x86_64-unknown-linux-gnu

@swift-ci
Copy link
Author

Comment by Cebtenzzre (JIRA)

Well, I figured it out.
I ran the following command to get some diagnostic info:

$ lldb --repl=-disable-objc-interop --one-line-before-file 'log enable lldb host'
(lldb) log enable lldb host
lldb shlib dir -> `/usr/lib/`
lldb HostInfo::ComputePathRelativeToLibrary() attempting to derive the path /bin relative to liblldb install path: /usr/lib
lldb HostInfo::ComputePathRelativeToLibrary() derived the path as: /usr/bin
lldb support exe dir -> `/usr/bin/`
lldb Process::ReadModuleFromMemory reading [vdso] binary from memory
lldb DefaultComputeSwiftResourceDir: Setting SwiftResourceDir to "/usr/lib/swift", verify = true
lldb swift dir -> '/usr/lib/swift/'
lldb VerifyClangPath(): failed to stat clang resource directory at "/usr/lib/clang/7.0.0"
lldb VerifyClangPath(): failed to stat clang resource directory at "/usr/lib/lldb/clang"
lldb GetClangResourceDir() => ''
error: Could not construct an expression context for the REPL.

So, the issue here (which I figured out mostly using GDB) is that LLDB can't find the clang resource directory (/usr/lib/clang/9.0.1).
The solution, in my case, is to symlink /usr/lib/lldb/clang to /usr/lib/clang/9.0.1.

This error message is unhelpful and the resource directory handling seems overly fragile.
Is this a Swift issue or an LLDB issue?

@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
This issue was closed.
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

2 participants