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

How compile for android #199

Open
mamcx opened this issue Dec 5, 2023 · 2 comments
Open

How compile for android #199

mamcx opened this issue Dec 5, 2023 · 2 comments

Comments

@mamcx
Copy link

mamcx commented Dec 5, 2023

This is a continuation from this issue

I have a repo here:

https://github.com/mamcx/RustStoreNix/tree/nixify

I must compile on macOS, Linux with targets windows, linux musl, android, ios. But my major problem is with android. I need:

def archTriplets = [
        'armeabi-v7a': 'armv7-linux-androideabi',
        'arm64-v8a'  : 'aarch64-linux-android',
]

I tried with:

❯ nix --version
nix (Nix) 2.18.1
{
  inputs.nixify.url = github:rvolosatovs/nixify;

  outputs = {nixify, ...}:
    nixify.lib.rust.mkFlake {
      src = ./.;
      name = "rust-workspace";

      build.workspace = true;
      clippy.workspace = true;
      test.workspace = true;
    };
}

And get :

❯ nix develop
warning: Git tree '/Users/mamcx/Proyectos/Apps' is dirty
(nix:nix-shell-env) bash-5.2$ cargo build
+ command cargo build
   Compiling ring v0.17.6
   Compiling zstd-sys v2.0.9+zstd.1.5.5
   Compiling generic-array v0.14.7
   Compiling globset v0.4.14
   Compiling rustix v0.38.26
   Compiling pin-project v1.1.3
   Compiling walkdir v2.4.0
   Compiling libsqlite3-sys v0.27.0
   Compiling tracing-subscriber v0.3.18
   Compiling thiserror v1.0.50
   Compiling phf_codegen v0.11.2
   Compiling phf v0.11.2
   Compiling parse-zoneinfo v0.3.0
error: linking with `cc` failed: exit status: 1
@rvolosatovs
Copy link
Owner

rvolosatovs commented Dec 13, 2023

Thank you for the report!
I've file a PR to your repo mamcx/RustStoreNix#1 with an example.

At this time it is assumed that Cargo.toml resides at src, but in your case there are two separate workspaces in the repository and no top-level Cargo.toml, which is not currently supported - I flipped it around and moved RustStore to top-level to work around that.

I also had to remove the custom .cargo target build config to use the correct linker/toolchain during the build

@mamcx
Copy link
Author

mamcx commented Dec 14, 2023

Thank you!

I have checked and it works. The modifications in your PR are acceptable to me.

A few questions:

  • Is likely that the support for the targets for Android armeabi-v7a, arm64-v8a could be made to work (on both linux/macOS M1)? What is the block for them?
  • How to take advantage of caching to reduce (re)build times (especially in CI)

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

No branches or pull requests

2 participants