I'm trying to compile a Rust program that uses Jolt as a dynamic library (cdylib).
But libloading crate failed to load the compiled library (.so file).
thread 'main' panicked at src/main.rs:8:58:
called `Result::unwrap()` on an `Err` value: DlOpen { desc: "../lib-producer/target/release/liblib_producer.so: undefined symbol: _HEAP_PTR" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
So, first I run cargo build -r in lib-producer.
Then I run cargo run in lib-consumer.
But I always got this error:
thread 'main' panicked at src/main.rs:8:58:
called `Result::unwrap()` on an `Err` value: DlOpen { desc: "../lib-producer/target/release/liblib_producer.so: undefined symbol: _HEAP_PTR" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I'm trying to compile a Rust program that uses Jolt as a dynamic library (
cdylib
). Butlibloading
crate failed to load the compiled library (.so file).To demonstrate the issue, I have provided the complete code in this repository .
There are 3 apps:
guest
is the sample fibonacci guest codelib-producer
is a Rust library packagejolt-sdk
andguest
[lib] crate-type = ["rlib", "cdylib"]
src/lib.rs
it exports C functionsarbitrary_string
andexecute_guest_code
lib-producer/target/release/liblib_producer.so
filelib-consumer
is a Rust app that will load thelib-producer/target/release/liblib_producer.so
file and call the functions insidelibloading
In
lib-producer/src/lib.rs
, it exports function like this:Then in
lib-consumer/src/main.rs
, it loads the dynamic library file and calls the functionYou can see the complete code here.
So, first I run
cargo build -r
inlib-producer
. Then I runcargo run
inlib-consumer
. But I always got this error:Do you know what happened here? Thank you.