<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi all,</div><div class=""><br class=""></div><div class="">I've also been having trouble getting a Swift interface to LLVM's C API. The basic gist is here:</div><div class=""><br class=""></div><div class=""><a href="https://gist.github.com/stephencelis/5de13eeb9743e7a3aed3" class="">https://gist.github.com/stephencelis/5de13eeb9743e7a3aed3</a></div><div class=""><br class=""></div><div class="">I've:</div><div class=""><br class=""></div><div class="">- Installed LLVM via homebrew, so it lives in "/usr/local/opt/llvm" (I've also built LLVM myself and have the same ).</div><div class="">- Passed "-I" and "-L" to send includes/lib paths to the "-Xcc" and "-Xlinker" flags. (Can a module map or package be configured directly with these paths? Or do all dependent projects need to use these flags, as well?</div><div class="">- Added many more LLVM headers/links to the module map and continued to have the same issue.</div><div class=""><br class=""></div><div class="">The linker's still having trouble. I'm probably missing something very basic.</div><div class=""><br class=""></div><div class="">Stephen</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 4, 2016, at 1:08 PM, Daniel Dunbar via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">You can't do this via the package manager, but you can include "link" declarations in the module map itself which specify additional linker arguments to plumb through when that module is used. See:<div class=""> <a href="http://clang.llvm.org/docs/Modules.html#link-declaration" class="">http://clang.llvm.org/docs/Modules.html#link-declaration</a></div><div class=""><br class=""></div><div class="">Here is a concrete example, which is how Swift knows to automatically link libpthread and libdl when Glibc is used:</div><div class=""> <a href="https://github.com/apple/swift/blob/master/stdlib/public/Glibc/module.map.in" class="">https://github.com/apple/swift/blob/master/stdlib/public/Glibc/module.map.in</a></div><div class=""><br class=""></div><div class=""> - Daniel<br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 1, 2016, at 4:48 PM, Ilija Tovilo via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote: </div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="">Happy new year everyone! </div><div class=""><br class=""></div><div class="">I’m writing a wrapper around the LLVM-C API for Swift and thought it’d be fun to use the Swift Package Manager.</div><div class="">So I created a repository for the module.modulemap that includes the relevant .h files (as instructed in Documentation/SystemModules.md in the GitHub repository).</div><div class=""><br class=""></div><div class="">The package itself compiles fine and building the project that includes it works too, except that it doesn’t link. </div><div class="">The problem is that you have to pass some LLVM linker flags and I have no idea how to do that with the Swift Package Manager.</div><div class=""><br class=""></div><div class="">I’ve searched the tutorials, documentation and the source code but couldn’t find a solution.</div><div class="">Is there a way to add linker flags / compile flags to your Package.swift file?</div><div class=""><br class=""></div><div class="">It would be helpful to pass those flags manually, at least until the package manager is mature enough to handle those things on its own.</div><div class=""><br class=""></div><div class="">Thanks for the help!</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=AdkfTiApI80cNEyortTzHbERtY5det-2FDBvSxuhs4q2Ok0Zt2fbXmOdAf68-2FABXykblCG5fGEo-2BQiKKHMC-2B7u2wkAu2JnvKgU0DwbeuAuTD2UDU8b1XHzpW3QTU9ksvEmOm5Hv7tTiBsEchYVstK-2Fw2S-2FbRUtvYcLdQFFW-2BfKRS5qWbckCWKKOTbrS1RWVr1m-2F1I6sp9CzvYEtnZCuI2MTc6bc3L4QsZZbv1-2BAqLgt88-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=5xu02FVv-2BCbxTLHpBsC0RVeXVC5uCln3pUIIeLTlIi2N1hwg5hhBwpnXr4omh8EQp6lU94efRo2toD8rUdvuVgrFgd2zGPW4BBwjdRUjGpQoMgdDWiHe-2B916pJMBO7cFWi0ZNvOtCqEfE6d4SyN5Lbmq0wGsYa2zOXtYtjPodLaN3ywXMOLlVNS8VtkkGhiBlN-2FvPnmiwuo0xZtgcy7r3pn-2FWY-2FRnNcPziFsZxSTP0o-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>