When I followed the instruction(https://github.com/dmlc/tvm/tree/master/apps/sgx) to run the SGX demo with docker, I successfully pulled the docker image and entered the container, but when I use the make -j4 command, I got a fatal error:
fatal error: inc/stat.h: No such file or directory
Hi, I’ve hit this issue before myself. My recollection is that:
The docker build runs ubuntu_install_sgx.sh to install SGX. This script installs two different components:
/opt/sgxsdk
and
/opt/rust-sgx-sdk/
The inc/stat.h file appears to be installed as /opt/rust-sgx-sdk/edl/inc/stat.h.
However in the build system cmake/modules/SGX.cmake has an include_directories declaration that adds $USE_SGX/include but not $RUST_SGX_SDK/edl hence the build fails to find stat.h in the installed location.
It is simple to add ${USE_SGX}/edl to the include_directories directive, but I’m not sure if this is a correct solution, specifically I’m not sure if /opt/sgxsdk is supposed to be exposing a stat.h and that for some reason it is missing from the install.
Thank you so much! @mjs
I don’t understand what you mean by “add ${USE_SGX}/edl to the include_directories”, I made a attempt by adding the code -I${USE_SGX}/edl \, into the 44th line of makefile in tvm/apps/sgx.
but I when I paste the command
cmake .. -DUSE_LLVM=ON -DUSE_SGX=/opt/sgxsdk -DRUST_SGX_SDK=/opt/rust-sgx-sdk
I got the error
CMake Error: The source directory “/” does not appear to contain CMakeLists.txt.Specify --help for usage, or press the help button on the CMake GUI.
I did’t see the error in the first time when running the command.
then I paste
make -j4
and got the same error
fatal error: inc/stat.h: No such file or directory
Can you give me a detailed step of how to add ${USE_SGX}/edl to the include_directories, I am new to TVM.
Thank you!
Hey @xplorer, my sincerest apologies for not replying sooner. I’ve been unusually hosed these last few weeks. I think that you may have found a bug in the current TVM SGX implementation. My suggestion would be to run git checkout d08941f and try running the commands in the SGX README from there. (d08941f is the commit before the frontend was merged). Please let me know if that doesn’t work. Note that, if you need Relay, you can compile the Relay module graph/lib/params using a newer version of TVM and build the enclave using the old version of TVM.
In any case, rust-sgx-sdk is less preferable now that the fortanix sgx target has been upstreamed to rustc, itself. I think that I’ll take a whack at porting the sgx build soon. That’ll make the build process much much less brittle.
Thank you very much !@nhynes@xplorer
I have downloaded the new version of TVM and run the readme command again. Everything goes well but the last command ./run_example.sh,
The issue now is that the runtime fails to compile under SGX now that the frontend is also in there.
Since tvm#2878 has been merged, you can use tvm:master again if you modify apps/sgx/enclave/Cargo.toml:
I’m looking forward to properly fixing up the TVM SGX integration in the coming days, but hopefully this patch gets you going in the meantime. Many thanks for your extreme patience!
Thank you! You have helped me too much! But sorry, I faced a new problem@nhynes
I have git clone a new version of tvm and modified nothing, before I uesd the ./run_example.sh command, I run git checkout d08941f and it seems that I have succeesfully build everything. But there is a python error in the following:
AttributeError: type object ‘tvm._ffi._cy3.core.NodeBase’ has no attribute 'reduce_cython’
Thanks @nhynes and @wuzhiyu666 for your help with this issue!
Unfortunately, testing with the TVM d08941f version didn’t work for me, and it had the same error as before, despite rebuilding everything from scratch and clearing any Docker caches.
Executing the instructions using the latest TVM version was successful for the build steps, but not when running the example ./run_example.sh. This is the error I am getting this time:
OSError: /mnt/build/libtvm.so: undefined symbol: tvm_ecall_packed_func
So, the fix to that error is to build the TVM that’s providing the python library using SGX (so basically build TVM master with SGX). You still need to use the old TVM as the rust dependency.