marine icon indicating copy to clipboard operation
marine copied to clipboard

Incorect target OS handling

Open drgkaleda opened this issue 2 years ago • 0 comments

TL;DR;:

  • Target OS: ArchLinux on x86-64.
  • Problem: marine uses unix target.
  • Expected behaviour: use linux target.

Problem description

I am using kademlia-dht (https://crates.io/crates/kademlia-dht) in my project. But when I'm trying to deploy my project localy with

fluence service repl myService

I get an error:

# Making sure service and modules are downloaded and built...
   Compiling dirs v1.0.5
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dirs-1.0.5/src/lin.rs:41:18
   |
41 |     use std::os::unix::ffi::OsStringExt;
   |                  ^^^^ could not find `unix` in `os`

error[E0432]: unresolved import `unix`
  --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dirs-1.0.5/src/lin.rs:6:5
   |
6  | use unix;
   |     ^^^^ no `unix` in the root
   |
note: found an item that was configured out
  --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dirs-1.0.5/src/lib.rs:22:87
   |
22 | #[cfg(unix)]                                                                      mod unix;
   |                                                                                       ^^^^

error[E0599]: no function or associated item named `from_vec` found for struct `OsString` in the current scope
  --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dirs-1.0.5/src/lin.rs:48:34
   |
48 |     Some(PathBuf::from(OsString::from_vec(out)))
   |                                  ^^^^^^^^ 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:
   |
1  + use std::os::wasi::ffi::OsStringExt;
   |

Some errors have detailed explanations: E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `dirs` (lib) due to 3 previous errors
Error: failed to execute, exited with exit status: 101

Building the same code without marine (cargo build in service directory) works without problem. Getting rid of kademlia-dht crate (commenting it out) solves the problem with marine cross-compiler.

drgkaleda avatar Jan 18 '24 10:01 drgkaleda