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

Android cross-compile #5242

Closed
wants to merge 14 commits into from
Closed

Android cross-compile #5242

wants to merge 14 commits into from

Conversation

brson
Copy link
Contributor

@brson brson commented Mar 5, 2013

r? @graydon

This is the bulk of the makefile work necessary to support cross-compiling with multiple toolchains. With this we can cross-compile to Android, but not run the test suite on Android. There is still some polish yet to add, but I want to get this merged.

Key changes:

  • The build now thinks about three kinds of triples: the build triple, which is the architecture the rust build takes place on, the host triples, which are architectures for which the rust build produces rust compliers, and the target triples, which are architectures for which the produced compilers can compile code. The host triples contain the build triple, and the target triples are a superset of the host triples.
  • platform.mk produces distinct toolchain variables (CC, CXX, etc.) for each target triple, and in turn most of the makefiles are now parametrized over target triples.
  • configure requires --android-ndk-path when arm-unknown-android is a target triple

As an example, to cross-compile to android, you configure with ../configure --target-triples=arm-unknown-android --android-ndk-path=~/dev/android-standalone-ndk-14. In this case the build triple and the host triples are automatically inferred, and the build triple added to the target triples, so if you are running on x86_64-unknown-linux-gnu, build-triple=x86_64-unknown-linux-gnu, host-triples=x86_64-unknown-linux-gnu and target-triples=x86_64-unknown-linux-gnu,arm-unknown-android.

This also changes the libuv remote back to git://github.com/brson/libuv.git to accommodate android fixes.

Thanks to @yichoi who did most of this work.

Issue #4513.

@graydon
Copy link
Contributor

graydon commented Mar 6, 2013

wow, amazing! I'll try to review this tomorrow; a little too exhausted tonight

@brson
Copy link
Contributor Author

brson commented Mar 6, 2013

This will possibly require some tweaking to the bot configuration, particularly for snapshots. After this patch the --host-triples configure flag will be equivalent to the old --target-triples flag. For running tests it may still be sufficient to use --target-triples (will do a test today to see), but for snapshots, the workspace will need to be configured with multiple host triples. In fact, I better do some testing of the snap targets to make sure they still work.

@brson
Copy link
Contributor Author

brson commented Mar 6, 2013

@yichoi's branch and mine have diverged again so I'm going to spend some time today merging them

@brson
Copy link
Contributor Author

brson commented Mar 6, 2013

I'll reopen another one later.

@brson brson closed this Mar 6, 2013
bors added a commit that referenced this pull request Mar 7, 2013
bors added a commit to rust-lang-ci/rust that referenced this pull request May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants