log4rs icon indicating copy to clipboard operation
log4rs copied to clipboard

log4rs does not work on target wasm32-wasi

Open jornfranke opened this issue 4 years ago • 1 comments

Hi,

I would like to use log4rs and compile it to the target wasm32-wasi:

cargo build --target wasm32-wasi

Output:

error[E0425]: cannot find function `get_internal` in this scope
  --> /.cargo/registry/src/github.com-1ecc6299db9ec823/thread-id-3.3.0/src/lib.rs:44:5
   |
44 |     get_internal()
   |     ^^^^^^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.

This does not work as there is an issue with the thread-id library: https://github.com/ruuda/thread-id/issues/10 Note: The issue is rather old and wasm allows compilation with threads (no other library causes problems...). If I remove log4rs as a dependency then I can compile.

Do you have a pointer where thread-id is used and if this could be maybe removed from log4rs?

I think making it work on WASM would extend the potential use cases of log4rs significantly.

Thank you.

jornfranke avatar Feb 14 '22 18:02 jornfranke

We should be able to avoid calling thread_id all together in wasi compile target.

estk avatar Apr 19 '22 19:04 estk