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

REPL and lldb are broken on Linux. Fix known (at bash level) #124

Closed
felix91gr opened this issue Apr 15, 2018 · 1 comment
Closed

REPL and lldb are broken on Linux. Fix known (at bash level) #124

felix91gr opened this issue Apr 15, 2018 · 1 comment

Comments

@felix91gr
Copy link
Contributor

Lemme explain.

How are they broken

If you're on Mac OS, you can try using the docker-swift image. They reported seeing the exact same issue. Their workaround doesn't fix lldb, though, so we'll skip that for now.

If you're on Linux or have the docker image ready:

  1. Run swift. That should open the Swift REPL
  2. Inside the REPL, run print("Hi"). That should work.
  3. Inside the REPL, run import Foundation. That should fail and throw an error of many, many lines:
  2> import Foundation
/home/felix/.swiftenv/versions/4.1/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: note: while building module 'SwiftGlibc' imported from /home/felix/.swiftenv/versions/4.1/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:
#include <sys/types.h>
         ^

<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "///usr/include/utmp.h"
         ^

///usr/include/utmp.h:23:10: note: in file included from ///usr/include/utmp.h:23:
#include <sys/types.h>
.
.
.

LLDB shows the same type of errors.

Details of the problem

I found this and this, but those fixes require (a) to change how you invoke swift and (b) don't fix lldb.

Here, however, they've come up with a better solution that actually fits swiftenv better. The details are below.

How to fix it (from console)

I managed to make it all work like this on bash: (use the equivalent for zsh or fish)

export C_INCLUDE_PATH=~/.swiftenv/versions/4.1/usr/lib/swift/clang/include/
export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH

After that, it works the expected way:

Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
  1> import Foundation
  2> print(NSHomeDirectory())
/home/felix

Should it be fixed from swiftenv?

Dunno. I think so. This bug is really old, and until it gets fixed... well, I'd prefer to have it easier on the Linux devs.

As always, my hands are here to help :)
(although it may take me a week to respond, depending on the week)

@felix91gr
Copy link
Contributor Author

felix91gr commented Apr 15, 2018

Wait, nevermind. I think they are working on fixing this. I'll keep an eye out.

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

No branches or pull requests

1 participant