Paulo Bressan
Paulo Bressanā€¢10mo ago

Rust compile deno_runtime error

Hi ferrisUpsideDown I've been this error when I'm compiling my code that uses deno_runtime lib. But I don't know what's this and how I can fix it. Can you help me? I'm using Ubuntu error: linking with cc failed: exit status: 1
No description
26 Replies
bartlomieju
bartlomiejuā€¢10mo ago
It's hard to say without full output from the compiler
Paulo Bressan
Paulo Bressanā€¢10mo ago
Hi @.bartlomieju, thanks for answer . I'll send a file with the full output, a moment
Paulo Bressan
Paulo Bressanā€¢10mo ago
When I add deno_runtime and deno_core this error occurs
bartlomieju
bartlomiejuā€¢10mo ago
That's really strange... Is your project available online to be checked out?
Paulo Bressan
Paulo Bressanā€¢10mo ago
Yes, https://github.com/txpipe/oura/tree/fix/update-dependences this command cargo run -- daemon --config examples/deno_basics/daemon.toml I updated deno dependencies to the latest version thank you for your help Here we're using deno https://github.com/txpipe/oura/tree/fix/update-dependences/src/filters/deno
bartlomieju
bartlomiejuā€¢10mo ago
Thanks, I'll check it tomorrow
Paulo Bressan
Paulo Bressanā€¢10mo ago
Hey, I updated the code to use deno_core inside the deno_runtime and removed it from my deno feature on toml file and everything worked šŸ¤” I used this example https://github.com/denoland/deno/tree/main/runtime/examples/extension_with_ops I've tried to remove deno_core from my dependencies but deno_runtime still uses it deno_runtime has a feature to import deno_core?
bartlomieju
bartlomiejuā€¢10mo ago
It doesn't have a feature - deno_runtime just directly reexports deno_core. After sleeping on it, I think you just had two different versions of deno_core used, which in turn used two different versions of rusty_v8 and that's why you got duplicate symbols in the linker output It's better to only specify dependency on deno_runtime - then it will make sure you have compatible deno_core and rusty_v8 crate Great that you figured it out šŸ‘
Paulo Bressan
Paulo Bressanā€¢10mo ago
Hi, gm do I need to install deno_core or just deno_runtime?
Paulo Bressan
Paulo Bressanā€¢10mo ago
No description
bartlomieju
bartlomiejuā€¢10mo ago
You should only need deno_runtime Do you get the same error if you compile from the terminal? That might be a flake from rust-analyzer
Paulo Bressan
Paulo Bressanā€¢10mo ago
error: custom attribute panicked
--> src/filters/deno/mod.rs:19:1
|
19 | #[op]
| ^^^^^
|
= help: message: deno_core not present in `Cargo.toml`: CrateNotFound { crate_name: "deno_core", path: "/home/paulo/projects/txpipe/oura/Cargo.toml" }

error: custom attribute panicked
--> src/filters/deno/mod.rs:30:1
|
30 | #[op]
| ^^^^^
|
= help: message: deno_core not present in `Cargo.toml`: CrateNotFound { crate_name: "deno_core", path: "/home/paulo/projects/txpipe/oura/Cargo.toml" }

warning: unused import: `OpState`
--> src/filters/deno/mod.rs:3:52
|
3 | use deno_runtime::deno_core::{op, ModuleSpecifier, OpState};
| ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default

error[E0433]: failed to resolve: use of undeclared crate or module `op_pop_record`
--> src/filters/deno/mod.rs:17:57
|
17 | deno_runtime::deno_core::extension!(deno_filter, ops = [op_pop_record, op_put_record]);
| ^^^^^^^^^^^^^ use of undeclared crate or module `op_pop_record`

error[E0433]: failed to resolve: use of undeclared crate or module `op_put_record`
--> src/filters/deno/mod.rs:17:72
|
17 | deno_runtime::deno_core::extension!(deno_filter, ops = [op_pop_record, op_put_record]);
| ^^^^^^^^^^^^^ use of undeclared crate or module `op_put_record`

For more information about this error, try `rustc --explain E0433`.
warning: `oura` (lib) generated 1 warning
error: could not compile `oura` (lib) due to 4 previous errors; 1 warning emitted
error: custom attribute panicked
--> src/filters/deno/mod.rs:19:1
|
19 | #[op]
| ^^^^^
|
= help: message: deno_core not present in `Cargo.toml`: CrateNotFound { crate_name: "deno_core", path: "/home/paulo/projects/txpipe/oura/Cargo.toml" }

error: custom attribute panicked
--> src/filters/deno/mod.rs:30:1
|
30 | #[op]
| ^^^^^
|
= help: message: deno_core not present in `Cargo.toml`: CrateNotFound { crate_name: "deno_core", path: "/home/paulo/projects/txpipe/oura/Cargo.toml" }

warning: unused import: `OpState`
--> src/filters/deno/mod.rs:3:52
|
3 | use deno_runtime::deno_core::{op, ModuleSpecifier, OpState};
| ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default

error[E0433]: failed to resolve: use of undeclared crate or module `op_pop_record`
--> src/filters/deno/mod.rs:17:57
|
17 | deno_runtime::deno_core::extension!(deno_filter, ops = [op_pop_record, op_put_record]);
| ^^^^^^^^^^^^^ use of undeclared crate or module `op_pop_record`

error[E0433]: failed to resolve: use of undeclared crate or module `op_put_record`
--> src/filters/deno/mod.rs:17:72
|
17 | deno_runtime::deno_core::extension!(deno_filter, ops = [op_pop_record, op_put_record]);
| ^^^^^^^^^^^^^ use of undeclared crate or module `op_put_record`

For more information about this error, try `rustc --explain E0433`.
warning: `oura` (lib) generated 1 warning
error: could not compile `oura` (lib) due to 4 previous errors; 1 warning emitted
bartlomieju
bartlomiejuā€¢10mo ago
@mmastrac can you take a look and advise?
Paulo Bressan
Paulo Bressanā€¢10mo ago
It works only if I install deno_core
Paulo Bressan
Paulo Bressanā€¢10mo ago
No description
Paulo Bressan
Paulo Bressanā€¢10mo ago
My cargo.toml
No description
Paulo Bressan
Paulo Bressanā€¢10mo ago
Do you have an example using #[op2] macro?
ioB
ioBā€¢10mo ago
https://github.com/buenojs/bueno/blob/main/ext/fs/lib.rs I struggled with #[op2] for a little bit, this code helped me figure it out
Paulo Bressan
Paulo Bressanā€¢10mo ago
@lino-levan thank you very much it helped me a lot and now it works ā¤ļø @.bartlomieju what's deno_kv ?
bartlomieju
bartlomiejuā€¢10mo ago
It's an extension that implements Deno.openKv API
Paulo Bressan
Paulo Bressanā€¢10mo ago
this lib is required? Because when I use deno_runtime I need to install protoc. Is there any feature to use minimal deno_runtime?
bartlomieju
bartlomiejuā€¢10mo ago
Unfortunately it is. There's no slimmed down version of the runtime, you'd have to pull crates one by one
Paulo Bressan
Paulo Bressanā€¢10mo ago
Ok, thank you very much. Do you know what version this was implemented?
bartlomieju
bartlomiejuā€¢10mo ago
Hmmm, about 2-3 versions back
Paulo Bressan
Paulo Bressanā€¢10mo ago
tks