LLDB fails when I update to Swift 3.1 (error in auto-import)

Groan... I just tried to update to Swift 3.1 on ubuntu 16.04. Everything
builds fine, but when I try to debug I get the dreaded:

error in auto-import: failed to get module 'XYZ' from AST context

Everything built and debugged just fine with the previous Swift release.
I assume LLDB is unhappy about either failing to find an import, or somehow
thinking there is a duplicate.

How do we get LLDB to disclose the reason that it's failing?

Thanks, Ed

The lldb "types" log is the place where detailed info about what's going on gets dumped. Turn that on with:

(lldb) log enable -f /tmp/lldb-types-log.txt lldb types

Jim

···

On Apr 14, 2017, at 9:33 AM, Edward Connell via swift-users <swift-users@swift.org> wrote:

Groan... I just tried to update to Swift 3.1 on ubuntu 16.04. Everything builds fine, but when I try to debug I get the dreaded:

error in auto-import: failed to get module 'XYZ' from AST context

Everything built and debugged just fine with the previous Swift release.
I assume LLDB is unhappy about either failing to find an import, or somehow thinking there is a duplicate.

How do we get LLDB to disclose the reason that it's failing?

Thanks, Ed

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

*Problem solved:* On Linux you need to add the swift 3.1 tool chain clang
include directory to your import path. It wasn't needed for the previous
version. So add this to your swift build options and lldb will start
working again.

-Xswiftc -I${SWIFT_HOME}/usr/lib/swift/clang/include

Ed

···

On Fri, Apr 14, 2017 at 12:52 PM, Edward Connell <ewconnell@gmail.com> wrote:

What version of clang does Swift 3.1 expect?

My version is:

clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

On Fri, Apr 14, 2017 at 12:23 PM, Edward Connell <ewconnell@gmail.com> > wrote:

I didn't see anything in the log that offered an obvious clue to the
problem. However I made a test case of only a few lines that demonstrates
the problem. Importing Foundation seems to be part of the problem.

   1. set a breakpoint on the print statement
   2. start debugging
   3. on break, at the lldb prompt "p someText", you will get the output
   below complaining about SwiftGlibc

If you comment out "import Foundation" and do the same thing, it works
correctly.
I've attached this linux test project

// main.swift -----------------------------
import Foundation

var someText = "hey there"

for i in 0..<10 {
print("Hello, World!")
}

// output ----------------------------------
*e**rror: in auto-import:*
*failed to get module 'HelloWorld' from AST context:*
*/home/ed/swift/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10:
note: while building module 'SwiftGlibc' imported from
/home/ed/swift/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:
/home/ed/swift/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: error:
could not build module 'SwiftGlibc'*
*#include <sys/types.h>*
* ^*

*/home/ed/swift/usr/lib/swift/CoreFoundation/CFStream.h:20:10: note:
while building module 'CDispatch' imported from
/home/ed/swift/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"*
* ^*

*/home/ed/swift/usr/lib/swift/dispatch/dispatch.h:42:10: note: in file
included from /home/ed/swift/usr/lib/swift/dispatch/dispatch.h:42:*
*#include <sys/cdefs.h>*
* ^*

*error: /usr/include/x86_64-linux-gnu/sys/cdefs.h:23:11: error: could not
build module 'SwiftGlibc'*
*# include <features.h>*
* ^*

*error: could not build Objective-C module 'CoreFoundation'*

On Fri, Apr 14, 2017 at 11:24 AM, Jim Ingham <jingham@apple.com> wrote:

The lldb "types" log is the place where detailed info about what's going
on gets dumped. Turn that on with:

(lldb) log enable -f /tmp/lldb-types-log.txt lldb types

Jim

> On Apr 14, 2017, at 9:33 AM, Edward Connell via swift-users < >>> swift-users@swift.org> wrote:
>
> Groan... I just tried to update to Swift 3.1 on ubuntu 16.04.
Everything builds fine, but when I try to debug I get the dreaded:
>
> error in auto-import: failed to get module 'XYZ' from AST context
>
> Everything built and debugged just fine with the previous Swift
release.
> I assume LLDB is unhappy about either failing to find an import, or
somehow thinking there is a duplicate.
>
> How do we get LLDB to disclose the reason that it's failing?
>
> Thanks, Ed
>
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users