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

Peter Ronnquist peter.ronnquist at gmail.com
Mon Jan 30 15:17:18 CST 2017


Michael, I did the following to get the error:

----------------------------------------------------------
peter at peter-UX305CA:~/Documents/dev/swift/measurement$ swift -v
Swift version 3.1-dev (LLVM 3e67f314a4, Clang 0540ceb7ad, Swift ca7046e4a3)
Target: x86_64-unknown-linux-gnu
/home/peter/Documents/programs/swift/swift-DEVELOPMENT-SNAPSHOT-2017-01-04-a-ubuntu16.10/usr/bin/lldb
"--repl=-disable-objc-interop -color-diagnostics"
Welcome to Swift version 3.1-dev (LLVM 3e67f314a4, Clang 0540ceb7ad,
Swift ca7046e4a3). 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'

  1>
----------------------------------------------------------

Mishal, I'll file a bug.

Thank you all for your assistance.



On Mon, Jan 30, 2017 at 10:07 PM, mishal_shah <mishal_shah at apple.com> wrote:
> Hi Peter,
>
> Can you please file a bug (bugs.swift.org)? I am also seeing same error.
>
> Thanks,
> Mishal Shah
>
> On Jan 30, 2017, at 12:15 PM, Michael Gottesman via swift-users
> <swift-users at swift.org> wrote:
>
> 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
>
> Probably could use one that imports Foundation though.
>
> Michael
>
>
> On Jan 30, 2017, at 12:00 PM, Michael Gottesman <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> 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
> _______________________________________________
> 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
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


More information about the swift-users mailing list