[swift-users] Swift Package Manager: Linker Flags
Stephen Celis
stephen.celis at gmail.com
Mon Feb 22 09:44:23 CST 2016
Hi all,
I've also been having trouble getting a Swift interface to LLVM's C API. The basic gist is here:
https://gist.github.com/stephencelis/5de13eeb9743e7a3aed3 <https://gist.github.com/stephencelis/5de13eeb9743e7a3aed3>
I've:
- Installed LLVM via homebrew, so it lives in "/usr/local/opt/llvm" (I've also built LLVM myself and have the same ).
- 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?
- Added many more LLVM headers/links to the module map and continued to have the same issue.
The linker's still having trouble. I'm probably missing something very basic.
Stephen
> On Jan 4, 2016, at 1:08 PM, Daniel Dunbar via swift-users <swift-users at swift.org> wrote:
>
> 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:
> http://clang.llvm.org/docs/Modules.html#link-declaration <http://clang.llvm.org/docs/Modules.html#link-declaration>
>
> Here is a concrete example, which is how Swift knows to automatically link libpthread and libdl when Glibc is used:
> https://github.com/apple/swift/blob/master/stdlib/public/Glibc/module.map.in <https://github.com/apple/swift/blob/master/stdlib/public/Glibc/module.map.in>
>
> - Daniel
>
>> On Jan 1, 2016, at 4:48 PM, Ilija Tovilo via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>
>> Happy new year everyone!
>>
>> I’m writing a wrapper around the LLVM-C API for Swift and thought it’d be fun to use the Swift Package Manager.
>> 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).
>>
>> The package itself compiles fine and building the project that includes it works too, except that it doesn’t link.
>> 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.
>>
>> I’ve searched the tutorials, documentation and the source code but couldn’t find a solution.
>> Is there a way to add linker flags / compile flags to your Package.swift file?
>>
>> 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.
>>
>> Thanks for the help!
>>
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org <mailto:swift-users at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160222/4c9ab706/attachment.html>
More information about the swift-users
mailing list