Skip to content
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

[SR-11528] swift build --target TARGETNAME doesn't create the executable required by swift run --skip-build #4658

Open
kevints mannequin opened this issue Sep 26, 2019 · 3 comments
Labels

Comments

@kevints
Copy link
Mannequin

kevints mannequin commented Sep 26, 2019

Previous ID SR-11528
Radar rdar://problem/55739488
Original Reporter @kevints
Type Bug
Environment

Xcode 11 GM

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

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.

% 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.

@kevints
Copy link
Mannequin Author

kevints mannequin commented Sep 26, 2019

@swift-ci create

@ankitspd
Copy link
Member

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.

@kevints
Copy link
Mannequin Author

kevints mannequin commented Sep 26, 2019

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?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants