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-5851] swift build can't change -target #4950

Closed
swift-ci opened this issue Sep 7, 2017 · 2 comments
Closed

[SR-5851] swift build can't change -target #4950

swift-ci opened this issue Sep 7, 2017 · 2 comments
Labels

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Sep 7, 2017

Previous ID SR-5851
Radar None
Original Reporter amraboelela (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug, Android
Assignee None
Priority Medium

md5: 23131aeb74f96876f67ef8cdeb924856

cloned from:

  • SR-4710 swift build -Xswiftc has to be repeated

duplicates:

Issue Description:

I am trying to change the target to be armv7, so I tried

$ swift build -v -Xswiftc -target -Xswiftc armv7-none-linux-androideabi

And I got:

/home/amr/swift/toolchains/swift-toolchain/usr/bin/swiftc ... -target x86_64-unknown-linux -target armv7-none-linux-androideabi

So it is still using the default target 86_64, while I was expecting to replace the default target with the one I am trying to set which is amrv7

@ankitspd
Copy link
Member

ankitspd commented Sep 7, 2017

We don't have build settings support right now so this is kind of expected. But I think the cross compilation support may help in compiling for Android. This has an example on how to create and use a cross compilation toolchain: https://github.com/apple/swift-package-manager/blob/master/Utilities/build_ubuntu_cross_compilation_toolchain

@swift-ci
Copy link
Contributor Author

swift-ci commented Sep 7, 2017

Comment by Amr Aboelela (JIRA)

In UserToolchain.swift:

self.extraSwiftCFlags = [

        "-target", destination.target,

        "-sdk", destination.sdk.asString

    \] + destination.extraSwiftCFlags

And in build_ubuntu_cross_compilation_toolchain:

swift build --destination /tmp/cross-toolchain/ubuntu-xenial-destination.json

...

cat > "$cross_tc_basename/ubuntu-xenial-destination.json" <<EOF

{

...

"target": "linux-unknown-x86_64",

...

}

So the answer of my question seems to create a destination file, e.g. android.json, fill it with target armv7-none-linux-androideabi then run swift build --destination android.json

@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

2 participants