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

How to build the project? #1

Open
Bonjourz opened this issue Jul 15, 2020 · 6 comments
Open

How to build the project? #1

Bonjourz opened this issue Jul 15, 2020 · 6 comments

Comments

@Bonjourz
Copy link

Bonjourz commented Jul 15, 2020

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
Copy link

Yourens commented Jul 16, 2020

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
Copy link
Author

Bonjourz commented Jul 16, 2020

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.aaakk.us.kg-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
Copy link

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
Copy link
Author

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
Copy link

Yourens commented Jul 18, 2020

Perhaps this could help:
rust-osdev/linked-list-allocator#20
and this:
rust-lang/rust#68529

@Bonjourz
Copy link
Author

Bonjourz commented Jul 19, 2020

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...

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

3 participants