occlum / reproduce-asplos20

2 stars 3 forks source link

How to build the project? #1

Open Bonjourz opened 4 years ago

Bonjourz commented 4 years ago

Hi, I try to build the MPX enabled occlum on my machine. But I meet numerous error by running your script... Is there any instructions to guide users to build the project?

I build the project by running the scripts prepare.sh and download_and_build_libos.sh. When I run the download_and_build_libos.sh, the command make RELEASE=1 causes following error:

error[E0432]: unresolved import 'core::alloc::Alloc'
 --> /root/reproduce-occlum/libos/deps/rust-sgx-sdk/sgx_alloc/src/lib.rs:42:32
   |
42 | use core::alloc::{GlobalAlloc, Alloc, AllocErr, Layout};
 |                                ^^^^^ no 'Alloc' in 'alloc'

It seems the versions for the library is too old. I am a rust novice, and cannot find solutions on the Internet. Do you know how to fix it?

I build the project in docker by running docker run --privileged -it --device /dev/isgx occlum/occlum:0.13.1-ubuntu18.04, and the rust version can be shown by running:

$ rustc --version
$ rustc 1.44.0-nightly (6dee5f112 2020-04-06)
Yourens commented 4 years ago

Maybe you can try 16.04. The version of Rust is set in the script. Also, about how to use this repo, you can check the "Artifact Appendix" in our paper.

Bonjourz commented 4 years ago

I follow the "Artifact Appendix" in your paper to build the project. I build it on Ubuntu 16.04, the kernel version is 4.15.0-29-generic. When I run the download_and_build_libos.sh, the command make submodule causes following error:

make[1]: Entering directory '/home/my-pc/reproduce-asplos20/libos/deps/sefs/sefs-fuse'
    Updating crates.io index
error: failed to select a version for the requirement `bitvec = "^0.9"`
  candidate versions found which didn't match: 0.17.4
  location searched: crates.io index
required by package `rcore-fs-sefs v0.1.0 (/home/my-pc/reproduce-asplos20/libos/deps/sefs/rcore-fs-sefs)`
    ... which is depended on by `app v1.0.0 (/home/my-pc/reproduce-asplos20/libos/deps/sefs/sefs-fuse/app)`
Makefile:142: recipe for target 'bin/app' failed
make[1]: *** [bin/app] Error 101

It seems the version of bitvec library mismatches. Then I follow the issues and apply the modifications. Then it causes following errors:

error[E0658]: use of unstable library feature 'alloc': this library is unlikely to be stabilized in its current form or name (see issue #27783)
  --> /home/my-pc/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.17.4/src/lib.rs:37:1
   |
37 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(alloc)] to the crate attributes to enable

Do you know how to fix it?

wangrunji0408 commented 4 years ago

The new bitvec requires new Rust nightly toolchain, where #![feature(alloc)] is no longer needed.

Try to update nightly version to 1.36.0 or later.

Bonjourz commented 4 years ago

I change the version to nightly 1.46.0. Then I get following error when running the command make RELEASE=1 in download_and_build_libos.sh:

error[E0432]: unresolved import `core::alloc::Alloc`
  --> /home/my-pc/reproduce-asplos20/libos/deps/rust-sgx-sdk/sgx_alloc/src/lib.rs:42:32
   |
42 | use core::alloc::{GlobalAlloc, Alloc, AllocErr, Layout};
   |                                ^^^^^ no `Alloc` in `alloc`

error: aborting due to previous error
Yourens commented 4 years ago

Perhaps this could help: https://github.com/phil-opp/linked-list-allocator/pull/20 and this: https://github.com/rust-lang/rust/pull/68529

Bonjourz commented 4 years ago

I change the Alloc to AllocRef, and get errors:

error[E0407]: method `alloc_zeroed` is not a member of trait `AllocRef`
  --> /home/my-pc/reproduce-asplos20/libos/deps/rust-sgx-sdk/sgx_alloc/src/lib.rs:62:5
   |
62 | /     unsafe fn alloc_zeroed(&mut self, layout: Layout)
63 | |         -> Result<NonNull<u8>, AllocErr>
64 | |     {
65 | |         NonNull::new(GlobalAlloc::alloc_zeroed(self, layout)).ok_or(AllocErr)
66 | |     }
   | |_____^ not a member of trait `AllocRef`

error[E0407]: method `realloc` is not a member of trait `AllocRef`
  --> /home/my-pc/reproduce-asplos20/libos/deps/rust-sgx-sdk/sgx_alloc/src/lib.rs:74:5
   |
74 | /     unsafe fn realloc(&mut self,
75 | |                       ptr: core::ptr::NonNull<u8>,
76 | |                       layout: Layout,
77 | |                       new_size: usize) -> Result<NonNull<u8>, AllocErr> {
78 | |         NonNull::new(GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size)).ok_or(AllocErr)
79 | |     }
   | |_____^ not a member of trait `AllocRef`

I simply delete the implementation of alloc_zeroed() and realloc() in sgx_alloc/src/lib.rs. After that, I get various error like:

error: cannot find derive macro `Hash` in this scope
  --> /home/my-pc/reproduce-asplos20/libos/deps/rust-sgx-sdk/sgx_tstd/src/time/mod.rs:62:5
   |
62 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
   |                                                       ^^^^

and

error: cannot find derive macro `Debug` in this scope
  --> /home/xinywu/workspace/gbd-dir/reproduce-asplos20/libos/deps/rust-sgx-sdk/sgx_tstd/src/sys_common/backtrace.rs:56:10
   |
95 | #[derive(Clone, Debug)]
   |                 ^^^^^

It seems that simply delete the Debug and Hash in #[derive(...)] works. But I am not sure this is the correct solution...