emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
1k stars 95 forks source link

failed to resolve: use of undeclared crate or module `imp` #270

Closed leap0x7b closed 2 years ago

leap0x7b commented 2 years ago
Compiling minifb v0.20.0
   Compiling raw-window-handle v0.3.4
   Compiling x11-dl v2.19.1
   Compiling quote v1.0.14
   Compiling bindgen v0.56.0
   Compiling libunicorn-sys v0.9.1
   Compiling unicorn v0.9.1
   Compiling xkbcommon-sys v0.7.5
   Compiling xkb v0.2.1
error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.20.0/src/lib.rs:124:19
    |
124 | pub struct Window(imp::Window);
    |                   ^^^ use of undeclared crate or module `imp`

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.20.0/src/lib.rs:844:17
    |
844 | pub struct Menu(imp::Menu);
    |                 ^^^ use of undeclared crate or module `imp`

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.20.0/src/lib.rs:855:9                                                              |
855 |         imp::Menu::new(name).map(Menu)                                                |         ^^^ use of undeclared crate or module `imp`

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.20.0/src/lib.rs:231:14                                                             |                                                                                   231 |         imp::Window::new(name, width, height, opts).map(Window)                       |              ^^^^^^ not found in `imp`                                                |                                                                                   help: consider importing this type alias                                                    |
8   | use x11_dl::xlib::Window;                                                             |                                                                                                                                                                           error[E0599]: no method named `get_posix_menus` found for reference `&Window` in the current scope                                                                                 --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.20.0/src/lib.rs:767:14
    |                                                                                   767 |         self.get_posix_menus()
    |              ^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `get_unix_menus`

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `minifb` due to 5 previous errors                              warning: build failed, waiting for other jobs to finish...                              error: build failed
emoon commented 2 years ago

Which platform/os?

leap0x7b commented 2 years ago

Termux

leap0x7b commented 2 years ago

I can use X11 if I install x11-repo package

emoon commented 2 years ago

I guess the problem is that this code

https://github.com/emoon/rust_minifb/blob/master/src/lib.rs#L108-L114

and target_os will be set to something else than expected, I'm not sure what it will report on your OS, but if you can clone the code and add termux (or what target_os will report) as an extra line above and see if that works, if it works I can add the code in main repo and release a new version.

leap0x7b commented 2 years ago

Termux is Android

emoon commented 2 years ago

Notice that the readme states

Currently macOS, Linux and Windows (64-bit and 32-bit) are the current supported platforms. X11 (Linux/FreeBSD/etc) support has been tested on Ubuntu (x64). Linux Wayland support is also available.

So Android is untested. If you want to give a go and trying to fix it and do a PR that would be great, but for now it's unsupported.