apache / incubator-teaclave

Apache Teaclave (incubating) is an open source universal secure computing platform, making computation on privacy-sensitive data safe and simple.
https://teaclave.apache.org
Apache License 2.0
765 stars 158 forks source link

Teaclave build error where the rust-sgx-sdk version upgrate to 1.1.4 #655

Closed itux2 closed 1 year ago

itux2 commented 2 years ago

hi, I built teaclave in ubuntu os 20.04, I want to upgrade the teaclave rust sgx sdk to version v1.1.4, then I modify the toml files for examples, the Cargo.sgx_trusted_lib.toml file modified as follows


sgx_alloc         = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_build_helper  = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_cov           = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_libc          = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_rand          = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_tcrypto       = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_tprotected_fs = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_trts          = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_tse           = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_tstd          = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_types         = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_unwind        = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }
sgx_urts          = { git = "https://github.com/apache/teaclave-sgx-sdk", rev = "v1.1.4" }

then I built the system in sim mode , but get errors as follows:

   [ 36%] Building sgxlib-teaclave_functional_tests, enclave info to /home/admin/dev/incubator-teaclave/build/intermediate/teaclave_functional_tests_enclave_info.toml
    Updating git repository `https://github.com/apache/teaclave-sgx-sdk`
   Compiling cc v1.0.71
   Compiling sgx_build_helper v0.1.3 (https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e6)
   Compiling sgx_types v1.1.3 (https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e6)
   Compiling sgx_tstd v1.1.3 (https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e6)
   Compiling sgx_demangle v1.1.3 (https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e6)
   Compiling sgx_alloc v1.1.3 (https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e6)
   Compiling hashbrown_tstd v0.9.0 (https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e6)
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling sgx_build_helper v1.1.4 (https://github.com/apache/teaclave-sgx-sdk?rev=v1.1.4#a1dd9769)
   Compiling sgx_types v1.1.4 (https://github.com/apache/teaclave-sgx-sdk?rev=v1.1.4#a1dd9769)
   Compiling spin v0.5.2
   Compiling cfg-if v0.1.10
   Compiling serde_derive v1.0.118 (https://github.com/mesalock-linux/serde-sgx#db0226f1)
   Compiling serde v1.0.118 (https://github.com/mesalock-linux/serde-sgx#db0226f1)
   Compiling getrandom v0.1.14 (https://github.com/mesalock-linux/getrandom-sgx#0aa9cc20)
   Compiling sgx_tstd v1.1.4 (https://github.com/apache/teaclave-sgx-sdk?rev=v1.1.4#a1dd9769)
   Compiling autocfg v0.1.7
   Compiling sgx_demangle v1.1.4 (https://github.com/apache/teaclave-sgx-sdk?rev=v1.1.4#a1dd9769)
   Compiling untrusted v0.7.1
   Compiling hashbrown_tstd v0.11.2 (https://github.com/apache/teaclave-sgx-sdk?rev=v1.1.4#a1dd9769)
   Compiling sgx_alloc v1.1.4 (https://github.com/apache/teaclave-sgx-sdk?rev=v1.1.4#a1dd9769)
   Compiling log v0.4.14 (https://github.com/mesalock-linux/log-sgx#2ca9039a)
   Compiling ryu v1.0.5
   Compiling matches v0.1.8 (https://github.com/mesalock-linux/rust-std-candidates-sgx#5747bcf3)
   Compiling libc v0.2.105
   Compiling ppv-lite86 v0.2.6 (https://github.com/mesalock-linux/cryptocorrosion-sgx#32d7de50)
   Compiling cfg-if v1.0.0
   Compiling rand_core v0.4.2
   Compiling serde_json v1.0.60 (https://github.com/mesalock-linux/serde-json-sgx#38089381)
   Compiling percent-encoding v2.1.0 (https://github.com/mesalock-linux/rust-url-sgx#23832f31)
   Compiling autocfg v1.0.1
   Compiling teaclave_config v0.4.0 (/home/admin/dev/incubator-teaclave/build/cmake_tomls/sgx_trusted_lib/config)
   Compiling proc-macro2 v0.4.30
   Compiling httparse v1.5.1
   Compiling unicode-xid v0.1.0
   Compiling hashbrown v0.3.1
   Compiling bit-vec v0.6.3
   Compiling syn v0.15.44
   Compiling either v1.6.1
   Compiling quick-error v1.2.2 (https://github.com/mesalock-linux/quick-error-sgx#468bf2cc)
   Compiling inventory v0.1.10
   Compiling anyhow v1.0.28 (https://github.com/mesalock-linux/anyhow-sgx#9b7763f5)
   Compiling teaclave_binder v0.4.0 (/home/admin/dev/incubator-teaclave/build/cmake_tomls/sgx_trusted_lib/binder)
   Compiling teaclave_proto v0.4.0 (/home/admin/dev/incubator-teaclave/build/cmake_tomls/sgx_trusted_lib/services/proto)
error[E0432]: unresolved import `core::alloc::Allocator`
  --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_alloc/src/system.rs:25:31
   |
25 | use core::alloc::{AllocError, Allocator, GlobalAlloc, Layout};
   |                               ^^^^^^^^^
   |                               |
   |                               no `Allocator` in `alloc`
   |                               help: a similar name exists in the module: `AllocError`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `sgx_alloc`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0432]: unresolved import `crate::alloc::alloc::Allocator`
 --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_tstd/hashbrown/src/raw/alloc.rs:6:35
  |
6 |     pub use crate::alloc::alloc::{Allocator, Global};
  |                                   ^^^^^^^^^
  |                                   |
  |                                   no `Allocator` in `alloc`
  |                                   help: a similar name exists in the module: `AllocError`

error[E0432]: unresolved import `self::alloc::Allocator`
  --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_tstd/hashbrown/src/raw/mod.rs:39:40
   |
39 | pub(crate) use self::alloc::{do_alloc, Allocator, Global};
   |                                        ^^^^^^^^^ no `Allocator` in `raw::alloc`

error[E0658]: const generics are unstable
   --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_tstd/hashbrown/src/raw/mod.rs:964:31
    |
964 |     pub fn get_each_mut<const N: usize>(
    |                               ^
    |
    = note: see issue #74878 <https://github.com/rust-lang/rust/issues/74878> for more information
    = help: add `#![feature(min_const_generics)]` to the crate attributes to enable

error[E0658]: const generics are unstable
    --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_tstd/hashbrown/src/map.rs:1138:42
     |
1138 |     pub fn get_each_mut<Q: ?Sized, const N: usize>(
     |                                          ^
     |
     = note: see issue #74878 <https://github.com/rust-lang/rust/issues/74878> for more information
     = help: add `#![feature(min_const_generics)]` to the crate attributes to enable

error[E0658]: const generics are unstable
    --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_tstd/hashbrown/src/map.rs:1197:52
     |
1197 |     pub fn get_each_key_value_mut<Q: ?Sized, const N: usize>(
     |                                                    ^
     |
     = note: see issue #74878 <https://github.com/rust-lang/rust/issues/74878> for more information
     = help: add `#![feature(min_const_generics)]` to the crate attributes to enable

error[E0658]: const generics are unstable
    --> /tmp/teaclave_symlinks.wms5bWc8mmz8/cargo_home/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/a1dd976/sgx_tstd/hashbrown/src/map.rs:1219:44
     |
1219 |     fn get_each_inner_mut<Q: ?Sized, const N: usize>(
     |                                            ^
     |
     = note: see issue #74878 <https://github.com/rust-lang/rust/issues/74878> for more information
     = help: add `#![feature(min_const_generics)]` to the crate attributes to enable

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0432, E0658.
For more information about an error, try `rustc --explain E0432`.
error: build failed
make[2]: *** [CMakeFiles/sgxlib-teaclave_functional_tests.dir/build.make:58: CMakeFiles/sgxlib-teaclave_functional_tests] Error 101
make[1]: *** [CMakeFiles/Makefile2:1450: CMakeFiles/sgxlib-teaclave_functional_tests.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Is there any incompatibility with SDK 1.1.4, and how to fix this error?
the teaclave version i built is v0.4.0.
henrysun007 commented 1 year ago

Rust SGX SDK 1.1.4 is not a version that teaclave supports. Could you please tell us the reason why you want that version? Then we can evaluate whether to support the 1.1.4 version.

henrysun007 commented 1 year ago

Teaclave is now using Rust SGX SDK v2.0.0. I will close this issue as there are no response for months.