[swift-users] Importing Foundation or Glibc in REPL on Ubuntu 16.10 failing

Michael Gottesman mgottesman at apple.com
Mon Jan 30 14:15:56 CST 2017


Peter, what are you doing specifically. I.e. are you passing any arguments to swift or something like that? Can you give a full reproducer?

Also can you type swift -v to confirm the version #?

Michael

> On Jan 30, 2017, at 12:04 PM, Michael Gottesman via swift-users <swift-users at swift.org> wrote:
> 
> Interesting... it looks like we /do/ have an integration test that imports glibc into the repl:
> 
> https://github.com/apple/swift-integration-tests/blob/master/repl/test-repl-glibc.py <https://github.com/apple/swift-integration-tests/blob/master/repl/test-repl-glibc.py>
> 
> Probably could use one that imports Foundation though.
> 
> Michael
> 
> 
>> On Jan 30, 2017, at 12:00 PM, Michael Gottesman <mgottesman at apple.com <mailto:mgottesman at apple.com>> wrote:
>> 
>> Hmm... this sounds like this may be a good integration test. I am not sure what is going on here though. If I have a moment I will take a look a bit later today.
>> 
>> Michael
>> 
>>> On Jan 28, 2017, at 1:22 PM, Peter Ronnquist via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>> 
>>> I have the same problem with importing Glibc into the REPL with "Swift
>>> 3.1 Development", Ubuntu 16.10, Jan 22, 2017, that was reported on the
>>> snapshot from 15 December (see below).
>>> 
>>> Is this working for anyone?
>>> 
>>> Best Regards
>>> Peter Ronnquist
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Monday 19 December Chris Double wrote:
>>> 
>>> 
>>> 
>>> Using the Ubuntu 16.10 snapshot from 15 December (or a build from
>>> master) I can't seem to get "import Foundation" or "import Glibc"
>>> working in the REPL. Here's an example:
>>> 
>>> -----------------8<------------------
>>> $ swift
>>> Welcome to Swift version 3.1-dev (LLVM 7d4a331ed3, Clang d8c33dc710,
>>> Swift 2ea7951d05). Type :help for assistance.
>>> 1> import Glibc
>>> <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>
>>>        ^
>>> 
>>> error: could not build Objective-C module 'SwiftGlibc'
>>> -----------------8<------------------
>>> 
>>> 
>>> This works fine if I use 'swiftc' and compile a file:
>>> 
>>> $ cat x.swift
>>> import Glibc
>>> 
>>> print(random())
>>> 
>>> $ swiftc x.swift
>>> $ ./x
>>> ...
>>> -----------------8<------------------
>>> 
>>> If I explicitly pass include paths to 'swift' it works in the REPL:
>>> 
>>> -----------------8<------------------
>>> $ swift -I/home/user/swift-install/usr/lib/swift/clang/include/
>>> -I/home/user/swift-install/usr/include/lldb/Symbol/
>>> Welcome to Swift version 3.1-dev (LLVM 7d4a331ed3, Clang d8c33dc710,
>>> Swift 2ea7951d05). Type :help for assistance.
>>> 1> import Glibc
>>> 2> random()
>>> $R0: Int = 1804289383
>>> -----------------8<------------------
>>> 
>>> Is there some setting or installation setup step I'm missing?
>>> 
>>> -- 
>>> http://bluishcoder.co.nz <http://bluishcoder.co.nz/>
>>> _______________________________________________
>>> swift-users mailing list
>>> swift-users at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-users
>> 
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170130/f37f86aa/attachment.html>


More information about the swift-users mailing list