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

Cannot import Foundation in REPL #87

Closed
jeremyblalock opened this issue Oct 23, 2017 · 8 comments
Closed

Cannot import Foundation in REPL #87

jeremyblalock opened this issue Oct 23, 2017 · 8 comments

Comments

@jeremyblalock
Copy link

@jeremyblalock jeremyblalock commented Oct 23, 2017

Using the instructions found in #9 I have successfully run a REPL, but when trying to import Foundation, I get the following error:

$ docker run --cap-add sys_ptrace --privileged -it --rm swiftdocker/swift swift
Welcome to Swift version 4.0 (swift-4.0-RELEASE). Type :help for assistance.
  1> import Foundation
/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: note: while building module 'SwiftGlibc' imported from /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>
         ^

error: /usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
#include <stddef.h>
         ^

<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "CoreFoundation.h"
         ^

error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: error: could not build module 'SwiftGlibc'
#include <sys/types.h>
         ^

/usr/lib/swift/CoreFoundation/CFStream.h:20:10: note: while building module 'CDispatch' imported from /usr/lib/swift/CoreFoundation/CFStream.h:20:
#include <dispatch/dispatch.h>
         ^

<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "dispatch.h"
         ^

/usr/lib/swift/dispatch/dispatch.h:30:10: note: in file included from /usr/lib/swift/dispatch/dispatch.h:30:
#include <os/linux_base.h>
         ^

/usr/lib/swift/os/linux_base.h:17:10: note: in file included from /usr/lib/swift/os/linux_base.h:17:
#include <sys/sysmacros.h>
         ^

error: /usr/include/x86_64-linux-gnu/sys/sysmacros.h:22:10: error: could not build module 'SwiftGlibc'
#include <features.h>
         ^

error: could not build C module 'CoreFoundation'

Is this expected? Should I be able to import Foundation, or am I required to create a separate image and install Foundation there?

@jeremyblalock
Copy link
Author

@jeremyblalock jeremyblalock commented Oct 23, 2017

Doing some research, it looks like this issue has been researched and "resolved" here: https://bugs.swift.org/browse/SR-5686.

So What do we need to do to update the documentation / Dockerfile to get this to work?

@jeremyblalock
Copy link
Author

@jeremyblalock jeremyblalock commented Oct 23, 2017

Resolved this issue, but we should update documentation to reflect the need to add to the search path. The following works properly from within the container:

$ swift -I /usr/lib/swift/clang/include/

Welcome to Swift version 4.0 (swift-4.0-RELEASE). Type :help for assistance.

  1> import Foundation

@hamin
Copy link
Collaborator

@hamin hamin commented Oct 23, 2017

@jeremyblalock a PR to the readme would be much appreciated :)

@swizzlr swizzlr changed the title Cannot import Foundation Cannot import Foundation in REPL Nov 10, 2017
@swizzlr
Copy link
Contributor

@swizzlr swizzlr commented Nov 10, 2017

It's not entirely clear to me if/how they've fixed the issue in the Swift project. However, we definitely need a note to be added about this.

@MrTheSaw
Copy link

@MrTheSaw MrTheSaw commented Nov 24, 2017

BTW, this work around also solved my problem of having import SwiftGlibc fail.

@john9631
Copy link

@john9631 john9631 commented Mar 31, 2018

Still present (Linux Mint 18.3 (U 16.04 based)) so added alias to my .zshrc

alias swift='swift -I ~/.local/usr/lib/swift/clang/include'

But given that virtually everything I tried that relied on it didn't work ... I'd say this is not ready on Linux. I might look again in 2019.

@shahmishal
Copy link
Member

@shahmishal shahmishal commented Dec 12, 2018

@jeremyblalock We are moving Swift Docker issues to https://bugs.swift.org Component: Docker. Can you please file your issue on bugs.swift.org?

We are planning on closing GitHub swift-docker issues on Dec 20th, 2018 (PST).

@ianpartridge
Copy link
Collaborator

@ianpartridge ianpartridge commented Apr 25, 2019

This issue is very old - please reopen if it's still a problem.

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

Successfully merging a pull request may close this issue.

None yet
7 participants