[swift-users] Swift Package Manager: Linker Flags
Stephen Celis
stephen.celis at gmail.com
Wed Feb 24 20:03:34 CST 2016
Thanks for following up :)
> On Feb 24, 2016, at 8:46 PM, Fabio Kaminski <fabiokaminski at gmail.com> wrote:
>
> 1 - For me at least the "link" directive works only for shared libs,
> and given you are looking into the symbols of the .a file and not the
> .dylib or .so, that its probably what the modulemap will try to link
> against?
Ah, interesting! Is there a reason for this limitation? Could a bug be filed for a swiftpm enhancement that automatically adds `-l` flags for whatever is included as a `link` in the module map?
> I think the [extern_c] directive maybe is the magic sauce that will
> try to link the symbols using the correct mangling technique "_" ?
Unfortunately [extern_c] doesn't seem to have any effect on linking, though it appears to be the correct attribute according to http://clang.llvm.org/docs/Modules.html#module-declaration <http://clang.llvm.org/docs/Modules.html#module-declaration>. I was able to fix the problem, though, with this Makefile in my dependent project:
https://gist.github.com/stephencelis/7f76f8d26a1df64ee3ff#file-llvm_makefile-mak <https://gist.github.com/stephencelis/7f76f8d26a1df64ee3ff#file-llvm_makefile-mak>
It's an unfortunate limitation. Requiring dependent projects to set certain `-Xcc` and `-Xlinker` flags makes the parent CLLVM dependency a lot less easy to use. I'm not sure if there have been evolution, bug, or internal discussions around this, though. At least I'm unblocked in the meantime. Thanks again!
--
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160224/adee524f/attachment.html>
More information about the swift-users
mailing list