PLSysSec / wave

Verified Wasm runtime
19 stars 6 forks source link

Multiple Errors While Building WaVe #20

Open celinesantosh98 opened 2 months ago

celinesantosh98 commented 2 months ago

Issue: Multiple Errors While Building WaVe

Hi,

My name is Celine, and I am currently pursuing my Master's from Universität des Saarlandes. I am using WaVe as a part of my thesis, and I encountered several errors while trying to clone and build the project.

Clone Failed Error

Initially, I encountered a clone failed error of submodules as they were cloning using SSH keys. I changed the .gitmodules file to use HTTPS URLs, which resolved the cloning issue.

proc_macro_span_shrink Error

Next, I encountered the following error:

error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /Users/celinesantosh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.49/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

I resolved this by commenting out the corresponding line in the file.

Missing File Error

Subsequently, I encountered this error:

error: couldn't read src/os/platform/mac.rs: No such file or directory (os error 2)
  --> src/os/mod.rs:16:1
   |
16 | mod platform;
   | ^^^^^^^^^^^^^

It seems like the file name is macos.rs and in the files Mac.rs was specified. So I changed it to macos.rs in all files which eliminated the error.

Multiple Errors in macos.rs

After that, I got a lot of errors:

error: no rules expected the token `mut`
  --> src/tcb/os_specs/platform/macos.rs:26:37
   |
26 |     syscall(pread, fd: usize, buf: &mut [u8], cnt: usize, offset: usize)
   |                                     ^^^ no rules expected this token in macro call
   |
  ::: src/tcb/os_specs/mod.rs:49:1
   |
49 | macro_rules! syscall_spec_gen {
   | ----------------------------- when calling this macro

error: no rules expected the token `[`
  --> src/tcb/os_specs/platform/macos.rs:34:38
   |
34 |     syscall(pwrite, fd: usize, buf: &[u8], cnt: usize, offset: usize)
   |                                      ^ no rules expected this token in macro call
   |
  ::: src/tcb/os_specs/mod.rs:49:1
   |
49 | macro_rules! syscall_spec_gen {
   | ----------------------------- when calling this macro

error: no rules expected the token `libc`
  --> src/tcb/os_specs/platform/macos.rs:40:43
   |
40 |     syscall(allocate, fd: usize, fstore: &libc::fstore_t)
   |                                           ^^^^ no rules expected this token in macro call
   |
  ::: src/tcb/os_specs/mod.rs:49:1
   |
49 | macro_rules! syscall_spec_gen {
   | ----------------------------- when calling this macro

error: no rules expected the token `mut`
  --> src/tcb/os_specs/platform/macos.rs:47:63
   |
47 |     syscall(fstatat64, dirfd: usize, path: [u8; 4096], stat: &mut libc::stat, flags: i32)
   |                                                               ^^^ no rules expected this token in macro call
   |
  ::: src/tcb/os_specs/mod.rs:49:1
   |
49 | macro_rules! syscall_spec_gen {
   | ----------------------------- when calling this macro

error: no rules expected the token `Vec`
  --> src/tcb/os_specs/platform/macos.rs:54:42
   |
54 |     syscall(futimens, fd: usize, specs: &Vec<libc::timespec>)
   |                                          ^^^ no rules expected this token in macro call
   |
  ::: src/tcb/os_specs/mod.rs:49:1
   |
49 | macro_rules! syscall_spec_gen {
   | ----------------------------- when calling this macro

error: no rules expected the token `mut`
  --> src/tcb/os_specs/platform/macos.rs:90:37
   |
90 |     syscall(gettimeofday, timeval: &mut libc::timeval, zero: usize)
   |                                     ^^^ no rules expected this token in macro call
   |
  ::: src/tcb/os_specs/mod.rs:49:1
   |
49 | macro_rules! syscall_spec_gen {
   | ----------------------------- when calling this macro

error: no rules expected the token `mut`
   --> src/tcb/os_specs/platform/macos.rs:125:34
    |
125 |     syscall(rusageself, rusage: &mut libc::rusage)
    |                                  ^^^ no rules expected this token in macro call
    |
   ::: src/tcb/os_specs/mod.rs:49:1
    |
49  | macro_rules! syscall_spec_gen {
    | ----------------------------- when calling this macro

error: no rules expected the token `)`
   --> src/tcb/os_specs/platform/macos.rs:134:29
    |
134 |     syscall(thread_selfusage)
    |                             ^ no rules expected this token in macro call
    |
   ::: src/tcb/os_specs/mod.rs:49:1
    |
49  | macro_rules! syscall_spec_gen {
    | ----------------------------- when calling this macro

error: no rules expected the token `mut`
   --> src/tcb/os_specs/platform/macos.rs:220:52
    |
220 |     syscall(fstat64 ALIAS fstat, fd: usize, stat: &mut libc::stat)
    |                                                    ^^^ no rules expected this token in macro call
    |
   ::: src/tcb/os_specs/mod.rs:49:1
    |
49  | macro_rules! syscall_spec_gen {
    | ----------------------------- when calling this macro

error[E0432]: unresolved import `core::arch::x86_64`
 --> src/stats/timing.rs:1:17
  |
1 | use core::arch::x86_64::{__cpuid_count, __rdtscp, _rdtsc};
  |                 ^^^^^^ could not find `x86_64` in `arch`

error[E0425]: cannot find function `os_allocate` in this scope
  --> src/os/platform/macos.rs:53:13
   |
53 |     let r = os_allocate(os_fd, &fstore);
   |             ^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_gettimeofday` in this scope
  --> src/os/platform/macos.rs:78:23
   |
78 |             let ret = os_gettimeofday(&mut tv);
   |                       ^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_gettimeofday` in this scope
  --> src/os/platform/macos.rs:99:23
   |
99 |             let ret = os_gettimeofday(&mut real_tv);
   |                       ^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_rusageself` in this scope
   --> src/os/platform/macos.rs:113:23
    |
113 |             let ret = os_rusageself(&mut ru);
    |                       ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_thread_selfusage` in this scope
   --> src/os/platform/macos.rs:129:23
    |
129 |             let ret = os_thread_selfusage();
    |                       ^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_pread` in this scope
   --> src/os/mod.rs:124:13
    |
124 |     let r = os_pread(os_fd, slice, cnt, offset);
    |             ^^^^^^^^ help: a function with a similar name exists: `os_preadv`
    |
   ::: src/tcb/os_specs/mod.rs:60:13
    |
60  |             pub fn [<os_ $name>]($($arg: $type),*) -> isize {
    |             ----------------------------------------------- similarly named function `os_preadv` defined here

error[E0425]: cannot find function `os_pwrite` in this scope
   --> src/os/mod.rs:254:13
    |
254 |     let r = os_pwrite(os_fd, slice, cnt, offset);
    |             ^^^^^^^^^ help: a function with a similar name exists: `os_pwritev`
    |
   ::: src/tcb/os_specs/mod.rs:60:13
    |
60  |             pub fn [<os_ $name>]($($arg: $type),*) -> isize {
    |             ----------------------------------------------- similarly named function `os_pwritev` defined here

error[E0425]: cannot find function `os_fstat` in this scope
   --> src/os/mod.rs:302:13
    |
302 |     let r = os_fstat(os_fd, stat);
    |             ^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_fstatat` in this scope
   --> src/os/mod.rs:322:13
    |
322 |     let r = os_fstatat(os_fd, path, stat, flags);
    |             ^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `os_futimens` in this scope
   --> src/os/mod.rs:512:13
    |
512 |       let r = os_futimens(os_fd, specs);
    |               ^^^^^^^^^^^ help: a function with a similar name exists: `os_utimensat`
    |
   ::: src/tcb/os_specs/platform/macos.rs:63:1
    |
63  | / pub fn os_utimensat(
64  | |     dirfd: usize,
65  | |     path: [u8; 4096],
66  | |     specs: &Vec<libc::timespec>,
...   |
84  | |     }
85  | | }
    | |_- similarly named function `os_utimensat` defined here

error[E0425]: cannot find value `PREADV` in module `syscall::nr`
   --> src/tcb/os_specs/mod.rs:63:48
    |
63  |                   let result = unsafe { syscall!([<$name:upper>], $(arg_converter!($arg: $type)),*) as isize };
    |                                                  ^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `PREAD`
...
156 | / syscall_spec_gen! {
157 | |     trace;
158 | |     ensures((
159 | |         trace.len() == old(trace.len() + buf.len()) &&
...   |
173 | |     syscall(preadv, fd: usize, buf: (&NativeIoVecs), iovcnt: usize, offset: usize)
174 | | }
    | |_- in this macro invocation
    |
   ::: /Users/celinesantosh/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/macos-aarch64/nr.rs:109:1
    |
109 |   pub const PREAD: usize = 153;
    |   ----------------------------- similarly named constant `PREAD` defined here
    |
    = note: this error originates in the macro `syscall_spec_gen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find value `PWRITEV` in module `syscall::nr`
   --> src/tcb/os_specs/mod.rs:63:48
    |
63  |                   let result = unsafe { syscall!([<$name:upper>], $(arg_converter!($arg: $type)),*) as isize };
    |                                                  ^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `PWRITE`
...
176 | / syscall_spec_gen! {
177 | |     trace;
178 | |     ensures((
179 | |         trace.len() == old(trace.len() + buf.len()) &&
...   |
193 | |     syscall(pwritev, fd: usize, buf: (&NativeIoVecs), iovcnt: usize, offset: usize)
194 | | }
    | |_- in this macro invocation
    |
   ::: /Users/celinesantosh/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/macos-aarch64/nr.rs:110:1
    |
110 |   pub const PWRITE: usize = 154;
    |   ------------------------------ similarly named constant `PWRITE` defined here
    |
    = note: this error originates in the macro `syscall_spec_gen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find function `syscall5` in crate `syscall`
   --> src/tcb/os_specs/mod.rs:228:1
    |
228 | / syscall_spec_gen! {
229 | |     trace;
230 | |     ensures((effects!(old(trace), trace, effect!(FdAccess),
231 | |         effect!(FdAccess),
...   |
235 | |     syscall(linkat, old_fd: usize, old_path: [u8; 4096], new_fd: usize, new_path: [u8; 4096], flags: i32)
236 | | }
    | |_^ help: a function with a similar name exists: `syscall0`
    |
   ::: /Users/celinesantosh/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/macos-aarch64/mod.rs:7:1
    |
7   |   pub unsafe fn syscall0(n: usize) -> usize {
    |   ----------------------------------------- similarly named function `syscall0` defined here
    |

Any help would be appreciated Thanks

enjhnsn2 commented 2 months ago

Clone Failed Error: yes, it is very intentional that we are using the .git links for the repo: they make it easier for contributors to push changes since everything is done through ssh keys (I recommend doing everything on github with ssh keys, it makes life much easier)

Missing File Error: Ya, sorry about that, I think the mac filename was renamed at some point, I'll fix that.

I'll take a look at the other mac issues you have, but it seems that proc_macro is using the wrong version on mac (?). I can't promise that I'll look at this immediately since I don't have a mac machine to test on.

Tbh, the easiest fix would just be to use linux, which I test often and know to work.

celinesantosh98 commented 2 months ago

Build Errors from Dockerfile in WaVe Repository

Thank you for your previous reply. When trying to build the image using the Dockerfile from the WaVe repository, the following build errors were encountered:

1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2    --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:100:5
1908.2     |
1908.2 100 |     llvm_asm!("svc 0"
1908.2     |     ^^^^^^^^
1908.2 
1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2   --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:83:5
1908.2    |
1908.2 83 |     llvm_asm!("svc 0" : "={x0}"(ret)
1908.2    |     ^^^^^^^^
1908.2 
1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2   --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:66:5
1908.2    |
1908.2 66 |     llvm_asm!("svc 0"
1908.2    |     ^^^^^^^^
1908.2 
1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2   --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:50:5
1908.2    |
1908.2 50 |     llvm_asm!("svc 0"
1908.2    |     ^^^^^^^^
1908.2 
1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2   --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:39:5
1908.2    |
1908.2 39 |     llvm_asm!("svc 0"
1908.2    |     ^^^^^^^^
1908.2 
1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2   --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:28:5
1908.2    |
1908.2 28 |     llvm_asm!("svc 0"
1908.2    |     ^^^^^^^^
1908.2 
1908.2 error: cannot find macro `llvm_asm` in this scope
1908.2   --> /root/.cargo/git/checkouts/system-call.rs-d3ba18a5a1a818aa/5161ba2/src/platform/linux-aarch64/mod.rs:17:5
1908.2    |
1908.2 17 |     llvm_asm!("svc 0"
1908.2    |     ^^^^^^^^
1908.2 
1908.3 error: could not compile `system-call` due to 7 previous errors
1908.3 warning: build failed, waiting for other jobs to finish...
1911.4 error: build failed
1911.4 make: *** [Makefile:15: bootstrap] Error 101
------
Dockerfile:30
--------------------
  28 |     RUN git clone git@github.com:PLSysSec/wave.git
  29 |     WORKDIR /wave
  30 | >>> RUN make bootstrap
  31 |     RUN make build
  32 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c make bootstrap" did not complete successfully: exit code: 2

Thanks in advance.

enjhnsn2 commented 2 months ago

Hmm, I haven't been able to reproduce this, what architecture are you running on?

celinesantosh98 commented 2 months ago

Mac OS Ventura version 13.5.2, apple M1 chip, arm64

is this executable on this environment?