LukeMathWalker / LukeMathWalker/tracing-bunyan-formatter

Does not build on wasm32

Open
#12 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
112
Forks
44
PR merge metrics
No merged PRs in 30d

Description

This is a dupe of https://github.com/fastly/cli/issues/532#issuecomment-1032492496, but the fix lies in either this package or gethostname

My Rust app uses v0.3.2 of tracing-bunyan-formatter and it fails to build for target wasm32-unknown-unknown:

Compiling gethostname v0.2.2
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> /Users/cpete0624/.cargo/registry/src/github.com-1ecc6299db9ec823/gethostname-0.2.2/src/lib.rs:65:18
   |
65 |     use std::os::unix::ffi::OsStringExt;
   |                  ^^^^ could not find `unix` in `os`

error[E0432]: unresolved import `libc::_SC_HOST_NAME_MAX`
  --> /Users/cpete0624/.cargo/registry/src/github.com-1ecc6299db9ec823/gethostname-0.2.2/src/lib.rs:64:33
   |
64 |     use libc::{c_char, sysconf, _SC_HOST_NAME_MAX};
   |                                 ^^^^^^^^^^^^^^^^^ no `_SC_HOST_NAME_MAX` in the root

error[E0425]: cannot find function `gethostname` in crate `libc`
  --> /Users/cpete0624/.cargo/registry/src/github.com-1ecc6299db9ec823/gethostname-0.2.2/src/lib.rs:70:37
   |
70 |     let returncode = unsafe { libc::gethostname(buffer.as_mut_ptr() as *mut c_char, buffer.len()) };
   |                                     ^^^^^^^^^^^ not found in `libc`
   |
help: consider importing this function
   |
27 | use crate::gethostname;
   |

   Compiling tracing-log v0.1.2
error[E0599]: no function or associated item named `from_vec` found for struct `OsString` in the current scope
  --> /Users/cpete0624/.cargo/registry/src/github.com-1ecc6299db9ec823/gethostname-0.2.2/src/lib.rs:89:15
   |
89 |     OsString::from_vec(buffer)
   |               ^^^^^^^^ function or associated item not found in `OsString`
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
27 | use std::os::wasi::ffi::OsStringExt;
   |

Some errors have detailed explanations: E0425, E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `gethostname` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the build for the wasm32-unknown-unknown target using tracing-bunyan-formatter v0.3.2 and inspect the gethostname v0.2.2 source path shown in the compiler errors. Determine whether the compatibility change belongs in this package or gethostname; done means the Rust app builds successfully for wasm32 without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.