Article ID: 000058410 Content Type: Product Information & Documentation Last Reviewed: 08/06/2021

Unable to add Source Files to the "sgx-ra-sample" Enclave

Environment

Linux*

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Five steps to add source files to the enclave in "sgx-ra-sample"

Description
  • In sgx-ra-sample, added ecall, public A(), to Enclave.cpp.
  • Function A() is dependent on function B().
  • Function B() is implemented in another source file, B.c.
  • In sgx-ra-sample/Enclave/Makefile.am, added B.c in Enclave_SOURCES list.
  • When compiling, received error: undefined reference to B.
Resolution
  1. Add an entry for the ecall to public A() in the trusted section of the Enclave Definition Language (EDL) file.
  2. Create a header file, B.h, that contains the declaration to function B().
  3. Add #include <B.h> to Enclave.cpp.
  4. Edit sgx-ra-sample/Enclave/Makefile:
    • am_Enclave_OBJECTS = B.$(OBJEXT) Enclave_t.$(OBJEXT)...
    • Enclave_SOURCES = Enclave_t.c Enclave_t.h B.c Enclave.cpp\
  5. Execute: make clean && make

Related Products

This article applies to 1 products