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

Peter Ronnquist peter.ronnquist at gmail.com
Sat Jan 28 15:22:57 CST 2017


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


More information about the swift-users mailing list