utds3lab / sgx-nbench

The nbench benchmark ported to SGX.
14 stars 4 forks source link

Compilation Error: undefined reference to `sgx_oc_cpuidex' #1

Closed gogo9th closed 5 years ago

gogo9th commented 5 years ago

Hi,

I am trying to compile sgx-nbench from my machine. In its Makefile, its Enclave_Link_Flags uses the deprecated -lsgx_tstdcxx library, so I modified this to -lsgx_tcxx and then tried "make". But I get the following error:

g++ Enclave/encl_emfloat.o Enclave/Enclave_t.o Enclave/Enclave.o -o enclave.so -m64 -O2 -Wl,--no-undefined -nostdlib -nostartfiles -L/opt/intel/sgxsdk/lib64 -Wl,--whole-archive -lsgx_trts -Wl,--no-whole-archive -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_tcrypto -lsgx_tservice -Wl,--end-group -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-pie,-eenclave_entry -Wl,--export-dynamic -Wl,--defsym,__ImageBase=0 -Wl,--version-script=Enclave/Enclave.lds
/opt/intel/sgxsdk/lib64/libsgx_tstdc.a(se_cpuid.o): In function `sgx_cpuidex':
se_cpuid.c:(.text.sgx_cpuidex+0x6): undefined reference to `sgx_oc_cpuidex'
/opt/intel/sgxsdk/lib64/libsgx_tstdc.a(se_cpuid.o): In function `sgx_cpuid':
se_cpuid.c:(.text.sgx_cpuid+0x8): undefined reference to `sgx_oc_cpuidex'
collect2: error: ld returned 1 exit status
Makefile:199: recipe for target 'enclave.so' failed
make: *** [enclave.so] Error 1

Could you please give me a hint what went wrong? I am using the latest linux-sgx source code.

gogo9th commented 5 years ago

I solved the problem. We need to add the following line in Enclave.edl:

from "sgx_tstdc.edl" import sgx_oc_cpuidex;