Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to build on MacOS? #7

Open
gcavalcante8808 opened this issue May 30, 2019 · 7 comments
Open

Is there any way to build on MacOS? #7

gcavalcante8808 opened this issue May 30, 2019 · 7 comments

Comments

@gcavalcante8808
Copy link

I'm trying to build the unfp on MacOS/Darwin, but following errors was returned:

image

I'm using rustc 1.37.0-nightly (37d001e4d 2019-05-29). Thanks in advance.

@pfpacket
Copy link
Owner

pfpacket commented Jun 1, 2019

macos-fix branch will fix it.
Would you try it out?

@gcavalcante8808
Copy link
Author

@pfpacket Thanks for the response. Ill try it on monday. Thanks for the tip.

@jnoxon
Copy link

jnoxon commented Nov 12, 2019

fails on macos-fix branch with:

   Compiling unpfs v0.0.1 (/Volumes/Dev/rust-9p/example/unpfs)
     Running `rustc --edition=2018 --crate-name unpfs src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=0853013c7702cc9d -C extra-filename=-0853013c7702cc9d --out-dir /Volumes/Dev/rust-9p/example/unpfs/target/release/deps -L dependency=/Volumes/Dev/rust-9p/example/unpfs/target/release/deps --extern env_logger=/Volumes/Dev/rust-9p/example/unpfs/target/release/deps/libenv_logger-98d61231efd42903.rlib --extern filetime=/Volumes/Dev/rust-9p/example/unpfs/target/release/deps/libfiletime-bc98e1c30b76f668.rlib --extern nix=/Volumes/Dev/rust-9p/example/unpfs/target/release/deps/libnix-292b27877362d2b2.rlib --extern rs9p=/Volumes/Dev/rust-9p/example/unpfs/target/release/deps/librs9p-3d4bb29b9aa32668.rlib`
error[E0308]: mismatched types
   --> src/main.rs:211:62
    |
211 |         let omode = nix::sys::stat::Mode::from_bits_truncate(mode);
    |                                                              ^^^^ expected u16, found u32
    |
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
    |
211 |         let omode = nix::sys::stat::Mode::from_bits_truncate(mode.try_into().unwrap());
    |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^

@lf94
Copy link

lf94 commented Jan 3, 2021

Considering rust-9p specifically targets 9p2000.L, which is Linux specific, isn't it expected that building for MacOS won't work?

@pfpacket
Copy link
Owner

pfpacket commented Jan 5, 2021

Considering rust-9p specifically targets 9p2000.L, which is Linux specific, isn't it expected that building for MacOS won't work?

You can run 9P2000.L file servers on macOS and still 9P2000.L clients such as v9fs can connect to them and mount them, which means something.

@lf94
Copy link

lf94 commented Jan 5, 2021

Ah ok, then disregard my comment :)

@LionsAd
Copy link

LionsAd commented Jan 25, 2022

diff --git a/example/unpfs/src/main.rs b/example/unpfs/src/main.rs
index ccd5deb..34f3b2f 100644
--- a/example/unpfs/src/main.rs
+++ b/example/unpfs/src/main.rs
@@ -22,6 +22,8 @@ use {
 mod utils;
 use crate::utils::*;
 
+use std::convert::TryInto;
+
 // Some clients will incorrectly set bits in 9p flags that don't make sense.
 // For exmaple, the linux 9p kernel client propagates O_DIRECT to TCREATE and TOPEN
 // and from there to the server.
@@ -258,7 +260,7 @@ impl Filesystem for Unpfs {
             realpath.join(name)
         };
         let oflags = nix::fcntl::OFlag::from_bits_truncate((flags & UNIX_FLAGS) as i32);
-        let omode = nix::sys::stat::Mode::from_bits_truncate(mode);
+        let omode = nix::sys::stat::Mode::from_bits_truncate(mode.try_into().unwrap());
         let fd = nix::fcntl::open(&path, oflags, omode)?;
 
         let qid = get_qid(&path).await?;

fixes the Mac build :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants