You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that swift build --target TARGETNAME doesn't create the actual linked executable required by swift run TARGETNAME.
You can observe this in the grpc-swift repo, but it should work with any package.
% git clone -b nio https://github.com/grpc/grpc-swift
% git checkout 60205ad
% swift build --target GRPCInteroperabilityTests
% swift run --skip-build GRPCInteroperabilityTests
error: exec error: No such file or directory (2): /.../grpc-swift/.build/x86_64-apple-macosx/debug/GRPCInteroperabilityTests .build/x86_64-apple-macosx/debug/GRPCInteroperabilityTests
As a workaround I found that doing a swift build with no parameters allowed swift run --skip-build TARGETNAME to work. Doing a full build is overkill but works.
The text was updated successfully, but these errors were encountered:
IIRC the --target flag will only build the object files but there's a --product flag to get the linked binary. Try `swift build --product exec-name`. Ideally, `swift run <exec-name>` should only build the subgraph of that executable. I can't recall if we already have that or not but it should be easy to do.
Ah, --product does link the executable. The bug was that it appeared in the products list in the Package manifest, and I assumed that removing it from there meant that I had to build it with --target instead.
It does seem odd that you use product to specify the name of something that isn't a product though. Any reason that the --target mode shouldn't link the executable as well?
Environment
Xcode 11 GM
Additional Detail from JIRA
md5: d6f58ddc22ac750a4d07d15f4354e497
Issue Description:
It seems that swift build --target TARGETNAME doesn't create the actual linked executable required by swift run TARGETNAME.
You can observe this in the grpc-swift repo, but it should work with any package.
As a workaround I found that doing a swift build with no parameters allowed swift run --skip-build TARGETNAME to work. Doing a full build is overkill but works.
The text was updated successfully, but these errors were encountered: