Skip to content

How do you build this for Android ("Tier 2 without Host Tools") #1450

Closed
@LagradOst

Description

@LagradOst

7 mo ago I tried to build this project for android and being successfully able to compile rust project on android, however I was unable to link it (missing libc.so.6 ect) and JIT PTE was not implemented. Now I tested https://github.com/bytecodealliance/cranelift-jit-demo and it worked on an android device, and now I want to port the entirety of the compiler to android using JIT to run the code.

I use https://github.com/cross-rs/cross to "cross build --target aarch64-linux-android --release" this project and add to the toml

rustc_middle = { path = "../rustc_middle" }
rustc_ast = { path = "../rustc_ast" }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_hir = { path = "../rustc_hir" }
rustc_incremental = { path = "../rustc_incremental" }
rustc_index = { path = "../rustc_index" }
rustc_interface = { path = "../rustc_interface" }
rustc_span = { path = "../rustc_span" }
rustc_metadata = { path = "../rustc_metadata" }
rustc_session = { path = "../rustc_session" }
rustc_target = { path = "../rustc_target" }
rustc_driver = { path = "../rustc_driver" }

and

[env] 
CFG_RELEASE="1.77.0-nightly"
CFG_RELEASE_CHANNEL="nightly" # https://github.com/rust-lang/rust/blob/fabf9298633ca64450fa2af535252dc44a3b1080/src/bootstrap/tool.rs#L179
RUSTC_INSTALL_BINDIR = "C:\\Users\\v\\.cargo\\bin"
CFG_COMPILER_HOST_TRIPLE = "aarch64-linux-android"
REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
CFG_VERSION="1.77.0-nightly (62d7ed4a6 2024-01-11)"
CFG_RELEASE_NUM = "1.77.0"
DOC_RUST_LANG_ORG_CHANNEL="nightly" 
CFG_VER_DATE="2024-01-11"
CFG_SHORT_COMMIT_HASH = "62d7ed4a6"
CFG_COMMIT_HASH = "62d7ed4a6775c4490e493093ca98ef7c215b835b"

And this works fine for building the librustc_driver.so and librustc_codegen_cranelift.so, however it cant compile without a sysroot.

How can I compile the sysroot (to target android) to be able to compile it?
Screenshot_20240113_171757_com example teest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions