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-4710] swift build -Xswiftc has to be repeated #5031

Closed
swift-ci opened this issue Apr 26, 2017 · 7 comments
Closed

[SR-4710] swift build -Xswiftc has to be repeated #5031

swift-ci opened this issue Apr 26, 2017 · 7 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-4710
Radar None
Original Reporter amraboelela (JIRA User)
Type Bug
Status Closed
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: a1bed3d79d6ff2f91a9a87e01788e725

cloned to:

  • SR-5851 swift build can't change -target

Issue Description:

To pass 2 items to swiftc compiler currently we need to repeat -Xswiftc for each item, e.g.:
swift build -Xswiftc -DDEBUG -Xswiftc -DAppServer

Expected behavior is to use -Xswiftc only once, like:

swift build -Xswiftc -DDEBUG -DAppServer

@belkadan
Copy link

The current behavior is correct. (Otherwise all of the -Xswiftc arguments would have to go at the end, and there is more than one -X option that you might want to pass.)

@swift-ci
Copy link
Contributor Author

Comment by Amr Aboelela (JIRA)

But there got to be a better solution, because imagine I want to add: -emit-library -o libSwiftLevelDB.so
Currently it has to be:
swift build -v -Xswiftc -DDEBUG \
-Xswiftc -emit-library -Xswiftc -o -Xswiftc libSwiftLevelDB.so

@belkadan
Copy link

-Xswiftc is a hack to make up for not having build settings. You certainly shouldn't use it to control things like -emit-library or -o; it'll confuse the package manager.

@swift-ci
Copy link
Contributor Author

Comment by Amr Aboelela (JIRA)

Well I tried it and it works 🙂
What is the right solution then?

@belkadan
Copy link

You tried it and it builds. What are you actually trying to do?

(and, tagging in @aciidb0mb3r, who knows a lot more about the package manager and swift-build than I do.)

@ankitspd
Copy link
Member

@belkadan is right, -Xswiftc is a hack until we get build settings. The arguments are passed directly to all the packages in the graph. Do not rely on this to create things like libraries. See SE-0146 if you want to create a library product. It is implemented in trunk so you can grab a trunk toolchain from swift.org to try it out. (Also see SE-0158 for Swift 4 manifest syntax).

@swift-ci
Copy link
Contributor Author

Comment by Amr Aboelela (JIRA)

Ok, got it.

@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
This issue was closed.
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

3 participants