fortanix / rust-sgx

The Fortanix Rust Enclave Development Platform
https://edp.fortanix.com
Mozilla Public License 2.0
434 stars 98 forks source link

How-to build fortanix-sgx-tools & sgxs-tools from source? #387

Closed sbellem closed 2 years ago

sbellem commented 2 years ago

Do you have any documentation on how to build fortanix-sgx-tools and sgxs-tools from source?

raoulstrackx commented 2 years ago

A simple cargo build should do it. What problems are you running into?

sbellem commented 2 years ago

Thanks for getting back quickly!

I get the problem for earlier versions, notably fortanix-sgx-tools_v0.4.0 and sgsx-tools_v0.8.2, with relatively newer nightly toolchains (e.g. 2021-11-04), so I guess it is a mismatch problem with the (fortanix) version and toolchain.

The error I got is

error[E0658]: `cfg(target_abi)` is experimental and subject to change                                                          
 --> enclave-runner/src/usercalls/mod.rs:7:21                                                                                  
  |                                                            
7 | #[cfg(all(unix, not(target_abi = "musl")))]                
  |                     ^^^^^^^^^^^^^^^^^^^                    
  |                                                            
  = note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information                               
  = help: add `#![feature(cfg_target_abi)]` to the crate attributes to enable

But it's okay, as I can build more recent versions.

On a related note, is that correct to assume that a nightly toolchain is always needed?

raoulstrackx commented 2 years ago

Yes changes to the Rust compiler may also affect some of the crates. Currently you need a nightly toolchain at least until Rust 1.59 is released (see #369). As you can build more recent version, I'm closing this issue. For people reading this issue in order to solve their own problem: you may want to have a look at our CI at <repo root>/.travis.yml.

jethrogb commented 2 years ago
 --> enclave-runner/src/usercalls/mod.rs:7:21                                                                                  
  |                                                            
7 | #[cfg(all(unix, not(target_abi = "musl")))]                

I'm not able to find this source line in this file?

jethrogb commented 2 years ago

Reverted 1.5 years ago in #269. Have we not released since?

sbellem commented 2 years ago

I was working with https://github.com/fortanix/rust-sgx/tree/fortanix-sgx-tools_v0.4.0, as it was the version a project relied on.

https://github.com/fortanix/rust-sgx/blob/f61f0ecfd34da1acbf9a513db1f7a21fa473c33f/enclave-runner/src/usercalls/mod.rs#L7