iv-org / inv_sig_helper

GNU Affero General Public License v3.0
29 stars 9 forks source link

error[E0425]: cannot find value `JS_EVAL_FLAG_ASYNC` in module `qjs` #30

Open yo000 opened 1 month ago

yo000 commented 1 month ago

Hello,

When compiling under FreeBSD 14, rust 1.81, I got these errors :

   Compiling rquickjs-core v0.6.0
error[E0425]: cannot find value `JS_EVAL_FLAG_ASYNC` in module `qjs`
  --> /home/invidious/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rquickjs-core-0.6.0/src/context/ctx.rs:49:26
   |
49 |             flag |= qjs::JS_EVAL_FLAG_ASYNC;
   |                          ^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `JS_EVAL_FLAG_STRICT`
   |
  ::: /home/invidious/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rquickjs-sys-0.6.0/src/bindings/x86_64-unknown-freebsd.rs:30:1
   |
30 | pub const JS_EVAL_FLAG_STRICT: u32 = 8;
   | ---------------------------------- similarly named constant `JS_EVAL_FLAG_STRICT` defined here

error[E0425]: cannot find value `JS_ATOM_null` in module `qjs`
  --> /home/invidious/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rquickjs-core-0.6.0/src/value/atom/predefined.rs:12:17
   |
12 |     Null = qjs::JS_ATOM_null as u32, // must be first
   |                 ^^^^^^^^^^^^ help: a constant with a similar name exists: `JS_ATOM_NULL`
   |
  ::: /home/invidious/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rquickjs-sys-0.6.0/src/bindings/x86_64-unknown-freebsd.rs:34:1
   |
34 | pub const JS_ATOM_NULL: u32 = 0;
   | --------------------------- similarly named constant `JS_ATOM_NULL` defined here

error[E0425]: cannot find value `JS_ATOM_false` in module `qjs`
  --> /home/invidious/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rquickjs-core-0.6.0/src/value/atom/predefined.rs:14:18
   |
14 |     False = qjs::JS_ATOM_false as u32,
   |                  ^^^^^^^^^^^^^ not found in `qjs`

And so on. I'm a total noob with rust ; Am I missing a lib or something?

yo000 commented 3 days ago

Back on this, to say I finally got it compiling under FreeBSD. Msg above is not the first errror you would see, I already made "adjustments" in code to land there. Without touching anything, the first compile error is :

error[E0061]: this function takes 6 arguments but 5 arguments were supplied
    --> /home/invidious/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rquickjs-sys-0.6.0/src/inlines/common.rs:174:5
     |
174  |     JS_SetPropertyInternal(ctx, this_obj, prop, val, JS_PROP_THROW as i32)
     |     ^^^^^^^^^^^^^^^^^^^^^^                           -------------------- argument #5 of type `JSValue` is missing
     |
note: function defined here
    --> /usr/home/invidious/inv_sig_helper/target/release/build/rquickjs-sys-76dc9acef9f2c377/out/bindings.rs:1494:12
     |
1494 |     pub fn JS_SetPropertyInternal(
     |            ^^^^^^^^^^^^^^^^^^^^^^
help: provide the argument
     |
174  |     JS_SetPropertyInternal(ctx, this_obj, prop, val, /* JSValue */, JS_PROP_THROW as i32)
     |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0061`.
error: could not compile `rquickjs-sys` (lib) due to 1 previous error

I made it to compile under FreeBSD 14.1, rust 1.81, llvm 18 with the following commands :

git clone https://github.com/iv-org/inv_sig_helper.git
sudo pkg install rust llvm18
cd inv_sig_helper
sed -i .bak 's/0.6.0/0.6.1/' Cargo.toml
sed -i .bak 's!features=\["futures"!features=\["bindgen", "futures"!' Cargo.toml
cargo clean
cargo build --release

Hope it helps

unixfox commented 3 days ago

hey, I'm sorry we can't help you with freebsd. But I can share to you that we are going to replace inv_sig_helper soon.

there is a new program written in deno (javascript) here: https://github.com/iv-org/invidious-companion - https://github.com/iv-org/invidious/pull/4985

and I think there is support on freebsd for deno: https://www.freshports.org/www/deno/