Aardwolf-Social / aardwolf-social

Powering connected social communities with open software.
https://aardwolf.social
GNU Affero General Public License v3.0
485 stars 44 forks source link

error[E0425]: cannot find value `assets` in this scope #322

Closed yonas closed 4 months ago

yonas commented 11 months ago
$ cargo build --release
...
   Compiling aardwolf-actix v0.1.0
error[E0425]: cannot find value `assets` in this scope
   --> aardwolf-actix/src/lib.rs:228:49
    |
228 |                     .service(Files::new("/web", assets.web()))
    |                                                 ^^^^^^ not found in this scope

error[E0425]: cannot find value `assets` in this scope
   --> aardwolf-actix/src/lib.rs:229:52
    |
229 |                     .service(Files::new("/images", assets.images()))
    |                                                    ^^^^^^ not found in this scope

error[E0425]: cannot find value `assets` in this scope
   --> aardwolf-actix/src/lib.rs:230:52
    |
230 |                     .service(Files::new("/themes", assets.themes()))
    |                                                    ^^^^^^ not found in this scope

error[E0425]: cannot find value `assets` in this scope
   --> aardwolf-actix/src/lib.rs:231:51
    |
231 |                     .service(Files::new("/emoji", assets.emoji()))
    |                                                   ^^^^^^ not found in this scope

error[E0425]: cannot find value `assets` in this scope
   --> aardwolf-actix/src/lib.rs:232:57
    |
232 |                     .service(Files::new("/stylesheets", assets.stylesheets()))
    |                                                         ^^^^^^ not found in this scope

warning: `aardwolf-types` (lib) generated 3 warnings (run `cargo fix --lib -p aardwolf-types` to apply 1 suggestion)
warning: `aardwolf-templates` (lib) generated 10 warnings (run `cargo fix --lib -p aardwolf-templates` to apply 4 suggestions)
For more information about this error, try `rustc --explain E0425`.
error: could not compile `aardwolf-actix` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
warning: `aardwolf-models` (lib) generated 1 warning

OS: FreeBSD 14 checkout: f02d5cb02b9e8228cde93a378651a6d23bbf49ee

BanjoFox commented 11 months ago

Thank you for bringing this up. I can try to work on a fix, but it looks as if the --release switch tries to pull in the Ructe templates which we want to move away from. To replace Ructe, we've picked the YEW Framework.

yonas commented 11 months ago

@BanjoFox Thanks, when removing --release, I get another error:

$ cargo build
...
  = note: ld: error: unable to find library -lpq
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `aardwolf` (bin "aardwolf-server") due to previous error
BanjoFox commented 11 months ago

LPQ is related to Postgres libraries. Specifically those provided by the libpq-dev package.

I have tried to start documenting common errors, and that is the second entry. Troubleshooting

Later today/this weekend I am going to try spinning up a FreeBSD 14 VM to do more testing.

yonas commented 11 months ago

Thanks @BanjoFox , I was able to compile it, but the webui doesn't work:

$ cat aardwolf.log                                                                                                                                                                                                   
[00:00:00.204] (4678bea13c00) INFO   starting 16 workers                                                                                                                                                             
[00:00:00.205] (4678bea13c00) INFO   Tokio runtime found; starting in existing Tokio runtime                                                                                                                         
[00:00:00.209] (4678c0457000) ERROR  Specified path is not a directory: "dist"                                                                                                                                       
[00:00:00.209] (4678c0457000) ERROR  Specified path is not a directory: "web/images"                                                                                                                                 
[00:00:00.209] (4678c0457000) ERROR  Specified path is not a directory: "web/themes"                                                                                                                                 
[00:00:00.209] (4678c0457000) ERROR  Specified path is not a directory: "web/emoji"                                                                                                                                  
[00:00:00.210] (4678c0457000) ERROR  Specified path is not a directory: "web/stylesheets"                                                                                                                            
[00:00:00.215] (4678c0457700) ERROR  Specified path is not a directory: "dist"                                                                                                                                       
[00:00:00.215] (4678c0457700) ERROR  Specified path is not a directory: "web/images"                                                                                                                                 
[00:00:00.215] (4678c0457700) ERROR  Specified path is not a directory: "web/themes"                                                                                                                                 
[00:00:00.215] (4678c0457700) ERROR  Specified path is not a directory: "web/emoji"                                                                                                                                  
[00:00:00.215] (4678c0457700) ERROR  Specified path is not a directory: "web/stylesheets"                                                                                                                            
[00:00:00.220] (4678c0457e00) ERROR  Specified path is not a directory: "dist"                                                                                                                                       
[00:00:00.220] (4678c0457e00) ERROR  Specified path is not a directory: "web/images"                                                                                                                                 
[00:00:00.220] (4678c0457e00) ERROR  Specified path is not a directory: "web/themes"                                                                                                                                 
[00:00:00.220] (4678c0457e00) ERROR  Specified path is not a directory: "web/emoji"                                                                                                                                  
[00:00:00.220] (4678c0457e00) ERROR  Specified path is not a directory: "web/stylesheets"                                                                                                                            
[00:00:00.225] (4678c0458500) ERROR  Specified path is not a directory: "dist"                                                                                                                                       
[00:00:00.225] (4678c0458500) ERROR  Specified path is not a directory: "web/images"                                                                                                                                 
[00:00:00.225] (4678c0458500) ERROR  Specified path is not a directory: "web/themes"                                                                                                                                 
[00:00:00.225] (4678c0458500) ERROR  Specified path is not a directory: "web/emoji"                                                                                                                                  
[00:00:00.225] (4678c0458500) ERROR  Specified path is not a directory: "web/stylesheets"         
BanjoFox commented 11 months ago

In the spirit of full transparency, none of the current branches will compile to a minimally functional web-app.

The directories being referenced in that log file are all part of the ructe templates which we are moving away from. There are still remnants available in the /aardwolf-templates/* directories within the repo. If memory serves, there was also a webpack component for building the static assets.

If you wanted to try fixing the error as-is there is a copy of the web/ directory still on the aardwolf-interface repository.

The aardwolf-interface app is also where I have put the the most up-to-date copy of the Yew frontend work (see /aardwolf-yew-app, and use trunk serve within that directory).

yonas commented 11 months ago

I'm getting an error: error taking canonical path of directory "/git/aardwolf-interface/aardwolf-yew-app/./assets": No such file or directory (os error 2)

$ cd aardwolf-interface/aardwolf-yew-app
$ trunk serve  
2023-12-17T17:34:40.866103Z  INFO 📦 starting build
2023-12-17T17:34:40.869029Z  INFO spawning asset pipelines
2023-12-17T17:34:41.082665Z  INFO copying directory path="assets"
2023-12-17T17:34:41.082742Z  INFO copying & hashing css path="static/scratchpad.css"
2023-12-17T17:34:41.082746Z  INFO copying & hashing css path="static/base.css"
2023-12-17T17:34:41.082896Z  INFO copying & hashing css path="static/notificationBox.css"
2023-12-17T17:34:41.082875Z  INFO copying & hashing css path="static/notification_dropdown.css"
2023-12-17T17:34:41.083018Z  INFO building aardwolf-yew-app
2023-12-17T17:34:41.083197Z ERROR ❌ error
error from build pipeline

Caused by:
    0: error from asset pipeline
    1: error taking canonical path of directory "/git/aardwolf-interface/aardwolf-yew-app/./assets"
    2: No such file or directory (os error 2)
2023-12-17T17:34:41.083932Z  INFO finished copying & hashing css path="static/scratchpad.css"
2023-12-17T17:34:41.084016Z  INFO finished copying & hashing css path="static/notificationBox.css"
2023-12-17T17:34:41.084206Z  INFO finished copying & hashing css path="static/base.css"
2023-12-17T17:34:41.084294Z  INFO finished copying & hashing css path="static/notification_dropdown.css"
2023-12-17T17:34:41.084639Z  INFO 📡 serving static assets at -> /
2023-12-17T17:34:41.084682Z  INFO 📡 server listening at http://127.0.0.1:8080
    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
2023-12-17T17:34:41.298273Z  INFO fetching cargo artifacts
2023-12-17T17:34:41.756781Z  INFO downloading wasm-bindgen version="0.2.87"
BanjoFox commented 11 months ago

Try running the following command to ensure you have the WASM package

cargo install --locked wasm-bindgen-cli

On Sun, Dec 17, 2023, 12:33 Yonas Yanfa @.***> wrote:

I'm getting an error: error taking canonical path of directory "/git/aardwolf-interface/aardwolf-yew-app/./assets": No such file or directory (os error 2)

$ cd aardwolf-interface/aardwolf-yew-app $ trunk serve 2023-12-17T17:34:40.866103Z INFO 📦 starting build 2023-12-17T17:34:40.869029Z INFO spawning asset pipelines 2023-12-17T17:34:41.082665Z INFO copying directory path="assets" 2023-12-17T17:34:41.082742Z INFO copying & hashing css path="static/scratchpad.css" 2023-12-17T17:34:41.082746Z INFO copying & hashing css path="static/base.css" 2023-12-17T17:34:41.082896Z INFO copying & hashing css path="static/notificationBox.css" 2023-12-17T17:34:41.082875Z INFO copying & hashing css path="static/notification_dropdown.css" 2023-12-17T17:34:41.083018Z INFO building aardwolf-yew-app 2023-12-17T17:34:41.083197Z ERROR ❌ error error from build pipeline

Caused by: 0: error from asset pipeline 1: error taking canonical path of directory "/git/aardwolf-interface/aardwolf-yew-app/./assets" 2: No such file or directory (os error 2) 2023-12-17T17:34:41.083932Z INFO finished copying & hashing css path="static/scratchpad.css" 2023-12-17T17:34:41.084016Z INFO finished copying & hashing css path="static/notificationBox.css" 2023-12-17T17:34:41.084206Z INFO finished copying & hashing css path="static/base.css" 2023-12-17T17:34:41.084294Z INFO finished copying & hashing css path="static/notification_dropdown.css" 2023-12-17T17:34:41.084639Z INFO 📡 serving static assets at -> / 2023-12-17T17:34:41.084682Z INFO 📡 server listening at http://127.0.0.1:8080 Finished dev [unoptimized + debuginfo] target(s) in 0.19s 2023-12-17T17:34:41.298273Z INFO fetching cargo artifacts 2023-12-17T17:34:41.756781Z INFO downloading wasm-bindgen version="0.2.87"

— Reply to this email directly, view it on GitHub https://github.com/Aardwolf-Social/aardwolf/issues/322#issuecomment-1859231812, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCA2JCBVJTKCK5TRO7XBJ3YJ4UGFAVCNFSM6AAAAABATZVMZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGIZTCOBRGI . You are receiving this because you were mentioned.Message ID: @.***>

yonas commented 11 months ago

@BanjoFox Thanks, I still get the same error though.

BanjoFox commented 11 months ago

I have not forgotten about this. The FreeBSD 14 VM image gave me some headaches so I'm wanting to start over from scratch. The two major steps to getting YEW Framework (or any trunk-based apps compiled) are:

$ rustup target add wasm32-unknown-unknown
$ cargo install --locked trunk

Once I get a FreeBSD development VM spun up I will be better able to troubleshoot.

BanjoFox commented 11 months ago

I just tested on my FreeBSD14 and am getting an "unsupported OS" error. What I did was

$ rustup target add wasm32-unknown-unknown
$ cargo install --locked trunk
$ cd [path_to_git_repo]/aardwolf-yew-app
$ trunk serve
yonas commented 11 months ago

I just tested on my FreeBSD14 and am getting an "unsupported OS" error.

Can you copy/paste the console output that contains "unsupported OS"?

BanjoFox commented 11 months ago
    Finished dev [unoptimized + debuginfo] target(s) in 0.35s
2023-12-26T19:57:00.789871Z  INFO fetching cargo artifacts
2023-12-26T19:57:01.459046Z  INFO downloading wasm-bindgen version="0.2.87"
2023-12-26T19:57:01.467847Z ERROR ❌ error
error from build pipeline

Caused by:
    0: error from asset pipeline
    1: failed downloading release archive
    2: unsupported OS
2023-12-26T19:57:01.472421Z  INFO 📡 serving static assets at -> /
2023-12-26T19:57:01.472432Z  INFO 📡 server listening at http://127.0.0.1:8080
^Cquixote@damien:~/gits/aardwolf/aardwolf-yew-frontend $ cd
quixote@damien:~ $ tar -C / -xpf lib32.txz
tar: Error opening archive: Failed to open 'lib32.txz'
quixote@damien:~ $ rustup target list --installed
wasm32-unknown-unknown
x86_64-unknown-freebsd
quixote@damien:~ $ 
BanjoFox commented 11 months ago

Looks like I got it running further:

First install the wasm-bindgen-cli package, then update the wasm schema

$ cargo install wasm-bindgen-cli 
$ cargo update -p wasm-bindgen --precise 0.2.89

Tomorrow I will investigate to see if the repo needs to be refreshed. The demo UI doesn't currently load on main but that might be due to a pending merge from the interface repo.

BanjoFox commented 11 months ago

I just re-ran the trunk serve on the main branch using my OSX machine, and it seems to render the starter page without issue. It's making me wonder if there's something broken on the FreeBSD VM I set up.

BanjoFox commented 4 months ago

FreeBSD Version: 14.1-RELEASE-p2 Steps to build:

$ git clone (main branch)
$ pkg install postgres16-server postgres16-client
$ cargo install wasm-bindgen-cli 
$ cargo update -p wasm-bindgen
$ cd aardwolf-yew-frontend
$ trunk serve

This SHOULD bring up the trunk server for testing the frontend.

yonas commented 4 months ago

Steps to build:

$ git clone (main branch)
$ pkg install postgres16-server postgres16-client
$ cargo install wasm-bindgen-cli 
$ cargo update -p wasm-bindgen
$ cd aardwolf-yew-frontend
$ trunk serve

Thanks! This works for me.