initc3 / nix-sgx-sdk

Experimental nix derivation for Intel's SGX SDK.
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

[rust-sgx-sdk] error: failed to get `sgx_tstd` as a dependency of package ... #6

Open sbellem opened 3 years ago

sbellem commented 3 years ago

Happening in "pure" mode, which more closely resembles nix-build conditions.

To reproduce:

bash-4.4# nix-shell --pure rust-sgx-sdk.nix 

[nix-shell:/usr/src]# unpackPhase 
unpacking source archive /nix/store/bqb9zhdb1mas9f7glph5kx38nyl3vxpk-source
source root is source

[nix-shell:/usr/src]# cd source/

[nix-shell:/usr/src/source]# buildPhase 
build flags: SHELL=/bin/bash bin/enclave.signed.so
make -C ./enclave/
make[1]: Entering directory '/usr/src/source/samplecode/helloworld/enclave'
cargo build --release
    Updating git repository `https://github.com/apache/teaclave-sgx-sdk.git`
error: failed to get `sgx_tstd` as a dependency of package `Helloworldsampleenclave v1.0.0 (/usr/src/source/samplecode/helloworld/enclave)`

Caused by:
  failed to load source for dependency `sgx_tstd`

Caused by:
  Unable to update https://github.com/apache/teaclave-sgx-sdk.git

Caused by:
  failed to fetch into: /root/.cargo/git/db/teaclave-sgx-sdk-be25c2ad2f03718d

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  the SSL certificate is invalid; class=Ssl (16); code=Certificate (-17)
make[1]: *** [Makefile:36: libenclave.a] Error 101
make[1]: Leaving directory '/usr/src/source/samplecode/helloworld/enclave'
make: *** [Makefile:165: enclave] Error 2
sbellem commented 2 years ago

Running into this issue.

Adding the following helps to overcome the issue with the $HOME variable, but ...

  preConfigure = ''
    export HOME=`mktemp -d`
    mkdir -p $HOME/.cargo/
    touch $HOME/.cargo/.package-cache
  '';

I then run into a new issue:

cargo build --release
    Updating git repository `https://github.com/apache/teaclave-sgx-sdk.git`
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Name or service not known; class=Net (12)
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Name or service not known; class=Net (12)
error: failed to get `sgx_tstd` as a dependency of package `Helloworldsampleenclave v1.0.0 (/build/source/samplecode/helloworld/enclave)`

Caused by:
  failed to load source for dependency `sgx_tstd`

Caused by:
  Unable to update https://github.com/apache/teaclave-sgx-sdk.git

Caused by:
  failed to clone into: /build/tmp.m9cLNARKZC/.cargo/git/db/teaclave-sgx-sdk-be25c2ad2f03718d

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  failed to resolve address for github.com: Name or service not known; class=Net (12)
sbellem commented 2 years ago

See https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#vendoring-of-dependencies-vendoring-of-dependencies

sbellem commented 2 years ago

https://github.com/NixOS/nixpkgs/issues/89526