apache / incubator-teaclave-trustzone-sdk

Teaclave TrustZone SDK enables safe, functional, and ergonomic development of trustlets.
https://teaclave.apache.org
Apache License 2.0
204 stars 58 forks source link

Use openssl/serde in host app #86

Closed syedelec closed 1 year ago

syedelec commented 1 year ago

Hi

I am building a TA and want to use openssl on normal world side, when I add the following in host/Cargo.toml:

openssl = { version = "0.10", features = ["vendored"] }

I have the following error:

> ~/project/tee-rust » make -C examples/new_one/ && make examples-install 
make: Entering directory '/home/syedelec/project/tee-rust/examples/new_one'
make[1]: Entering directory '/home/syedelec/project/tee-rust/examples/new_one/host'
   Compiling proc-macro2 v1.0.43
   Compiling openssl-sys v0.9.75
   Compiling optee-teec-macros v0.2.0 (/home/syedelec/project/tee-rust/optee-teec/macros)
error[E0658]: use of unstable library feature 'proc_macro_is_available'
  --> /home/syedelec/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.43/src/detection.rs:28:21
   |
28 |     let available = proc_macro::is_available();
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #71436 <https://github.com/rust-lang/rust/issues/71436> for more information
   = help: add `#![feature(proc_macro_is_available)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0658`.
error: could not compile `proc-macro2` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
make[1]: *** [Makefile:39: host] Error 101
make[1]: Leaving directory '/home/syedelec/project/tee-rust/examples/new_one/host'
make: *** [Makefile:19: all] Error 2
make: Leaving directory '/home/syedelec/project/tee-rust/examples/new_one'

The same happens if I add manually serde in host/Cargo.toml. I saw that it's supported in serde-rs example. So in order to work with serde, I need to copy the serde-rs example and starts from there otherwise I have the same error.

Thanks

DemesneGH commented 1 year ago

Hi @syedelec ,

openssl = { version = "0.10", features = ["vendored"] }

I have the following error:

It seems proc-macro2 v1.0.43 causes this error. There are some mismatches of dependencies. Pinning the proc-macro2 and quote to the specific version solves this issue:

[dependencies]
libc = "0.2.48"
proto = { path = "../proto" }
optee-teec = { path = "../../../optee-teec" }
openssl = { version = "0.10", features = ["vendored"] }
proc-macro2 = "=1.0.32"
quote = "=1.0.10"

The same happens if I add manually serde in host/Cargo.toml

I tried to add serde = "1.0" in hello_world-rs/host/Cargo.toml and it worked. Suggest running cargo update after updating Cargo.toml. Because some dependencies of openssl may be retained in Cargo.lock when you try the serde case.

syedelec commented 1 year ago

Thanks, it worked! :rocket: