-
Notifications
You must be signed in to change notification settings - Fork 26
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 installation instructions #9
Comments
Do you mean to make a script which:
What does these steps mean:
|
Sorry! Was writing the instructions for myself. Please also feel free to mark where the below needs to be moved in the documentation 4 Android targets
These need to be installed as targets for Rust: 2/3 targets for testing In This runs a simulated Android runtime under the JVM. The problem with this is that the Rust libraries are built for Android, not for your native PC OS. To fix this, we have So we need rust targets for these macOS To my knowledge, a rust target cannot legally be cross-compiled for macOS unless on a macOS computer, as it requires the Apple SDK, which is protected by a license: https://www.apple.com/legal/sla/docs/xcode.pdf We're fine with this on GitHub, as we can use macOS on our CI to generate a full build. So, a warning/mention that you'd only be cross-compiling Windows/Linux targets on Windows/Linux machines - a "release-quality .jar" for the .jar wouldn't be possible (as it'd be missing the Nightly for testing
https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#out-dir C compiler I believe this is Microsoft C++ Build Tools: https://users.rust-lang.org/t/why-do-i-need-microsoft-c-build-tools/18581/2 on Windows. Needed for the linker. Note: WSL should be the preferred environment for anything on Windows at this point |
So we want a script to do all the checks and possibly to install things that can be installed like targets, rust itself, etc. And to write a dev doc with the exact steps that should be considered, so the environment is ready. And if WSL will be used, so bash script would be a universal script that doesn't need any dependency |
Yep - sounds good to me! Feel free to take the design in any way that you feel is best - I have a few scripts which may be useful as reference: /~https://github.com/david-allison-1/Anki-Android-Backend/tree/rust-wip/.github/scripts |
Thank you will work on that, and keep you updated. |
It might be useful to mention that for people experimenting with macOS that is possible to virtualize it /~https://github.com/kholia/OSX-KVM - the license considerations are the same but it is (for instance) possible to run linux on mac hardware so it's fine to mention. You can even run OSX in Docker nowadays /~https://github.com/sickcodes/Docker-OSX
Yes yes yes |
This is nice, there is a rust project named cross, which aims to make cross compilation easier using dockers. And also if we run on the CI on macOS we can compile for the 3 platforms at once without docker. I have manged to compile for windows from macOS |
CI was already set up for this: /~https://github.com/david-allison-1/Anki-Android-Backend/actions/runs/556385657 and does exactly that. Note: I'll need to look into the CI failures - GitHub Actions changed. Shouldn't be too hard. AFAIK, I had a full build working with /~https://github.com/tpoechtrager/osxcross on Windows (WSL), but ran across: /~https://github.com/tpoechtrager/osxcross#packaging-the-sdk |
Yes I didn't find it, but thought it could be extended with custom platform-docker image |
I think we will also need to add all PC target nightly tool chains. I had issues with
And for macOS I had to install this
Linker for Linux, do you have an idea how to solve the linker issue?
|
The environment of this project is so hard to set up Yesterday I faced the issue of being unable to install I couldn't run grade from the command line so changed this line in
And still figuring out the rest of the issues |
This isn't going to be an easy one to solve at all. There's a lot of moving parts. One of the main intentions of having this in I /really/ appreciate the help with this, feel free to PR any incremental work/commits, as it will save a lot of hassle for others. |
Currently, the pain points of setting the environment is not the rust or NDK, but it is the I was thinking if it's okay to utilize As they say it's
And I think we really need that 😄 And I think we can integrate https://hub.docker.com/r/sickcodes/docker-osx to work with corss via a custom docker setup. I didn't look into the details, but I think it's doable. The only bad part about it is the image is about 20 GB, so if we get to enable it, we should make a flag on I will leave the protobuf issue for now. Will tackle it after I get the cross compilation sorted |
Food for thought, in other projects where I have a lot of environment difficulty, I maintain a 'doctor' script that examines the environment for expected versions of all toolchain items, and knows how to install them or upgrade them in order to confirm that the environment is ready to go at the end I think maintaining a Docker image may be useful but that implies that development will be done in the Docker image yes? Will that be high performance enough? I think it might be so this could be a good direction At that point the doctor.sh script I'm attaching - as an idea - would be implemented instead as a Dockerfile right? Or a set of Dockerfiles if needed (unix, mac, windows) if possible. |
I wanted to do this at first, build a doctor utility script in bash or in gradle, but I found out that instillation of some components will be cumbersome and will be different from user to user even if they have same os. And the only part that we need docker(cross package) for is the I don't know if it will affect the performance drastically as it is only for Using cross we wouldn't need to maintain any Dockerfiles. Maybe we would need it for the osx one, but we will leave that as the last thing we think about. We might still need doctor script to check NDK, Rust, Java, Docker, etc and those are very straight forward to install on any system |
I don't know why cross giving me this error about linker not found. Cross did work on my toy projects just fine with no extra setup. Error
Edit: FIXEDOh, I forgot about the symbolic link trick. Using a custom docker and making the link seems to make it work.
But the issue with |
The above error about the linker does only happen when compiling rsdriod-bridge In rslib it does fetch and compile all packages under cross docker (win/linux) but it gives me this error. When I do compile it natively it does work. BTW I moved
Error compiling rslib under cross
Edit: Another error output with more detailsit seems to be diffrent one. output with more details
|
This implies that Creating The issues are going to be associated with the files: |
I checked from within docker and the the issue on
But I wrote some debug code before the faling code in build.rs to see if cross for example missed something up. But all files were there and noting was missing println!("{:?}",Path::new("src/backend_proto.rs").canonicalize()?);
let pwd_out = Command::new("pwd").output().unwrap();
println!("pwd status: {}", pwd_out.status);
println!("stdout: {}", String::from_utf8_lossy(&pwd_out.stdout));
println!("stderr: {}", String::from_utf8_lossy(&pwd_out.stderr));
for entry in WalkDir::new("./src") {
println!("DD {}", entry?.path().display());
}
Edit: I think the not found is referring to
|
The issue was because I think cross didn't include cargo bin in docker. and the 2 After I removed the lines for formating. Cross worked with no issue for both Linux and windows. I tried using |
🎆 🎉
|
I have added steps to get the environment ready. Please let me know if we need to change anything. |
Looks great! Will need to get a VM out and test that I can do this.
|
Edit: adding this line to the IDE config should fix this issue, but I don't know if AnkiDroid devs will also have to edit this value or not.
|
It's in
|
The 2.1.55 desktop release switched away from Bazel to a new build system, which required some changes to this repo. Making the changes was a bit complicated due to the complexity of the current build system, and I ended up shaving some yaks to make things simpler while I was working on the changes. Changes: - Building for the current architecture instead of all architectures is now the default, so getting started is easier, and a build in Android Studio no longer requires special flags. - The build-current.sh script has been split into build-aar and build-robo for the Android and Robolectric parts, and can be used for both single-arch and multi-arch builds. - On arm64 Macs, the build scripts now create arm binaries - In a multi-arch build, both x86 and arm64 Mac libs are built, and they're merged into a single library. This can be done in CI, so there is no manual step required for M1 machines anymore. - The build now uses protobuf and python binaries/libs that the desktop build downloads, so they don't need to be installed separately. - The pinned Rust version and Rust targets are automatically installed as required. - The per-platform CI builds now build in debug mode and are faster. - Updated the docs to explain how the NDK can be installed via Android Studio, instead of via separate command-line tools. - The cross/docker stuff has been stripped out, as it's of limited use as it can't target macOS legally. Easier to use GH actions for the multi-arch builds, and keep things simple for local development. - Fix lint not being run in CI; caught an API 23 reference. Bumps ankidroid#179 (builds on M1 already work, so this may be simpler than expected?) Bumps ankidroid#174 (a bunch of the doctor stuff is obsolete; updated HOWTO.md and GH actions should be consulted) Bumps ankidroid#27 (I recommend closing this; single-platform is the default for local builds, and CI runners don't have any extra compute available) Tentatively closes ankidroid#109 (didn't see the flake when I was updating the actions) Closes ankidroid#235 (translation submodules now automatically synced with anki submodule) Closes ankidroid#213 (path based on script now) Closes ankidroid#211 (builds for Arm Mac on Arm Macs) Closes ankidroid#197 (single arch is the default) Closes ankidroid#196 (desktop venv is used) Closes ankidroid#195 (can be done via the GUI, and does not require separate cli download) Closes ankidroid#168 (latest Rust; easier changing via rust-toolchain.toml) Closes ankidroid#164 (universal dylib) Closes ankidroid#127 (no docker) Closes ankidroid#106 (most of those scripts obsolete; some commands moved into build scripts) Closes ankidroid#99 (no docker) Closes ankidroid#98 (no docker) Closes ankidroid#97 (submodule automatically updated) Closes ankidroid#96 (build will fail if commit unavailable) Closes ankidroid#53 (no docker) Closes ankidroid#40 (DEBUG=1 option documented) Closes ankidroid#9 (simpler OOTB experience, and updated docs)
The 2.1.55 desktop release switched away from Bazel to a new build system, which required some changes to this repo. Making the changes was a bit complicated due to the complexity of the current build system, and I ended up shaving some yaks to make things simpler while I was working on the changes. Changes: - Building for the current architecture instead of all architectures is now the default, so getting started is easier, and a build in Android Studio no longer requires special flags. - The build-current.sh script has been split into build-aar and build-robo for the Android and Robolectric parts, and can be used for both single-arch and multi-arch builds. - On arm64 Macs, the build scripts now create arm binaries - In a multi-arch build, both x86 and arm64 Mac libs are built, and they're merged into a single library. This can be done in CI, so there is no manual step required for M1 machines anymore. - The build now uses protobuf and python binaries/libs that the desktop build downloads, so they don't need to be installed separately. - The pinned Rust version and Rust targets are automatically installed as required. - The per-platform CI builds now build in debug mode and are faster. - Updated the docs to explain how the NDK can be installed via Android Studio, instead of via separate command-line tools. - The cross/docker stuff has been stripped out, as it's of limited use as it can't target macOS legally. Easier to use GH actions for the multi-arch builds, and keep things simple for local development. - Fix lint not being run in CI; caught an API 23 reference. Bumps ankidroid#179 (builds on M1 already work, so this may be simpler than expected?) Bumps ankidroid#174 (a bunch of the doctor stuff is obsolete; updated HOWTO.md and GH actions should be consulted) Bumps ankidroid#27 (I recommend closing this; single-platform is the default for local builds, and CI runners don't have any extra compute available) Tentatively closes ankidroid#109 (didn't see the flake when I was updating the actions) Closes ankidroid#235 (translation submodules now automatically synced with anki submodule) Closes ankidroid#213 (path based on script now) Closes ankidroid#211 (builds for Arm Mac on Arm Macs) Closes ankidroid#197 (single arch is the default) Closes ankidroid#196 (desktop venv is used) Closes ankidroid#195 (can be done via the GUI, and does not require separate cli download) Closes ankidroid#168 (latest Rust; easier changing via rust-toolchain.toml) Closes ankidroid#164 (universal dylib) Closes ankidroid#127 (no docker) Closes ankidroid#106 (most of those scripts obsolete; some commands moved into build scripts) Closes ankidroid#99 (no docker) Closes ankidroid#98 (no docker) Closes ankidroid#97 (submodule automatically updated) Closes ankidroid#96 (build will fail if commit unavailable) Closes ankidroid#53 (no docker) Closes ankidroid#40 (DEBUG=1 option documented) Closes ankidroid#9 (simpler OOTB experience, and updated docs)
The 2.1.55 desktop release switched away from Bazel to a new build system, which required some changes to this repo. Making the changes was a bit complicated due to the complexity of the current build system, and I ended up shaving some yaks to make things simpler while I was working on the changes. Changes: - Building for the current architecture instead of all architectures is now the default, so getting started is easier, and a build in Android Studio no longer requires special flags. - The build-current.sh script has been split into build-aar and build-robo for the Android and Robolectric parts, and can be used for both single-arch and multi-arch builds. - On arm64 Macs, the build scripts now create arm binaries - In a multi-arch build, both x86 and arm64 Mac libs are built, and they're merged into a single library. This can be done in CI, so there is no manual step required for M1 machines anymore. - The build now uses protobuf and python binaries/libs that the desktop build downloads, so they don't need to be installed separately. - The pinned Rust version and Rust targets are automatically installed as required. - The per-platform CI builds now build in debug mode and are faster. - Updated the docs to explain how the NDK can be installed via Android Studio, instead of via separate command-line tools. - The cross/docker stuff has been stripped out, as it's of limited use as it can't target macOS legally. Easier to use GH actions for the multi-arch builds, and keep things simple for local development. - Fix lint not being run in CI; caught an API 23 reference. Bumps ankidroid#179 (builds on M1 already work, so this may be simpler than expected?) Bumps ankidroid#174 (a bunch of the doctor stuff is obsolete; updated HOWTO.md and GH actions should be consulted) Bumps ankidroid#27 (I recommend closing this; single-platform is the default for local builds, and CI runners don't have any extra compute available) Tentatively closes ankidroid#109 (didn't see the flake when I was updating the actions) Closes ankidroid#235 (translation submodules now automatically synced with anki submodule) Closes ankidroid#213 (path based on script now) Closes ankidroid#211 (builds for Arm Mac on Arm Macs) Closes ankidroid#197 (single arch is the default) Closes ankidroid#196 (desktop venv is used) Closes ankidroid#195 (can be done via the GUI, and does not require separate cli download) Closes ankidroid#168 (latest Rust; easier changing via rust-toolchain.toml) Closes ankidroid#164 (universal dylib) Closes ankidroid#127 (no docker) Closes ankidroid#106 (most of those scripts obsolete; some commands moved into build scripts) Closes ankidroid#99 (no docker) Closes ankidroid#98 (no docker) Closes ankidroid#97 (submodule automatically updated) Closes ankidroid#96 (build will fail if commit unavailable) Closes ankidroid#53 (no docker) Closes ankidroid#40 (DEBUG=1 option documented) Closes ankidroid#9 (simpler OOTB experience, and updated docs)
Consider a
doctor.sh
scriptThe text was updated successfully, but these errors were encountered: