<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hello, I have had the same in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129154#M1860</link>
    <description>&lt;P&gt;Hello, I have had the same issue.&lt;/P&gt;&lt;P&gt;My Makefile&amp;nbsp;had the following line&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:plain; class-name:dark;"&gt;TestEnclave_Cpp_Objects := $(TestEnclave_Cpp_Files:.cpp=.o)&lt;/PRE&gt;

&lt;P&gt;which is your line 5&lt;/P&gt;
&lt;P&gt;the Makefile is trying to build the .so without having Enclave.o - I don't know why, it could be a problem with make version or the OS&lt;/P&gt;
&lt;P&gt;before line 42 try to add&lt;/P&gt;

&lt;PRE class="brush:plain; class-name:dark;"&gt;Enclave/Enclave.o: Enclave/Enclave.cpp
&amp;nbsp; &amp;nbsp; $(CXX) $(Enclave_Cpp_Flags) -c $&amp;lt; -o $@
&amp;nbsp; &amp;nbsp;&amp;nbsp;@echo "CXX &amp;nbsp;&amp;lt;= &amp;nbsp;$&amp;lt;"&lt;/PRE&gt;

&lt;P&gt;after 4 hours I solved the issue.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2019 09:45:06 GMT</pubDate>
    <dc:creator>Nappa__Antonio</dc:creator>
    <dc:date>2019-07-08T09:45:06Z</dc:date>
    <item>
      <title>Need help! Undefined reference in trusted cpp enclave</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129152#M1858</link>
      <description>&lt;P&gt;I am new to SGX linux development, and I am trying to build a TestEnclave.cpp)onto sgx.&lt;/P&gt;

&lt;P&gt;I have encountered this undefined reference error when I linked the "trusted" part of the program.&lt;/P&gt;

&lt;PRE class="brush:bash; class-name:dark;"&gt;
make all 
make -f sgx_u.mk LINUX_SGX_BUILD=0 all
make[1]: 进入目录“/home/zhou/下载/intel-sgx-ssl-master/Linux/sgx/test_pdp”
GEN  =&amp;gt;  app/TestEnclave_u.c
CC   &amp;lt;=  app/TestEnclave_u.c
LINK =&amp;gt;  TestApp
make[1]: 离开目录“/home/zhou/下载/intel-sgx-ssl-master/Linux/sgx/test_pdp”

----------- &amp;gt;&amp;gt; the untrusted part builds successfully

make -f sgx_t.mk LINUX_SGX_BUILD=0 all
make[1]: 进入目录“/home/zhou/下载/intel-sgx-ssl-master/Linux/sgx/test_pdp”
GEN  =&amp;gt;  enclave/TestEnclave_t.c
CC   &amp;lt;=  enclave/TestEnclave_t.c
enclave/TestEnclave_t.o：在函数‘sgx_pdp_generate_proof_update’中：
TestEnclave_t.c:(.text+0x436)：对‘pdp_generate_proof_update’未定义的引用 ----------------------- &amp;gt;&amp;gt; here
enclave/TestEnclave_t.o：在函数‘sgx_pdp_challenge’中：
sgx_t.mk:139: recipe for target 'TestEnclave.so' failed
TestEnclave_t.c:(.text+0x5f0)：对‘pdp_challenge’未定义的引用 ----------------------- &amp;gt;&amp;gt; here
make[1]: 离开目录“/home/zhou/下载/intel-sgx-ssl-master/Linux/sgx/test_pdp”
Makefile:34: recipe for target 'all' failed
TestEnclave_t.c:(.text+0x62a)：对‘pdp_challenge’未定义的引用
enclave/TestEnclave_t.o：在函数‘sgx_pdp_tag_block’中：
TestEnclave_t.c:(.text+0x6d8)：对‘pdp_tag_block’未定义的引用 ---------------------- &amp;gt;&amp;gt; here
TestEnclave_t.c:(.text+0x754)：对‘pdp_tag_block’未定义的引用
TestEnclave_t.c:(.text+0x79e)：对‘pdp_tag_block’未定义的引用
TestEnclave_t.c:(.text+0x7f9)：对‘pdp_tag_block’未定义的引用
collect2: error: ld returned 1 exit status
make[1]: *** [TestEnclave.so] Error 1
make: *** [all] Error 2

17:53:59 Build Finished (took 815ms)&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I have defined these functions(&lt;/SPAN&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; background-color: rgb(248, 248, 248);"&gt;pdp_challenge,&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas, &amp;quot;Lucida Console&amp;quot;, Menlo, Monaco, &amp;quot;DejaVu Sans Mono&amp;quot;, monospace, sans-serif; font-size: 13.008px;"&gt;pdp_tag_block,&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248);"&gt;etc)&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt; in the EDL file, and the untrusted part of TestEnclave.cpp linked successfully. But I don't know what's wrong with the trusted part.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Any help is greatly appreciated!!&lt;/P&gt;

&lt;P&gt;my makefile is as follows:&lt;/P&gt;

&lt;PRE class="brush:bash; class-name:dark;"&gt;								
TestEnclave_Cpp_Files := $(wildcard $(ENCLAVE_DIR)/*.cpp) $(wildcard $(ENCLAVE_DIR)/tests/*.cpp)
TestEnclave_C_Files := $(wildcard $(ENCLAVE_DIR)/*.c) $(wildcard $(ENCLAVE_DIR)/tests/*.c)

TestEnclave_Cpp_Objects := $(TestEnclave_Cpp_Files:.cpp=.o)
TestEnclave_C_Objects := $(TestEnclave_C_Files:.c=.o)

TestEnclave_Include_Paths := -I. -I$(ENCLAVE_DIR) -I$(SGX_SDK_INC) -I$(SGX_SDK_INC)/tlibc -I$(STL_PORT_INC)/stlport -I$(PACKAGE_INC) -IInclude

Common_C_Cpp_Flags := -DOS_ID=$(OS_ID) $(SGX_COMMON_CFLAGS)  -nostdinc -fvisibility=hidden -fpic -fpie -fstack-protector -fno-builtin-printf -Wformat -Wformat-security $(TestEnclave_Include_Paths) -include "tsgxsslio.h"
TestEnclave_C_Flags := $(Common_C_Cpp_Flags) -Wno-implicit-function-declaration -std=c11
TestEnclave_Cpp_Flags :=  $(Common_C_Cpp_Flags) -std=c++11 -nostdinc++

SgxSSL_Link_Libraries := -L$(OPENSSL_LIBRARY_PATH) -Wl,--whole-archive -l$(SGXSSL_Library_Name) -Wl,--no-whole-archive \
						 -l$(OpenSSL_Crypto_Library_Name)
Security_Link_Flags := -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -pie

TestEnclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles \
	$(Security_Link_Flags) \
	$(SgxSSL_Link_Libraries) -L$(SGX_LIBRARY_PATH) \
	-Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \
	-Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -lsgx_tcrypto $(TSETJMP_LIB) -l$(Service_Library_Name) -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_DIR)/TestEnclave.lds


.PHONY: all test

all: TestEnclave.signed.so
# usually release mode don't sign the enclave, but here we want to run the test also in release mode
# this is not realy a release mode as the XML file don't disable debug - we can't load real release enclaves (white list)

test: all


######## TestEnclave Objects ########

。。。。（omitted）

TestEnclave.so: $(ENCLAVE_DIR)/TestEnclave_t.o $(TestEnclave_Cpp_Objects) $(TestEnclave_C_Objects)
	$(VCXX) $^ -o $@ $(TestEnclave_Link_Flags)
	@echo "LINK =&amp;gt;  $@"

TestEnclave.signed.so: TestEnclave.so
	@$(SGX_ENCLAVE_SIGNER) sign -key $(ENCLAVE_DIR)/TestEnclave_private.pem -enclave TestEnclave.so -out $@ -config $(ENCLAVE_DIR)/TestEnclave.config.xml
	@echo "SIGN =&amp;gt;  $@"

clean:
	@rm -f TestEnclave.* $(ENCLAVE_DIR)/TestEnclave_t.* $(TestEnclave_Cpp_Objects) $(TestEnclave_C_Objects)

&lt;/PRE&gt;

&lt;P&gt;my EDL file is as follows:&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;/* TestEnclave.edl - Top EDL file. */

enclave {
    include "user_types.h"
    from "sgx_tsgxssl.edl" import *;

    /* 
     * uprint - invokes OCALL to display string buffer inside the enclave.
     *  [in]: copy the string buffer to App outside.
     *  [string]: specifies 'str' is a NULL terminated buffer.
     */
    untrusted {
        void uprint([in, string] const char *str);
        void usgx_exit(int reason);

    };
  
    trusted{    
        public int pdp_verify_proof([in]PDP_key *key, [in]PDP_challenge *challenge, [in]PDP_proof *proof);
        public PDP_key *generate_pdp_key();
        
        public PDP_tag *pdp_tag_block([in]PDP_key *key,[in] unsigned char *block, size_t blocksize, size_t index);
       
        public PDP_challenge *pdp_challenge([in]PDP_key *key, size_t numfileblocks);
       
        public PDP_proof *pdp_generate_proof_update([in]PDP_key *key,[in] PDP_challenge *challenge,[in] PDP_tag *tag,[in,out]PDP_proof *proof, [in, size=blocksize]unsigned char *block, size_t blocksize, size_t j);
       
        public PDP_proof *pdp_generate_proof_final([in]PDP_key *key, [in]PDP_challenge *challenge, [in,out]PDP_proof *proof);
       
        
    };
};
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 10:20:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129152#M1858</guid>
      <dc:creator>zhou__boxiao</dc:creator>
      <dc:date>2018-09-14T10:20:23Z</dc:date>
    </item>
    <item>
      <title>I have solved this problem!</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129153#M1859</link>
      <description>&lt;P&gt;I have solved this problem!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:59:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129153#M1859</guid>
      <dc:creator>zhou__boxiao</dc:creator>
      <dc:date>2018-09-14T13:59:29Z</dc:date>
    </item>
    <item>
      <title>Hello, I have had the same</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129154#M1860</link>
      <description>&lt;P&gt;Hello, I have had the same issue.&lt;/P&gt;&lt;P&gt;My Makefile&amp;nbsp;had the following line&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:plain; class-name:dark;"&gt;TestEnclave_Cpp_Objects := $(TestEnclave_Cpp_Files:.cpp=.o)&lt;/PRE&gt;

&lt;P&gt;which is your line 5&lt;/P&gt;
&lt;P&gt;the Makefile is trying to build the .so without having Enclave.o - I don't know why, it could be a problem with make version or the OS&lt;/P&gt;
&lt;P&gt;before line 42 try to add&lt;/P&gt;

&lt;PRE class="brush:plain; class-name:dark;"&gt;Enclave/Enclave.o: Enclave/Enclave.cpp
&amp;nbsp; &amp;nbsp; $(CXX) $(Enclave_Cpp_Flags) -c $&amp;lt; -o $@
&amp;nbsp; &amp;nbsp;&amp;nbsp;@echo "CXX &amp;nbsp;&amp;lt;= &amp;nbsp;$&amp;lt;"&lt;/PRE&gt;

&lt;P&gt;after 4 hours I solved the issue.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 09:45:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Need-help-Undefined-reference-in-trusted-cpp-enclave/m-p/1129154#M1860</guid>
      <dc:creator>Nappa__Antonio</dc:creator>
      <dc:date>2019-07-08T09:45:06Z</dc:date>
    </item>
  </channel>
</rss>

