Open dabrahams opened 6 months ago
My theory for this would be that we're not linking EBNFParser.o
to ParseGenTests
, not entirely sure why this sometimes works and sometimes doesn't though.
Isn't that .o
file supposed to be incorporated into ParseGen
and thus not linked directly into ParseGenTests
, because ParseGen
is linked to ParseGenTests
?
It would be good if things worked that way, but today SwiftPM actually aggregates all the .o files from all dependencies (except dynamic ones, of course) and links them directly to the final product.
My guess to what happens here is that under certain conditions, the .o files from plugin-generated files aren't part of the link step.
OK, well those conditions ought to be pretty easy to track down from this example, as it's quite small. If you need it smaller, it would probably be "easy" to minimize, though I'd rather not spend the hour or two on that if I don't have to.
I think the example we have should be sufficient, thanks!
Description
Check out the
spm-bug-two-builds-needed
tag of https://github.com/dabrahams/hylo-spec-parser and doswift build --build-tests
. It will fail with a link error:The missing symbols are in EBNFParser.swift which it says it generated above:
If you simply issue the same command again it will succeed. It will also succeed if you start with a plain
swift build
and then issueswift build --build-tests
.Expected behavior
Tests build successfully from the get-go.
Actual behavior
No response
Steps to reproduce
No response
Swift Package Manager version/commit hash
Swift Package Manager - Swift 5.9.0
Swift & OS version (output of
swift --version ; uname -a
)swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) Target: arm64-apple-macosx14.0 Darwin DaveA-MBP14-5.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64