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

Unable to use bit-vec third party crate #31

Closed
mskd12 opened this issue Aug 15, 2018 · 1 comment
Closed

Unable to use bit-vec third party crate #31

mskd12 opened this issue Aug 15, 2018 · 1 comment

Comments

@mskd12
Copy link

mskd12 commented Aug 15, 2018

I am unable to use the bit-vec crate inside the enclave. Here is what I am doing currently.

Cargo.toml:

bit-vec = { path = "../../../third_party/bit-vec"}

lib.rs:

extern crate bit_vec;

I am seeing the error below:

error: duplicate lang item in crate `std`: `f32_runtime`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `std`: `f64_runtime`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `std`: `panic_impl`.
  |
  = note: first defined in crate `sgx_tstd`.

error: duplicate lang item in crate `std`: `oom`.
  |
  = note: first defined in crate `sgx_trts`.

error: aborting due to 4 previous errors

error: Could not compile `dcnetenclave`.                                                                                                                                                                                                                                           

Please suggest how to fix/ workaround this bug.

@dingelish
Copy link
Contributor

dingelish commented Aug 15, 2018

Hi @mskd12 ,

The above failure indicates that your dependencies bring std into the no_std environment. According to your usage of bit_vec, the default feature is enabled in your project. Thus bit-vec would depends on std::vec::Vec instead of alloc::vec::Vec. However, the default libstd cannot work together with sgx_tstd as std.

To solve this, there are two options:
(1) use xargo instead of cargo. In our sample projects, you can use XARGO_SGX=1 make to use xargo. Attention: please rustup component add rust-src and cargo install xargo.
(2) Disable the default feature of bit_vec, which would make it a no_std crate. Sample usage is either

[dependencies.bit-vec]
path = "../../third_party/bit-vec"
default-features = false

or

[dependencies]
bit-vec = { path = "../../third_party/bit-vec", default-features = false }

Then you could make which invoke cargo smoothly.
Best,
Yu

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

2 participants