Open CoryFoy opened 1 year ago
This seems expected to me, since SwiftPM will not link libGeographicLib.a
, so the linker errors are correct.
What is surprising to me is that there is no mention of the library existing in a target directory without being handled explicitly, so that seems like a bug. I would expect a warning for that.
Thanks @neonichu - I'm fairly new to linking Swift to C++ - is there an additional flag I can pass in to link them together? Or would I be better off just including the whole source instead of just the compiled library and letting it build?
And is there any reason why it's compiling fine for the main library but not for the tests?
(Come to think of it - maybe it is better for me to include the source rather than the compiled library on the off chance others need to use my library on other platforms)
And is there any reason why it's compiling fine for the main library but not for the tests?
It only happens for the tests since that's the only "final" executable being produced which resolves all the symbols. For the library target, we are only producing object files and so no linker invocation happens.
Typically, we always recommend distributing source unless there's a strong reason for using a binary instead. For binaries, this describes how to package them for use with SwiftPM. This is currently only supported when targeting Apple platforms.
Possibly related to #6661.
Description
I've explained some of the issue in this forum post but tl;dr:
I have a minimal repro available here on GitHub.
Expected behavior
To be able to build the entire project.
Actual behavior
I get the following Linker Errors:
Steps to reproduce
Swift Package Manager version/commit hash
5.9
Swift & OS version (output of
swift --version ; uname -a
)