Closed swift-ci closed 8 years ago
This is a package manager bug as we decide the order.
Comment by Jay Buffington (JIRA)
Ah, yes, looks like the bug is somewhere around here (from Sources/dep/llbuild.swift
)
// Target dependencies are *already* reverse sorted.
let libsInThisPackage = target.dependencies
.filter{ $0.type == .Library }
.map{ $0.productFilename }
.map{ Path.join(params.prefix, $0) }
Comment by Shmuel Kallner (JIRA)
I'd like to add that this bug will only show itself on certain Unix based platforms. In particular on OSX you won't see this issue because LD will scan the list of .a flles multiple times.
One solution for this on Linux albeit not optimal is to place all of the .a's in a group using the -( and -) LD parameters around the .a files. This may not be optimal as the LD documentation claims there is a performance penalty for doing this.
We should be able to order them correctly
Confirmed this still occurs after the testing refactor. Looking into it.
Comment by Shmuel Kallner (JIRA)
We have found that the issue seems to crop up if one adds "extra" dependencies beyond the minimal list needed.
By that I mean, if A is dependent on B and B is dependent on C, then in theory A can directly import C, even though A is not directly dependent on C and that dependency may not have been listed in A's dependency list at all. If however C gets listed as a dependency of A and by chance it is listed in the dependency list after B, then the problem occurs. The solution is to make sure that such lists of dependencies are in reverse order, i.e. in the case above C is listed before B
Actually, good news, I didn't correctly verify this bug. It seems to work with latest swiftpm:
Let me know if I'm wrong.
Comment by Jay Buffington (JIRA)
Works for me 👍
Attachment: Download
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 2 | |Component/s | Package Manager | |Labels | Bug | |Assignee | @mxcl | |Priority | Medium | md5: f13d5ad12d638b307720fac644c5388frelates to:
Issue Description:
It looks like llbuild doesn't consider order to pass .a files to swiftc.
The list of .a files and their order is passed from swiftc to clang++, which is finally passed to ld. ld's man page says that order matters: