-
Notifications
You must be signed in to change notification settings - Fork 200
Jobs: do not inject the swiftautolink file into archives #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It has been observed that a static library may sometimes contain the autolink extracted rules. This causes autolink-extract to not be able to process the archive as a dependency, causing a build failure.
@swift-ci please test |
We should figure out if we can craft a test case for this, but this stands a good chance of fixing the stray autolink extract file getting into the static library. |
Heh, I've been seeing this for months and just filed a bug for it, SR-14981. I was just trying out a similar fix that works, but I included bitcode since that's what the C++ driver does, As for a test, |
The bitcode should not be in this path; there is a separate path that can permit the bitcode files as well. There is no guarantee that the normal archiver/librarian will support the bitcode. That is why there is a special case for the LTO. For the testing, I couldn't figure out how to get the driver to inject the autolink file. I agree that adding the explicit check there is better than nothing, but some reproducible before/after tests would be very much more comforting. |
We should get this into trunk and Swift 5.5 soon, as this will break any Swift projects using CMake and static libraries, which ironically includes this project through its Yams dependency, as noted on the linked bug. What's holding this up, @compnerd, are you writing more tests? Can't we just get this in with the test I suggested and you can add more tests later? |
Since we still do not have a clear understanding of exactly how this occurs, but we also have evidence this is impacting our adopters, let’s merge and nominate. If we find a reproducer, we’ll make a test of it then |
Sounds like a plan @CodaFi! @buttaface, Im not convinced that test case adds much value as that does not routinely pick up the actual command list. I can certainly add that as a test case if you feel strongly about that. But that can easily be a follow up. |
Yes, I'll do a follow up for the bitcode issue, that is totally a valid issue. |
@buttaface oh, going back through the code now, I see why you were bringing it up here. I don't know what bit of code I was mixing it up with, because I remember the LTO and non-LTO paths as being different. |
I found the
It reports the autolink file as an input to the final static linking step even without the new driver, so I tried this simple patch and I was able to reproduce this bug with the old C++ Driver too:
|
The problem was I couldn't get the autolink extract file to be generated consistently. Are you saying that what I didn't understand was that it needs |
No, I didn't understand what you meant earlier by "Im not convinced that test case adds much value as that does not routinely pick up the actual command list," but I think I know our miscommunication now. You're worried that the autolink file is not always in the library, but I'm only worried about the linking command produced by this driver. The former is inconsistent, the latter is 100% reproducible. Try reverting this pull and adding the single line testcase I gave above and running the tests repeatedly: I believe it will fail 100% of the time, because it simply checks what linker command-line is generated and not the final static library for an autolink file. Anyway, my explanation above is simply to share with @CodaFi and you guys what my investigation into the root cause found, I wasn't thinking of the test case when I wrote that. I don't think |
Interesting, however, I can see your point about the command line being a good proxy for the issue. It is further indication about what I was suspecting that is happening. If it reproducibly creates the invalid command line, I think that adding a test for that still is validating something important and makes sense to have as a test case. I will try to get a follow up PR to add that then. |
It has been observed that a static library may sometimes contain the
autolink extracted rules. This causes autolink-extract to not be able
to process the archive as a dependency, causing a build failure.