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

can't compile examples #8

Open
wiiznokes opened this issue Jul 2, 2023 · 8 comments
Open

can't compile examples #8

wiiznokes opened this issue Jul 2, 2023 · 8 comments

Comments

@wiiznokes
Copy link

hi, newbie here.
I saw in an issue that i needed wasm-pack. So i installed it with this.

But now, i have this error:

lenaic@pop-os:~/Documents/dev/async_ui/examples/web-todomvc$ wasm-pack build --target web
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
   Compiling js-sys v0.3.64
   Compiling async_ui_web_macros v0.1.0 (/home/lenaic/Documents/dev/async_ui/async_ui_web_macros)
error[E0432]: unresolved import `cssparser::RuleListParser`
  --> async_ui_web_macros/src/css.rs:79:30
   |
79 |         QualifiedRuleParser, RuleListParser, Token,
   |                              ^^^^^^^^^^^^^^
   |                              |
   |                              no `RuleListParser` in the root
   |                              help: a similar name exists in the module: `RuleBodyParser`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `async_ui_web_macros` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: cd "/home/lenaic/Documents/dev/async_ui/examples/web-todomvc" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

Also, is this library only available for web with wasm or it also works on desktop ?

@wishawa
Copy link
Owner

wishawa commented Jul 4, 2023

Hi! The issue seems to be coming from wrong cssparser version. I incorrectly had the version set at 0.31.* instead of to 0.31.0. I've made a fix and pushed to main. Please try again!

Also, the examples are now made to be built with trunk rather than directly with wasm-pack. Trunk is very simple; just install it and do

cd examples/web-todomvc
trunk serve

is this library only available for web with wasm or it also works on desktop ?

In the beginning there was a GTK4 version too. However, I decided to remove that for the time being. The concept behind Async UI is still quite new so I want to have one platform working well first.

@wiiznokes
Copy link
Author

I still get an error 😢

lenaic@pop-os:~/Documents/dev/async_ui/examples/web-todomvc$ trunk serve
2023-07-06T00:03:29.635696Z  INFO 📦 starting build
2023-07-06T00:03:29.636350Z  INFO spawning asset pipelines
2023-07-06T00:03:29.697966Z  INFO building web-todomvc
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
   Compiling async_ui_web_macros v0.1.0 (/home/lenaic/Documents/dev/async_ui/async_ui_web_macros)
   Compiling web-sys v0.3.64
error[E0432]: unresolved import `cssparser::RuleListParser`
  --> async_ui_web_macros/src/css.rs:79:30
   |
79 |         QualifiedRuleParser, RuleListParser, Token,
   |                              ^^^^^^^^^^^^^^
   |                              |
   |                              no `RuleListParser` in the root
   |                              help: a similar name exists in the module: `RuleBodyParser`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `async_ui_web_macros` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
2023-07-06T00:03:33.630323Z ERROR ❌ error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
    2: cargo call returned a bad status
2023-07-06T00:03:33.630513Z  INFO 📡 serving static assets at -> /
2023-07-06T00:03:33.630539Z  INFO 📡 server listening at http://127.0.0.1:8080

@wishawa
Copy link
Owner

wishawa commented Jul 6, 2023

Very strange. Can you make sure again that you have pulled the latest change (commit 3ab00b0), and that the file async_ui_web_macros/Cargo.toml has the line

cssparser = "0.31.0"

at the end?

If the error still persist, maybe try cargo clean?

@wiiznokes
Copy link
Author

I made git pull so I should be fine. cargo clean show this:

cargo clean
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest

but it seems to work because i need to recompile the crates after.
But i still get this error. Very strange indeed.

@wishawa
Copy link
Owner

wishawa commented Jul 11, 2023

I misunderstood how cargo handles semantic versioning. Commit fd8158f should fix the issue. Please try it!

@wiiznokes
Copy link
Author

well, i have this new error now 😄 (even with the last commit)

lenaic@pop-os:~/Documents/dev/async_ui/examples/web-todomvc$ trunk serve
2023-07-11T17:49:53.298965Z  INFO 📦 starting build
2023-07-11T17:49:53.299232Z  INFO spawning asset pipelines
2023-07-11T17:49:53.364523Z  INFO building web-todomvc
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
2023-07-11T17:49:53.426108Z  INFO fetching cargo artifacts
2023-07-11T17:49:53.488682Z ERROR ❌ error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: cargo artifacts not found for target crate
2023-07-11T17:49:53.488866Z  INFO 📡 serving static assets at -> /
2023-07-11T17:49:53.488889Z  INFO 📡 server listening at http://127.0.0.1:8080

@wishawa
Copy link
Owner

wishawa commented Jul 18, 2023

Seems to be a trunk issue. Can you try wasm-pack instead?

To build with wasm-pack, replace the content of index.html with this

<!DOCTYPE html>
<html>
<head>
	<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
</head>
<body>
	<script type="module">
		import init from './pkg/web_todomvc.js';
		init();
	</script>
</body>
</html>

Then run

wasm-pack build --dev --target web

Then you will have to serve the built content. I usually use microserver.

cargo install microserver
microserver

@ChocolateLoverRaj
Copy link

trunk serve works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants