<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 10, 2016, at 6:05 PM, Drew Crawford via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I have built the Feb 8th snapshot into /usr/local on Linux 64. I have enabled libdispatch, and it's installed to /usr/local as well. Additionally, I cherry-picked the PR <a href="https://github.com/apple/swift/pull/1212" class="">https://github.com/apple/swift/pull/1212</a>. It compiles, installs, everything's fine.<div class=""><br class=""></div><div class="">My /usr/local/include/dispatch directory has</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""># ls /usr/local/include/dispatch/</div><div class="">Dispatch.swiftdoc base.h data.h<span class="Apple-tab-span" style="white-space:pre">        </span> group.h<span class="Apple-tab-span" style="white-space:pre">        </span> io.h<span class="Apple-tab-span" style="white-space:pre">        </span>object.h queue.h source.h</div><div class="">Dispatch.swiftmodule block.h dispatch.h introspection.h module.map<span class="Apple-tab-span" style="white-space:pre">        </span>once.h<span class="Apple-tab-span" style="white-space:pre">        </span> semaphore.h time.h</div></blockquote><div class=""><div class=""><br class=""></div><div class="">Now I attempt to use Dispatch via</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">swift -Xcc -fblocks -L/usr/local/lib -I /usr/local/include/dispatch -lBlocksRuntime -L/usr/lib/x86_64-linux-gnu</div></blockquote><div class=""><div class=""><br class=""></div><div class=""><div class="">This is because:</div></div></div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">-Xcc -fblocks to pick up blocks support</li><li class="">-I /usr/local/include/dispatch to pick up /usr/local/include/dispatch/Dispatch.swiftmodule (as well as module.modulemap etc.)</li><li class="">-lBlocksRuntime -L/usr/lib/x86_64-linux-gnu to pick up blocks runtime</li></ul><div class=""><br class=""></div></div><div class="">Okay. So now I import Dispatch:</div><div class=""><br class=""></div><div class="">Welcome to Swift version 3.0-dev (LLVM a7663bb722, Clang 4ca3c7fa28, Swift 319a912638). Type :help for assistance.<br class=""> 1> import Dispatch</div><div class=""><br class=""></div><div class="">What I find is about half the time, this works just fine. The other half the time, I hit an import error:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><module-includes>:1:10: note: in file included from <module-includes>:1:<br class="">#include "/usr/local/include/dispatch/dispatch.h"<br class=""> ^<br class="">/usr/local/include/dispatch/dispatch.h:34:10: note: in file included from /usr/local/include/dispatch/dispatch.h:34:<br class="">#include <fcntl.h><br class=""> ^<br class="">/usr/include/fcntl.h:67:11: note: in file included from /usr/include/fcntl.h:67:<br class=""># include <time.h><br class=""> ^<br class="">/usr/local/include/dispatch/time.h:25:2: error: "Please #include <dispatch/dispatch.h> instead of this file directly."<br class="">#error "Please #include <dispatch/dispatch.h> instead of this file directly."<br class=""> ^</blockquote><br class=""></div><div class="">What seems to be happening here is that we interpret /usr/include/fcntl.h's #include <time.h> to be /usr/local/include/dispatch/time.h instead of /usr/include/time.h.</div><div class=""><br class=""></div><div class="">This behavior is puzzling to me.</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">I don't understand why the behavior is nondeterministic. Shouldn't an import failure be deterministic behavior? Or are we just trying imports in random order? That seems like a bad implementation.</li><li class="">I don't understand how to make sure fcntl's `time.h` goes to the right time.h without also losing Dispatch.swiftmodule and module.modulemap in the exchange.</li></ul></div></div></div></div></blockquote><div><br class=""></div><div>The -I/usr/local/include/dispatch probably sees time.h in there and thinks that is part of a system root header? Just a speculation.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><br class=""></div><div class="">Thanks in advance.</div><div class=""><br class=""></div></div></div></div>_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev<br class=""></div></blockquote></div><br class=""></body></html>