-
-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
I prefer having cli programs on my android device as well. So when I tried to install numbat-cli with termux on Android it failed.
How to replicate
git clone https://github.com/sharkdp/numbat.git
cd numbat
cargo buildThe error we get is
error[E0599]: no function or associated item named `show_with_default_app` found for struct `Plot` in the current scope
--> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/plotly-0.12.1/src/plot.rs:273:15
|
178 | pub struct Plot {
| --------------- function or associated item `show_with_default_app` not found for this struct
...
273 | Plot::show_with_default_app(temp_path);
| ^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `Plot`
|
note: if you're trying to build a new `Plot`, consider using `Plot::new` which returns `Plot`
--> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/plotly-0.12.1/src/plot.rs:190:5
|
190 | pub fn new() -> Plot {
| ^^^^^^^^^^^^^^^^^^^^
error[E0599]: no function or associated item named `show_with_default_app` found for struct `Plot` in the current scope
--> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/plotly-0.12.1/src/plot.rs:286:15
|
178 | pub struct Plot {
| --------------- function or associated item `show_with_default_app` not found for this struct
...
286 | Plot::show_with_default_app(path);
| ^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `Plot`
|
note: if you're trying to build a new `Plot`, consider using `Plot::new` which returns `Plot`
--> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/plotly-0.12.1/src/plot.rs:190:5
|
190 | pub fn new() -> Plot {
| ^^^^^^^^^^^^^^^^^^^^
error[E0599]: no function or associated item named `show_with_default_app` found for struct `Plot` in the current scope
--> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/plotly-0.12.1/src/plot.rs:315:15
|
178 | pub struct Plot {
| --------------- function or associated item `show_with_default_app` not found for this struct
...
315 | Plot::show_with_default_app(temp_path);
| ^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `Plot`
|
note: if you're trying to build a new `Plot`, consider using `Plot::new` which returns `Plot`
--> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/plotly-0.12.1/src/plot.rs:190:5
|
190 | pub fn new() -> Plot {
| ^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0599`.
error: could not compile `plotly` (lib) due to 3 previous errorsSolution
Looking around I found this particular issue on the plotly github.
There does not seem to be an update out at this point for plotly that fixes compilation on android. (Last release was 6 months ago)
So, the simple update would be to change numbat/Cargo.toml
# plotly = { version = "0.12.0", optional = true }
plotly = { git = "https://github.com/plotly/plotly.rs", branch = "main" , optional = true }This will fail with
error[E0599]: no method named `show` found for struct `Plot` in the current scope
--> numbat/src/ffi/plot.rs:93:10
|
93 | plot.show();
| ^^^^ method not found in `Plot`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `numbat` (lib) due to 1 previous errorCurrently, I just have a simple fix to add the plot.show() stub for android.
In numbat/src/ffi/plot.rs
fn show_plot(plot: Plot) -> CompactString {
#[cfg(target_os = "android")]
{
let _ = plot;
unimplemented!("cannot show_plot on android")
}
#[cfg(not(target_os = "android"))]
{
plot.show();
CompactString::const_new("Plot will be opened in the browser")
}
}If the author(s)/ maintainer(s) feel like this might be a useful thing to add, I can open a pull request against master.
Thank you for creating and working on numbat!
AudunVN and buzmakov
Metadata
Metadata
Assignees
Labels
No labels