You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by Edison Lim <no...@github.com> on 2020/03/31 15:55:12 UTC

[apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Stack trace:

```
error[E0432]: unresolved import `core::alloc::AllocRef`
  --> /root/.cargo/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/7f38d08/sgx_alloc/src/system.rs:25:32
   |
25 | use core::alloc::{GlobalAlloc, AllocRef, AllocErr, Layout};
   |                                ^^^^^^^^ no `AllocRef` in `alloc`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `sgx_alloc`.
warning: build failed, waiting for other jobs to finish..
```

Problem appeared recently to a codebase that I've been working on. 

The same problem happen for `samplecode/sealeddate` that has `sgx_alloc` as a dependency. ```sgx_alloc = { path = "../../../sgx_alloc" }```

My code was working a few days ago. Perhaps something recently broke this? 



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by Yu Ding <no...@github.com>.
it seems you're still using old rust-sgx-sdk. could you please try the latest codebase?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611917775

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by Mingshen Sun <no...@github.com>.
What’s your steps to build the project. Can you give me a minimal example? Then I can reproduce your issue. Thanks.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611906188

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by RMheng <no...@github.com>.
Thanks for  your reply.@dingelish. I tried to make [helloworld](https://github.com/apache/incubator-teaclave-sgx-sdk/tree/master/samplecode/helloworld) in samplecode directly but got the same error.I'm confused whether is my network problem prevented the patch's download. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611855440

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by RMheng <no...@github.com>.
I used new rust-sgx-sdk,the error disappeared. Thanks for your patient reply! @dingelish @mssun 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-612002016

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by RMheng <no...@github.com>.
> Turns out that i missed a patch, which caused this issue. Patch fixed it.

Hi,I'm a Rust novice.
How did you download and use the patch to fix it?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611531135

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by RMheng <no...@github.com>.
My intel driver version is 2.6, I run in hardware mode + docker execution.
The  `git log` in my computer is:
```
commit 46837a05facee93622cdf5c3a1d542525c4fce75 
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611904196

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by Mingshen Sun <no...@github.com>.
@RMheng Can you give us more details? Like what version of Intel SDK, Rust version, etc. If possible, you can use the docker to build your first SGX enclave. Thank you so much!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611856465

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by Edison Lim <no...@github.com>.
Closed #212.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#event-3184074623

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by Edison Lim <no...@github.com>.
Turns out that i missed a patch, which caused this issue. Patch fixed it. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-606726507

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by RMheng <no...@github.com>.
I built the project by referencing to [用硬件模式+docker真实执行](https://github.com/dingelish/SGXfail/blob/master/01.md#%E7%94%A8%E7%BA%AF%E8%BD%AF%E4%BB%B6%E6%A8%A1%E5%BC%8Fdocker%E6%A8%A1%E6%8B%9Fsgx%E7%8E%AF%E5%A2%83%E5%AE%9E%E9%AA%8C),then I tried the [helloworld](https://github.com/apache/incubator-teaclave-sgx-sdk/tree/master/samplecode/helloworld), the result of `make` is:
```
make -C ../../sgx_ustdc/ 2> /dev/null
make[1]: Entering directory '/root/sgx/sgx_ustdc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/sgx/sgx_ustdc'
cp ../../sgx_ustdc/libsgx_ustdc.a ./lib
mkdir -p bin
LINK =>  bin/app
make -C ./enclave/
make[1]: Entering directory '/root/sgx/samplecode/helloworld/enclave'
cargo build --release
warning: Patch `sgx_alloc v1.0.9 (/root/sgx/sgx_alloc)` was not used in the crate graph.
Patch `sgx_backtrace v1.0.9 (/root/sgx/sgx_backtrace)` was not used in the crate graph.
Patch `sgx_backtrace_sys v1.0.9 (/root/sgx/sgx_backtrace_sys)` was not used in the crate graph.
Patch `sgx_build_helper v0.1.0 (/root/sgx/sgx_build_helper)` was not used in the crate graph.
Patch `sgx_cov v0.1.0 (/root/sgx/sgx_cov)` was not used in the crate graph.
Patch `sgx_crypto_helper v1.0.9 (/root/sgx/sgx_crypto_helper)` was not used in the crate graph.
Patch `sgx_demangle v1.0.9 (/root/sgx/sgx_demangle)` was not used in the crate graph.
Patch `sgx_libc v1.0.9 (/root/sgx/sgx_libc)` was not used in the crate graph.
Patch `sgx_rand v1.0.9 (/root/sgx/sgx_rand)` was not used in the crate graph.
Patch `sgx_rand_derive v1.0.9 (/root/sgx/sgx_rand_derive)` was not used in the crate graph.
Patch `sgx_serialize v1.0.9 (/root/sgx/sgx_serialize)` was not used in the crate graph.
Patch `sgx_serialize_derive v1.0.9 (/root/sgx/sgx_serialize_derive)` was not used in the crate graph.
Patch `sgx_serialize_derive_internals v1.0.9 (/root/sgx/sgx_serialize_derive_internals)` was not used in the crate graph.
Patch `sgx_tcrypto v1.0.9 (/root/sgx/sgx_tcrypto)` was not used in the crate graph.
Patch `sgx_tcrypto_helper v1.0.9 (/root/sgx/sgx_tcrypto_helper)` was not used in the crate graph.
Patch `sgx_tdh v1.0.9 (/root/sgx/sgx_tdh)` was not used in the crate graph.
Patch `sgx_tkey_exchange v1.0.9 (/root/sgx/sgx_tkey_exchange)` was not used in the crate graph.
Patch `sgx_tprotected_fs v1.0.9 (/root/sgx/sgx_tprotected_fs)` was not used in the crate graph.
Patch `sgx_trts v1.0.9 (/root/sgx/sgx_trts)` was not used in the crate graph.
Patch `sgx_tse v1.0.9 (/root/sgx/sgx_tse)` was not used in the crate graph.
Patch `sgx_tseal v1.0.9 (/root/sgx/sgx_tseal)` was not used in the crate graph.
Patch `sgx_tservice v1.0.9 (/root/sgx/sgx_tservice)` was not used in the crate graph.
Patch `sgx_tstd v1.0.9 (/root/sgx/sgx_tstd)` was not used in the crate graph.
Patch `sgx_tunittest v1.0.9 (/root/sgx/sgx_tunittest)` was not used in the crate graph.
Patch `sgx_types v1.0.9 (/root/sgx/sgx_types)` was not used in the crate graph.
Patch `sgx_unwind v0.0.1 (/root/sgx/sgx_unwind)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
   Compiling sgx_alloc v1.1.1 (https://github.com/baidu/rust-sgx-sdk.git#66aaa288)
   Compiling num-rational v0.2.4
   Compiling hashbrown_tstd v0.7.1 (https://github.com/baidu/rust-sgx-sdk.git#66aaa288)
   Compiling libm v0.2.1
   Compiling rand_chacha v0.1.1
error[E0432]: unresolved import `core::alloc::AllocRef`
  --> /root/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/66aaa28/sgx_alloc/src/system.rs:25:32
   |
25 | use core::alloc::{GlobalAlloc, AllocRef, AllocErr, Layout};
   |                                ^^^^^^^^ no `AllocRef` in `alloc`

error: aborting due to previous error
```
If you couldn't reproce my error, I guess maybe it is my network problem.......
Thanks!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611914351

Re: [apache/incubator-teaclave-sgx-sdk] Unresolved import of AllocRef : sgx_alloc (#212)

Posted by Yu Ding <no...@github.com>.
@RMheng , patch refers to the `patch` section like here:
https://github.com/apache/incubator-teaclave-sgx-sdk/blob/66aaa2888992c63137e87adc688ddedab1181056/samplecode/http_req/enclave/Cargo.toml#L18

Basically, it overwrite the entire dependency tree and redirect those dependencies to the patched sources

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/212#issuecomment-611671648