Comments (8)
Oh, I see, I know the reasons.
To explain this, I would like to first introduce that rust allows multiple toolchains to exist in the system. and this can be checked with rustup show
:
/usr/src/proot-rs # rustup show
Default host: x86_64-unknown-linux-musl
rustup home: /root/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-musl (default)
nightly-2021-03-24-x86_64-unknown-linux-musl
active toolchain
----------------
nightly-2021-03-24-x86_64-unknown-linux-musl (overridden by '/usr/src/proot-rs/rust-toolchain')
rustc 1.53.0-nightly (673d0db5e 2021-03-23)
By default the toolchain to be used is the stable version. But if there is a file named rust-toolchain
in the current directory, it will be overridden to use the specified toolchain version. In our project, it's version is nightly-2021-03-24
.
Here is a part of the Dockerfile:
RUN rustup-init -y && \
rustup toolchain install stable && \
rustup target add arm-linux-androideabi && \
cargo +stable install --force cargo-make
WORKDIR /usr/src/proot-rs
COPY . /usr/src/proot-rs
CMD ["cargo", "make", "build"]
Here, the line
rustup target add arm-linux-androideabi
comes before
COPY . /usr/src/proot-rs
This means that we are installing a new target arm-linux-androideabi
for the default toolchain (stable version).
But our project is actually using the nightly-2021-03-24
toolchain, for which we have not yet installed the target arm-linux-androideabi
.
from proot-rs.
I have added a patch ffdec87
from proot-rs.
See also: #48 (comment)
from proot-rs.
Depends on #51
docker-compose run proot-rs-sdk rustup target add arm-unknown-linux-musleabi
docker-compose run proot-rs-sdk cargo build --target=arm-unknown-linux-musleabi
info: syncing channel updates for 'nightly-2021-03-24-x86_64-unknown-linux-musl'
info: latest update on 2021-03-24, rust version 1.53.0-nightly (673d0db5e 2021-03-23)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
info: installing component 'rust-std'
info: installing component 'rustc'
Updating crates.io index
Updating git repository `https://github.com/vincenthage/gcc-rs`
Downloaded sc v0.2.3
Downloaded env_logger v0.8.3
Downloaded vec_map v0.8.2
Downloaded termcolor v1.1.2
Downloaded textwrap v0.11.0
Downloaded strsim v0.8.0
Downloaded unicode-width v0.1.8
Downloaded memchr v2.3.4
Downloaded humantime v2.1.0
Downloaded lazy_static v1.4.0
Downloaded cfg-if v1.0.0
Downloaded libc v0.2.90
Downloaded regex-syntax v0.6.23
Downloaded clap v2.33.3
Downloaded atty v0.2.14
Downloaded aho-corasick v0.7.15
Downloaded byteorder v1.4.3
Downloaded bitflags v1.2.1
Downloaded log v0.4.14
Downloaded ansi_term v0.11.0
Downloaded nix v0.20.0
Downloaded regex v1.4.5
Downloaded 22 crates (1.9 MB) in 0.69s
Compiling cfg-if v1.0.0
Compiling regex-syntax v0.6.23
Compiling unicode-width v0.1.8
Compiling humantime v2.1.0
Compiling ansi_term v0.11.0
Compiling termcolor v1.1.2
Compiling strsim v0.8.0
Compiling vec_map v0.8.2
error[E0463]: can't find crate for `core`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `core`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `std`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `std`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `std`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `std`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `std`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error[E0463]: can't find crate for `std`
|
= note: the `arm-unknown-linux-musleabi` target may not be installed
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: build failed
from proot-rs.
Now we should be able to compile directly to the arm-linux-androideabi
target.
Since we have already specified the linker name in .cargo/config.toml
:
[target.arm-linux-androideabi]
linker = "armv7a-linux-androideabi21-clang"
[target.aarch64-linux-android]
linker = "aarch64-linux-android21-clang"
Just add <path-to-ndk-dir>/toolchains/llvm/prebuilt/linux-x86_64/bin/
into PATH
, before you start compiling.
Then, install new rust target:
rustup target add arm-linux-androideabi
Start building with:
CARGO_BUILD_TARGET=arm-linux-androideabi cargo make build
It should work
from proot-rs.
Maybe you can verify why this is happening, but I ran into this issue:
docker-compose run proot-rs-sdk /bin/sh
/usr/src/proot-rs # CARGO_BUILD_TARGET=arm-linux-androideabi cargo make build
info: syncing channel updates for 'nightly-2021-03-24-x86_64-unknown-linux-musl'
info: latest update on 2021-03-24, rust version 1.53.0-nightly (673d0db5e 2021-03-23)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
[cargo-make] INFO - cargo make 0.35.0
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: build
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Running Task: build-loader
Downloaded rlibc v1.0.0
Downloaded 1 crate (7.0 KB) in 0.20s
Compiling rlibc v1.0.0
Compiling sc v0.2.4 (https://github.com/KB5201314/syscall.rs.git?rev=cf49872#cf498721)
error[E0463]: can't find crate for `core`
|
= note: the `arm-linux-androideabi` target may not be installed
error[E0463]: can't find crate for `core`
|
= note: the `arm-linux-androideabi` target may not be installed
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: could not compile `rlibc`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.
The weird part is that I re-ran this command:
rustup target add arm-linux-androideabi
info: downloading component 'rust-std' for 'arm-linux-androideabi'
info: installing component 'rust-std' for 'arm-linux-androideabi'
info: using up to 500.0 MiB of RAM to unpack components
And then it successfully built for me:
CARGO_BUILD_TARGET=arm-linux-androideabi cargo make build
[cargo-make] INFO - cargo make 0.35.0
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: build
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Running Task: build-loader
Compiling sc v0.2.4 (https://github.com/KB5201314/syscall.rs.git?rev=cf49872#cf498721)
Compiling rlibc v1.0.0
Compiling loader-shim v0.1.0 (/usr/src/proot-rs/loader-shim)
Finished dev [unoptimized + debuginfo] target(s) in 0.84s
[cargo-make] INFO - Running Task: copy-loader
[cargo-make] INFO - Running Task: build
Compiling libc v0.2.90
Compiling memchr v2.3.4
Compiling bitflags v1.2.1
Compiling log v0.4.14
Compiling cfg-if v1.0.0
Compiling unicode-width v0.1.8
Compiling regex-syntax v0.6.23
Compiling vec_map v0.8.2
Compiling sc v0.2.4 (https://github.com/KB5201314/syscall.rs.git?rev=cf49872#cf498721)
Compiling strsim v0.8.0
Compiling ansi_term v0.11.0
Compiling humantime v2.1.0
Compiling termcolor v1.1.2
Compiling byteorder v1.4.3
Compiling lazy_static v1.4.0
Compiling textwrap v0.11.0
Compiling loader-shim v0.1.0 (/usr/src/proot-rs/loader-shim)
Compiling aho-corasick v0.7.15
Compiling regex v1.4.5
Compiling atty v0.2.14
Compiling nix v0.20.0
Compiling clap v2.33.3
Compiling env_logger v0.8.3
Compiling proot-rs v0.1.0 (/usr/src/proot-rs/proot-rs)
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> proot-rs/src/main.rs:3:12
|
3 | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete
warning: unused import: `crate::errors::*`
--> proot-rs/src/kernel/standard/uname.rs:1:5
|
1 | use crate::errors::*;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: associated function is never used: `set_glue_type`
--> proot-rs/src/filesystem/fs.rs:200:12
|
200 | pub fn set_glue_type(&mut self, mode: Mode) {
| ^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: constant is never used: `ET_REL`
--> proot-rs/src/kernel/execve/binfmt/elf.rs:14:1
|
14 | const ET_REL: u16 = 1;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: constant is never used: `ET_CORE`
--> proot-rs/src/kernel/execve/binfmt/elf.rs:17:1
|
17 | const ET_CORE: u16 = 4;
| ^^^^^^^^^^^^^^^^^^^^^^^
warning: constant is never used: `PT_DYNAMIC`
--> proot-rs/src/kernel/execve/binfmt/elf.rs:19:1
|
19 | pub const PT_DYNAMIC: u32 = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: struct is never constructed: `DynamicEntry`
--> proot-rs/src/kernel/execve/binfmt/elf.rs:28:12
|
28 | pub struct DynamicEntry<TSigned, TUnsigned> {
| ^^^^^^^^^^^^
warning: enum is never used: `DynamicType`
--> proot-rs/src/kernel/execve/binfmt/elf.rs:33:10
|
33 | pub enum DynamicType {
| ^^^^^^^^^^^
warning: 8 warnings emitted
Finished dev [unoptimized + debuginfo] target(s) in 9.14s
proot-rs: /usr/src/proot-rs/target/arm-linux-androideabi/debug/proot-rs
loader-shim: /usr/src/proot-rs/target/arm-linux-androideabi/debug/loader-shim
[cargo-make] INFO - Build Done in 10.18 seconds.
from proot-rs.
I don't see any problem with this.
On your first build, the error message reported is:
error[E0463]: can't find crate for `core`
|
= note: the `arm-linux-androideabi` target may not be installed
error[E0463]: can't find crate for `core`
|
= note: the `arm-linux-androideabi` target may not be installed
This means that you may not have the arm-linux-androideabi
target installed. By running "rustup target add arm-linux-androideabi", it is installed in your environment. So when you build again it will succeed
from proot-rs.
I don't see any problem with this.
On your first build, the error message reported is:
error[E0463]: can't find crate for `core` | = note: the `arm-linux-androideabi` ta需要rget may not be installed error[E0463]: can't find crate for `core` | = note: the `arm-linux-androideabi` target may not be installed
This means that you may not have the
arm-linux-androideabi
target installed. By running "rustup target add arm-linux-androideabi", it is installed in your environment. So when you build again it will succeed
But the Dockerfile already added it? So I basically need to do it twice.
from proot-rs.
Related Issues (20)
- Integration tests HOT 3
- Add support for Android platform and other architectures (e.g. arm, aarch64) HOT 9
- Rewrite loader in rust
- Failed to execute statically linked binaries HOT 2
- Binding a file to dir/file will result in a ENOTDIR: Not a directory HOT 2
- Trailing slash is removed by proot-rs HOT 2
- A call to unshare(CLONE_FS) from tracee may break the emulation of cwd. HOT 1
- Processing the result of getdents64()
- thread 'main' panicked at 'get stopped tracee' HOT 2
- Document Usage in README.md file
- Publish static binaries for each GitHub Release HOT 10
- According to the proot manual, the --bind option should support the ! character to avoid dereference the guest location.
- docker-compose error: want driver overlay2, got devicemapper
- proot-rs --version doesn't show the version number HOT 1
- Generate a changelog
- Cannot run Debian in Termux HOT 1
- Generate man page
- Integrate SonarCloud
- Unable to run the ./proot-rs application in termux HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proot-rs.