fschutt/azul

how to run a helloworld example on window10 ?

lable-bit opened this issue · 9 comments

branch wip
window10

cargo install --path azul-dll

Finished release [optimized] target(s) in 5m 07s
Replacing E:\rust\cargo\bin\azul-dll.exe
Replaced package azul-dll v0.0.1 (E:\rust\azul\azul-dll) with azul-dll v0.0.1 (E:\rust\azul\azul-dll) (executable azul-dll.exe)

cargo run --release --example hello_world

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: E:\rust\azul\azul\Cargo.toml
workspace: E:\rust\azul\Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: E:\rust\azul\azul-dll\Cargo.toml
workspace: E:\rust\azul\Cargo.toml
Compiling libloading-mini v0.1.1
Compiling azul v0.0.1 (E:\rust\azul\azul)
error: couldn't read E:\rust\cargo/lib/azul-dll-0.0.1: 拒绝访问。 (os error 5)
--> azul\src/rust\dll.rs:6182:30
|
6182 | const LIB_BYTES: &[u8] = include_bytes!(concat!(env!("CARGO_HOME"), "/lib/", "azul-dll-", env!("CARGO_PKG_VERSION", "/target/release/azul.dll"))); /* !!! IF THIS LINE SHOWS AN ERROR, IT MEANS YOU FORGOT TO RUN "cargo install --version 0.1.0 azul-dll" */
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: could not compile azul.

To learn more, run the command again with --verbose.

What is the contents of the E:\rust\cargo\lib\azul-dll-0.1.0\target\release directory? Is there an azul.dll file in there?

Also, the hello_world example isn't yet updated for the new API, the only two working examples right now are public and opengl.

os error 5 means that the dll file exists, but access to it is denied, due to permission problems. If you are on an Administrator account, this should not happen. Try applying this guide to your E:\rust\cargo directory: https://appuals.com/fix-error-5-access-denied-windows-10/

Sorry, this error was due to a typo in the macro:

include_bytes!(concat!(env!("CARGO_HOME"), "/lib/", "azul-dll-", env!("CARGO_PKG_VERSION", "/target/release/azul.dll")));

should have been:

include_bytes!(concat!(env!("CARGO_HOME"), "/lib/", "azul-dll-", env!("CARGO_PKG_VERSION"), "/target/release/azul.dll"));
                                                                                         ^

... which led cargo to try and include an entire (non-existent) directory instead of just one file.

This is fixed in 6e5cdb5, please adjust your Cargo.toml and try again. You do not need to run cargo install azul-dll, because this was just a typo in the path:

azul = { git = "https://github.com/maps4print/azul", rev = "6e5cdb597c478cd664bd2695146e442fbcb5230f" }

What is the contents of the E:\rust\cargo\lib\azul-dll-0.1.0\target\release directory? Is there an azul.dll file in there?

I thought when run this shell cargo install --path azul-dll ,the dll well right there ,
I have copy dll to cargo\lib\ ,
now,it seems i have copy to the wrong path

Thank you for your patience!!

image

Does it work now?

Does it work now?
i do not kown ,why it does not works , azul.dll is just in the right place ,

new a project
just like this dependencies azul = { git = "https://github.com/maps4print/azul", rev = "6e5cdb597c478cd664bd2695146e442fbcb5230f" }
the same error
i have try fix with Absolute path include_bytes!("E:/rust/azul/target/release/azul.dll") ,it works

but it give me another error
my code git clone form branch wip

E:\rust\azul>cargo run --release --example hello_world
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: E:\rust\azul\azul\Cargo.toml
workspace: E:\rust\azul\Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: E:\rust\azul\azul-dll\Cargo.toml
workspace: E:\rust\azul\Cargo.toml
Compiling azul v0.0.1 (E:\rust\azul\azul)
Compiling azul-widgets v0.0.2 (E:\rust\azul\azul-widgets)
error[E0433]: failed to resolve: could not find widgets in azul
--> azul../examples/hello_world/hello_world.rs:5:24
|
5 | use azul::{prelude::*, widgets::{label::Label, button::Button}};
| ^^^^^^^ could not find widgets in azul

error[E0433]: failed to resolve: use of undeclared type or module Label
--> azul../examples/hello_world/hello_world.rs:13:21
|
13 | let label = Label::new(format!("{}", self.counter)).dom();
| ^^^^^ use of undeclared type or module Label

error[E0433]: failed to resolve: use of undeclared type or module Button
--> azul../examples/hello_world/hello_world.rs:14:22
|
14 | let button = Button::with_label("Update counter").dom()
| ^^^^^^ use of undeclared type or module Button

error[E0433]: failed to resolve: use of undeclared type or module On
--> azul../examples/hello_world/hello_world.rs:15:28
|
15 | .with_callback(On::MouseUp, |cb_info: CallbackInfo| {
| ^^ use of undeclared type or module On

error[E0433]: failed to resolve: use of undeclared type or module css
--> azul../examples/hello_world/hello_world.rs:31:38
|
31 | app.run(WindowCreateOptions::new(css::native()));
| ^^^ use of undeclared type or module css

error[E0405]: cannot find trait Layout in this scope
--> azul../examples/hello_world/hello_world.rs:11:6
|
11 | impl Layout for DataModel {
| ^^^^^^ not found in this scope

error[E0412]: cannot find type CallbackInfo in this scope
--> azul../examples/hello_world/hello_world.rs:15:51
|
15 | .with_callback(On::MouseUp, |cb_info: CallbackInfo| {
| ^^^^^^^^^^^^ not found in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
5 | use azul::callbacks::CallbackInfo;
|

error[E0425]: cannot find value Redraw in this scope
--> azul../examples/hello_world/hello_world.rs:17:17
|
17 | Redraw
| ^^^^^^ not found in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
5 | use azul::callbacks::UpdateScreen::Redraw;
|

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0405, E0412, E0425, E0433.
For more information about an error, try rustc --explain E0405.
error: could not compile azul.

To learn more, run the command again with --verbose.

E:\rust\azul>

As I said, cargo run --example hello_world does not work at the moment.

Only cargo run --example public and cargo run --example opengl do.

I don't know why the installation isn't working smoothly - the dll file should be in your .cargo directory, usually this is C:\\Users\[user]\.cargo, not E:\rust\

all right ,public and opengl works well ,thanks !!!
some where give me advise to set environment variable
I want to do a Windows application to parse JSON, hope everything goes well
happy code !