Three issues for building
ohsai opened this issue · 2 comments
I have attempted to build this in Ubuntu 16.04 LTS by following your build guideline, but found 3 errors.
- When executing ´make´ in SGXDNN directory, This error occurs.
g++ -MT bin/sgxdnn_main.o -MMD -MP -MF .d/sgxdnn_main.Td -std=c++11 -fPIC -I../Include/eigen -I../Include -Icrypto -O3 -march=native -Wno-enum-compare -fopenmp -c sgxdnn_main.cpp -o bin/sgxdnn_main.o -pthread
In file included from sgxdnn_main.cpp:13:0:
layers/eigen_maxpool.h:13:42: fatal error: unsupported/Eigen/CXX11/Tensor: No such file or directory
compilation terminated.
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
On Makefile in SGXDNN directory, g++ include path must be ../Include/eigen3_sgx , not ../Include/eigen
- After fixing it, ´make´ in SGXDNN directory brings this error.
g++ -MT bin/sgxdnn_main.o -MMD -MP -MF .d/sgxdnn_main.Td -std=c++11 -fPIC -I../Include/eigen3_sgx -I../Include -Icrypto -O3 -march=native -Wno-enum-compare -fopenmp -c sgxdnn_main.cpp -o bin/sgxdnn_main.o -pthread
In file included from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool:60:0,
from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/Tensor:72,
from layers/eigen_maxpool.h:13,
from sgxdnn_main.cpp:13:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h:13:24: fatal error: sgx_thread.h: No such file or directory
compilation terminated.
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
make: *** [bin/sgxdnn_main.o] Error 1
You need to fix as following. (I just brought git diff)
--- a/Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
+++ b/Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
@@ -10,7 +10,8 @@
#ifndef EIGEN_CXX11_THREADPOOL_NONBLOCKING_THREAD_POOL_H
#define EIGEN_CXX11_THREADPOOL_NONBLOCKING_THREAD_POOL_H
-#include "sgx_thread.h"
+//#include "sgx_thread.h"
--- a/Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool
+++ b/Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool
@@ -41,7 +41,7 @@
#include <condition_variable>
#include <deque>
#include <mutex>
-//#include <thread>
+#include <thread>
#include <functional>
#include <memory>
#include <pthread.h>
- There are missing directory paths. on ´make´ in SGXDNN and root directory,
g++ -MT bin/sgxdnn_main.o -MMD -MP -MF .d/sgxdnn_main.Td -std=c++11 -fPIC -I../Include/eigen3_sgx -I../Include -Icrypto -O3 -march=native -Wno-enum-compare -fopenmp -c sgxdnn_main.cpp -o bin/sgxdnn_main.o -pthread
Assembler messages:
Fatal error: can't create bin/sgxdnn_main.o: No such file or directory
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
make: *** [bin/sgxdnn_main.o] Error 1
g++ -m64 -O3 -nostdinc -fvisibility=hidden -fpie -ffunction-sections -fdata-sections -fstack-protector-strong -IEnclave -I/home/ohsai/Workspace/linux-sgx/linux/installer/bin/sgxsdk/include -I/home/ohsai/Workspace/linux-sgx/linux/installer/bin/sgxsdk/include/tlibc -I/home/ohsai/Workspace/linux-sgx/linux/installer/bin/sgxsdk/include/libcxx -IInclude -ISGXDNN -IInclude/eigen3_sgx -I/usr/lib/gcc/x86_64-linux-gnu/5.4.0/include -std=c++11 -nostdinc++ -DUSE_SGX -DEIGEN_NO_CPUID -march=native -maes -c SGXDNN/sgxdnn_main.cpp -o SGXDNN/bin_sgx/sgxdnn_main.o
Assembler messages:
Fatal error: can't create SGXDNN/bin_sgx/sgxdnn_main.o: No such file or directory
Makefile:232: recipe for target 'SGXDNN/bin_sgx/sgxdnn_main.o' failed
make: *** [SGXDNN/bin_sgx/sgxdnn_main.o] Error 1
You need to create ´bin´ and ´bin_sgx´ directory inside SGXDNN directory.
Thanks for catching the missing bin
and bin_sgx
directories.
It seems I messed up something with including eigen as a submodule.
The directory Include/eigen should contain a copy of the (unmodified) Eigen library which you can find here: https://github.com/eigenteam/eigen-git-mirror
The Makefile inside SGXDNN is for building the DNN library for use without SGX. So you shouldn't include eigen3_sgx, which is a slightly modified version of eigen with SGX-specific dependencies.
Your fix works for building SGXDNN without SGX, but you'll now have trouble building slalom for SGX because you modified eigen3_sgx.
Thanks for the fast response.. I was doing it totally the wrong way and wasted 4 hours. clone unmodified eigen library to the Include/eigen