Closed lythesia closed 8 months ago
Which sample did you build? Make sure you include:
extern crate sgx_types
to declare the dependency.
Which sample did you build? Make sure you include:
extern crate sgx_types
to declare the dependency.
not particular one, you can just put this snip to helloworld sample and compile (base64 line not matter, can remove)
yes, I tried add or remove extern crate sgx_types
at head of lib.rs, neither helps
Did you include this in your Cargo.toml
[target.'cfg(not(target_vendor = "teaclave"))'.dependencies]
sgx_types = { git = "REPO_ADDRESS", branch = "BRANCH_NAME" }
I cloned repo to local and import with sgx_types = { path = ".." }
hi, I tried again based on helloworld sample, it works well, but this example use very few deps and features
hellworld sample, Cargo.toml of enclave
[target.'cfg(not(target_vendor = "teaclave"))'.dependencies]
sgx_types = { path = "../../../sgx_types" }
sgx_tstd = { path = "../../../sgx_tstd" }
sgx_crypto = { path = "../../../sgx_crypto" } # added
and no features enabled for sysroot Rust_Std_Features :=
head lines in lib.rs:
#![cfg_attr(not(target_vendor = "teaclave"), no_std)]
#![cfg_attr(target_vendor = "teaclave", feature(rustc_private))]
#[cfg(not(target_vendor = "teaclave"))]
#[macro_use]
extern crate sgx_tstd as std;
extern crate sgx_types;
regarding my demo (based on hyper-rustls-https-server actually), Cargo.toml of enclave
[dependencies]
sgx_libc = { path = "../../incubator-teaclave-sgx-sdk/sgx_libc" }
sgx_types = { path = "../../incubator-teaclave-sgx-sdk/sgx_types" }
sgx_crypto = { path = "../../incubator-teaclave-sgx-sdk/sgx_crypto" }
tokio = { version = "1.0", features = ["macros", "net", "rt-multi-thread"] }
jsonrpsee-http-server = "0.15.1"
base64 = "0.21.7"
features enabled: Rust_Std_Features := --features backtrace,net,thread,untrusted_time,untrusted_fs,unsupported_process,capi
(added some)
head lines in lib.rs (exact same with hyper sample):
extern crate sgx_libc;
extern crate sgx_types;
and this one got compile error as posted
I noticed the head lines difference of the two, but not very clear about what it means
also I tried adding sgx_tstd dep and replace the above head lines with exact same lines in helloword example (with other imports fixed), got same compile error still
got some findings by comparing cargo tree
output of both
the fix is to remove sgx_types
from Cargo.toml (and still need extern crate sgx_types
), though I don't know why this import makes rustc see two copies of sgx_types code :(
Did you include this in your
Cargo.toml
[target.'cfg(not(target_vendor = "teaclave"))'.dependencies] sgx_types = { git = "REPO_ADDRESS", branch = "BRANCH_NAME" }
I kind of know why here's cfg, which is defined in the target spec file, so it's not imported when building enclave crate
still don't know how rustc find sgx_types
w/o actually import it (in a explicit way), but I thinks it's rust question not teaclave's, I'll close this one, many thanks!
I'm using v2.0.0-preview branch to play with demo, code snip as following: (using sgx_types and sgx_crypto)
rustc fails with
I'm confused
SgxStatus
is defined in single local crate, it cannot be imported as multiple versions? and I tried to mimic this to minimal reproducible case with std codes (manually written), but it just compiles and runsNo idea what causes this, can you help?