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

Compiling external source with resulting executable #26

Open
szsoftware opened this issue Mar 5, 2021 · 2 comments
Open

Compiling external source with resulting executable #26

szsoftware opened this issue Mar 5, 2021 · 2 comments
Labels
type: question There's no such thing as a stupid one

Comments

@szsoftware
Copy link

Is it possible to compile an external rust source with that toolchain?
For instance tectonic typesetting and a resulting commandline programm instead of the jni lib mechanism.
If yes, do you have an example?

Many thanks in advance.

@francesca64 francesca64 added the type: question There's no such thing as a stupid one label Mar 5, 2021
@francesca64
Copy link
Contributor

Thanks for asking!

cargo-mobile ultimately compiles your Rust code using cargo build with a few target-specific options, so anything you'd normally do with cargo you can generally do here. So, to depend on crates, you'd just add them to your Cargo.toml like normal. Anything with more involved build steps via build.rs/etc. should "just work" as well.

However, if you're looking to create a command-line application, that's a different matter. The Android project we generate is setup to use NativeActivity, which definitely isn't what you'd want for a command-line app. I assume this is something you're trying to do in a rooted environment? If so, I imagine you could just build a fairly normal executable instead of needing an APK. cargo-mobile wouldn't really benefit you at all for that, since I'd assume you could easily just cargo build that directly.

@szsoftware
Copy link
Author

Hi there and thank you very much for your detailed explanation.

After some time of abstinence related to this issue I'm working again on it.

Meanwhile I'm on an updated path to reach my goal: getting tectonic typesetting running on android.
Actually I'm trying to use the tectonic crate/library directly without the need of doing it the shell/cli way as described here:

https://docs.rs/tectonic/latest/tectonic/

Thus, I have an updated question after some specific information about tectonic.
Tectonic has the approach to not necessarily having a full ~4GB texlive distribution installed.
Instead it downloads just these texlive parts, needed by the specific latex document.

In short: the cli binary, but also the crate/library "tectonic" need to download something.
When I hear "download" and overthink it the android way, immediately "context" and "activity" and "permissions" come to my mind.

As far as I remember, when trying out another path of reaching the above mentioned goal, utilizing termux/tectonic binary, also NPE's within ndk-glue code and related to NativeActivity where the end of my road.

That's the reason why I'm encouraged to dive deeper into your framework now and try the best I can with my limited knowledge.

This former time and also now, my limitation is, not having a working rust-android(studio)-debugging toolchain.

Do have any hint's, tips and thoughts on all of that?

Thank you very much in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question There's no such thing as a stupid one
Projects
None yet
Development

No branches or pull requests

2 participants