<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Please record this in a bug at <a href="http://bugs.swift.org">bugs.swift.org</a> so that it doesn’t get lost, if you haven’t already.&nbsp;<div><br></div><div>Thanks!</div><div><br></div><div>Alex<br><br><div id="AppleMailSignature">Sent from my iPhone 📱</div><div><br>On 16 Oct 2017, at 19:56, Edward Connell &lt;<a href="mailto:ewconnell@gmail.com">ewconnell@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Specifying the clang import location is what is triggering the LLDBFrontend crash.&nbsp;<div>I think you are saying that I should not need to specify the clang include import location to the compiler.</div><div><br></div><div><div>I've attached the unmodified SwiftProtobuf example program found in the docs at <a href="https://github.com/apple/swift-protobuf.git">https://github.com/apple/swift-protobuf.git</a>, so this is independent from my project.</div></div><div><br></div><div>Are you able to simply do "swift build" and successfully debug and examine values like "info"?&nbsp;</div><div>For me it fails unless I also specify the import location for the clang include directory.</div><div><br></div><div>swift build -I/home/ed/swift/usr/lib/swift/clang/include</div><div><br></div><div>And yes I checked, I am picking up the correct swift binary</div><div><br></div><div><br></div><div><b>Swift</b><br></div><div>$ swift --version<br></div><div><div>Swift version 4.0.1-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift 00e34e4b1e)</div><div>Target: x86_64-unknown-linux-gnu</div></div><div><br></div><div><b>LLDB failure output</b></div><div>------------------------</div><div><div>$ lldb HelloWorld</div><div>(lldb) target create "HelloWorld"</div><div>Current executable set to 'HelloWorld' (x86_64).</div><div>(lldb) b main.swift:20</div><div>Breakpoint 1: where = HelloWorld`main + 1116 at main.swift:21, address = 0x000000000041146c</div><div>(lldb) run</div><div>Process 20745 launched: '/home/ed/Documents/prototest/.build/x86_64-unknown-linux/debug/HelloWorld' (x86_64)</div><div>Process 20745 stopped</div><div>* thread #1, name = 'HelloWorld', stop reason = breakpoint 1.1</div><div>&nbsp; &nbsp; frame #0: 0x000000000041146c HelloWorld`main at main.swift:21</div><div>&nbsp; &nbsp;18&nbsp; <span style="white-space:pre">                </span>let binaryData: Data = try info.serializedData()</div><div>&nbsp; &nbsp;19&nbsp; <span style="white-space:pre">        </span></div><div>&nbsp; &nbsp;20&nbsp; <span style="white-space:pre">        </span>// Deserialize a received Data object from `binaryData`</div><div>-&gt; 21&nbsp; <span style="white-space:pre">                </span>let decodedInfo = try BookInfo(serializedData: binaryData)</div><div>&nbsp; &nbsp;22&nbsp; <span style="white-space:pre">        </span></div><div>&nbsp; &nbsp;23&nbsp; <span style="white-space:pre">        </span>// Serialize to JSON format as a Data object</div><div>&nbsp; &nbsp;24&nbsp; <span style="white-space:pre">                </span>let jsonData: Data = try info.jsonUTF8Data()</div><div>Target 0: (HelloWorld) stopped.</div><div>(lldb) p info</div><div>error: in auto-import:</div><div>failed to get module 'HelloWorld' from AST context:</div><div>&lt;module-includes&gt;:1:10: note: in file included from &lt;module-includes&gt;:1:</div><div>#include "CoreFoundation.h"</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>error: /home/ed/swift/usr/lib/swift/CoreFoundation/CoreFoundation.h:26:10: error: 'stdarg.h' file not found</div><div>#include &lt;stdarg.h&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>/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:</div><div>#include &lt;dispatch/dispatch.h&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>&lt;module-includes&gt;:1:10: note: in file included from &lt;module-includes&gt;:1:</div><div>#include "dispatch.h"</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>/home/ed/swift/usr/lib/swift/dispatch/dispatch.h:30:10: note: in file included from /home/ed/swift/usr/lib/swift/dispatch/dispatch.h:30:</div><div>#include &lt;os/linux_base.h&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>/home/ed/swift/usr/lib/swift/os/linux_base.h:19:10: note: in file included from /home/ed/swift/usr/lib/swift/os/linux_base.h:19:</div><div>#include &lt;sys/param.h&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>error: /usr/include/x86_64-linux-gnu/sys/param.h:23:10: error: 'stddef.h' file not found</div><div>#include &lt;stddef.h&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div><div><br></div><div>error: could not build C module 'CoreFoundation'</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 16, 2017 at 11:00 AM, Alex Blewitt <span dir="ltr">&lt;<a href="mailto:alblue@apple.com" target="_blank">alblue@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">&gt; On 16 Oct 2017, at 18:52, Edward Connell &lt;<a href="mailto:ewconnell@gmail.com">ewconnell@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; While creating a bug report for this problem I placed my simple repro case in a separate project with default build settings and I found that it no longer crashes LLDB.<br>
&gt;<br>
&gt; My main project links to several system C libraries, because I am using libpng, Cuda, etc...<br>
&gt; In order for LLDB to function with my project and load things from the AST context, I was told to specify the clang include directory.<br>
&gt;<br>
&gt; swift build -Xswiftc -I${SWIFT_HOME}/lib/swift/<wbr>clang/include<br>
&gt;<br>
&gt; In the past everything worked fine.<br>
&gt;<br>
&gt; The stand alone bug repro project has no C library dependencies, however if I add this option, LLDB crashes.<br>
<br>
</span>If you can add that information to the bug report, including whawt version of swift you're using (with swiftc -v) and the crash report then that would allow others to see what problem you're experiencing.<br>
<br>
I assume that SWIFT_HOME is the same location as the swift executable that you're running? Might be worth checking with 'which swift'.<br>
<span class=""><br>
&gt; I tried eliminating this option from my main project, and from a separate project using SwiftProtobuf. The result is that I am no longer able to debug either of them. Is there some new way we are supposed to pick up system imports, or is the a legitimate bug?<br>
<br>
</span>The Swift REPL on Linux needs to have the -I flag in order to work as expected. However, the swift compiler shouldn't need to have that information, since it will know where the corresponding include directory is.<br>
<span class="HOEnZb"><font color="#888888"><br>
Alex<br>
</font></span></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div>&lt;prototest.tar.gz&gt;</div></blockquote></div></body></html>