Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ycc__ccy
Beginner
241 Views

Failed to compile SampleCode/SealedData on ubuntu 16.04

OS: ubuntu 16.04

GCC/G++: 5.5 and 7.4

SGX SDK: 2.6.100.51363

When compile the sample code(path/to/sgx-sdk/installation/directory/SampleCode/SealedData) on ubuntu 16.04, run below command:

make SGX_MODE=SIM

I met some errors like below:

make[1]: Entering directory '/usr/local/intel-sgx-sdk/sgxsdk/SampleCode/SealedData'
GEN  =>  DRM_app/DRM_enclave_u.h
CC   <=  DRM_app/DRM_enclave_u.c
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h:148:0,
                 from /usr/include/c++/5/ext/atomicity.h:35,
                 from /usr/include/c++/5/bits/ios_base.h:39,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from DRM_app/TimeBasedDRM.cpp:38:
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:101:1: error: ‘pthread_once’ was not declared in this scope
 __gthrw(pthread_once)
 ^
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:102:1: error: ‘pthread_getspecific’ was not declared in this scope
 __gthrw(pthread_getspecific)
 ^
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:103:1: error: ‘pthread_setspecific’ was not declared in this scope
 __gthrw(pthread_setspecific)
 ^
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:105:1: error: ‘pthread_create’ was not declared in this scope
 __gthrw(pthread_create)
 ^

........................

/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h: In function ‘int __gthread_create(__gthread_t*, void* (*)(void*), void*)’:
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:662:68: error: ‘__gthrw_pthread_create’ cannot be used as a function
   return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
                                                                    ^
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h: In function ‘int __gthread_join(__gthread_t, void**)’:
/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:668:57: error: ‘__gthrw_pthread_join’ cannot be used as a function
   return __gthrw_(pthread_join) (__threadid, __value_ptr);
                                                         ^
........................

Makefile:234: recipe for target 'DRM_app/TimeBasedDRM.o' failed
make[1]: *** [DRM_app/TimeBasedDRM.o] Error 1
make[1]: Leaving directory '/usr/local/intel-sgx-sdk/sgxsdk/SampleCode/SealedData'
Makefile:186: recipe for target 'all' failed
make: *** [all] Error 2
 

I tried to upgrade gcc and g++ version to 7.4 and recompile, but same errors still met. 

0 Kudos
1 Reply
ycc__ccy
Beginner
241 Views

After I deleted the file "/path/to/sgx-sdk/install/dir/include/pthread.h", compile successfully.

Reply