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

Add full android test support #82

Closed
malbarbo opened this issue Mar 21, 2017 · 5 comments
Closed

Add full android test support #82

malbarbo opened this issue Mar 21, 2017 · 5 comments
Labels
enhancement pending-close Issue will be closed if no further comments

Comments

@malbarbo
Copy link
Contributor

malbarbo commented Mar 21, 2017

Should https://github.com/snipsco/dinghy be used?

Support for testing android binaries that depends only on libc was added in #132.

We should add support to test android binaries in the android emulator. See #132 for a brief discussion of the issues of distributing the android emulator.

@japaric
Copy link
Contributor

japaric commented May 15, 2017

If it can provide a transparent testing experience like the other cross test targets, sure!

@jan-hudec
Copy link

Since rust-lang/cargo#3954 it is possible to run the generated binaries through a wrapper. So there could be a wrapper that would start the emulator (which can be done; here are Travis' instructions) and then run the tests there.

japaric pushed a commit that referenced this issue Oct 20, 2017
Add limited android test support

We could provide android test support by launching an android emulator and running tests in the emulator (like how it is done in libc and rust), but there is licenses issues in redistributing the sdk (see 3.4 of https://developer.android.com/studio/terms.html). Off course, I maybe be wrong about this.

So we download and build bionic libc from source, which I think allows we to distribute the binaries. Having the android libc allows running native binaries using qemu, which can be enough for projects like, nix, ripgrep, etc.

Related #82
@jamesmunns
Copy link
Contributor

@malbarbo is this okay to close since #132 has landed?

@jamesmunns jamesmunns added enhancement pending-close Issue will be closed if no further comments labels Mar 17, 2018
@malbarbo malbarbo changed the title Add android test support Add full android test support Mar 20, 2018
@malbarbo
Copy link
Contributor Author

@jamesmunns I updated the issue to make clear what is missing.

Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue May 25, 2022
Android binaries currently fail to run, because `libc++_shared.so` is
not found, so ensure the library is preloaded via `LD_PRELOAD`. This
creates a simple `android-runner` file, so any additional changes can be
added there.

Linked Issues: cross-rs#82
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue May 27, 2022
Android binaries currently fail to run, because `libc++_shared.so` is
not found, so ensure the library is preloaded via `LD_PRELOAD`. This
creates a simple `android-runner` file, so any additional changes can be
added there.

Linked Issues: cross-rs#82
bors bot added a commit that referenced this issue May 28, 2022
720: Add android runner to run android binaries. r=Emilgardis a=Alexhuszagh

Android binaries currently fail to run linking against certain dependencies, because `libc++_shared.so` is not found, so ensure the library is preloaded via `LD_PRELOAD`. This creates a simple `android-runner` file, so any additional changes can be added there.

This merely links to the proper `libc++_shared.so`, so it doesn't fix other issues. The [hello world project](https://github.com/cross-rs/rust-cpp-hello-word) now compiles and runs on `aarch64-linux-android`, but not `i686-linux-android`, which seems to be entirely unrelated (likely a permission error on the cloud Fedora server I'm running).

```text
error getting old personality value: Operation not permitted
libc: error getting old personality value: Operation not permitted
Aborted (core dumped)
```

Linked Issues: #82

Co-authored-by: Alex Huszagh <[email protected]>
@Alexhuszagh
Copy link
Contributor

This would require a full-system Android emulator, which I believe is beyond the scope of cross itself. The best way to test the binaries would be any of the many Android emulators, which also require a full Android image, including Android Studio, BlueStacks, or the open-source anbox. Anbox supports Snap installs, and so should be compatible with our images. If anyone wants to document this on the wiki, that would be appreciated, but it is assumed most developers targeting Android already have these tools available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement pending-close Issue will be closed if no further comments
Projects
None yet
Development

No branches or pull requests

5 participants