<?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 Thank You , I was looking for in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1163000#M2914</link>
    <description>&lt;P&gt;Thank You , I was looking for this fix.&lt;BR /&gt;&lt;BR /&gt;You save my life. Thanks again.&lt;/P&gt;&lt;P&gt;Kevin79,&lt;BR /&gt;&lt;SUP&gt;&lt;A href="https://www.todotech20.com"&gt;https://www.todotech20.com&lt;/A&gt;&lt;/SUP&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Jul 2019 02:05:25 GMT</pubDate>
    <dc:creator>Jose__Kevin</dc:creator>
    <dc:date>2019-07-14T02:05:25Z</dc:date>
    <item>
      <title>undefined reference to `sgx_oc_cpuidex'</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162992#M2906</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to compile &lt;A href="https://github.com/utds3lab/sgx-nbench/issues/new"&gt;sgx-nbench&lt;/A&gt; 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:&lt;/P&gt;&lt;P&gt;```&lt;BR /&gt;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&lt;BR /&gt;/opt/intel/sgxsdk/lib64/libsgx_tstdc.a(se_cpuid.o): In function `sgx_cpuidex':&lt;BR /&gt;se_cpuid.c:(.text.sgx_cpuidex+0x6): undefined reference to `sgx_oc_cpuidex'&lt;BR /&gt;/opt/intel/sgxsdk/lib64/libsgx_tstdc.a(se_cpuid.o): In function `sgx_cpuid':&lt;BR /&gt;se_cpuid.c:(.text.sgx_cpuid+0x8): undefined reference to `sgx_oc_cpuidex'&lt;BR /&gt;collect2: error: ld returned 1 exit status&lt;BR /&gt;Makefile:199: recipe for target 'enclave.so' failed&lt;BR /&gt;make: *** [enclave.so] Error 1&lt;BR /&gt;```&lt;BR /&gt;I wonder if anybody could give me a hint what went wrong in the Makefile, because I spent 2 hours but still couldn't figure out why...&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 20:30:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162992#M2906</guid>
      <dc:creator>Ko__Ronny</dc:creator>
      <dc:date>2019-06-10T20:30:40Z</dc:date>
    </item>
    <item>
      <title>Hi, Ronny.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162993#M2907</link>
      <description>&lt;P&gt;Hi, Ronny.&lt;/P&gt;&lt;P&gt;I've just checked that Makefile and I noticed that it also includes "$(SGX_SDK)/include/stlport". You should change that to&amp;nbsp;"$(SGX_SDK)/include/libcxx".&lt;/P&gt;&lt;P&gt;Did you also make that change? There might be differences in the signatures of the functions of those libs.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rodolfo&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 22:39:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162993#M2907</guid>
      <dc:creator>Rodolfo_S_</dc:creator>
      <dc:date>2019-06-10T22:39:22Z</dc:date>
    </item>
    <item>
      <title>Hi Rodolfo,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162994#M2908</link>
      <description>&lt;P&gt;Hi Rodolfo,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for the comment. I changed "$(SGX_SDK)/include/stlport" to&amp;nbsp;"$(SGX_SDK)/include/libcxx", but it still generates the same error..&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 22:46:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162994#M2908</guid>
      <dc:creator>Ko__Ronny</dc:creator>
      <dc:date>2019-06-10T22:46:30Z</dc:date>
    </item>
    <item>
      <title>Hi Ronny.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162995#M2909</link>
      <description>&lt;P&gt;Hi Ronny.&lt;/P&gt;&lt;P&gt;I have just compiled that code inside a Docker container (rodolfoams/sgx-base:sgx_2.5)&amp;nbsp;with just a few modifications on that code. That Docker image has SGX SDK version 2.5 installed on it. here is the patch&amp;nbsp;file that I generated:&lt;/P&gt;
&lt;PRE class="brush:bash; class-name:dark;"&gt;diff --git a/App/App.cpp b/App/App.cpp
index fd84726..0b0af3d 100644
--- a/App/App.cpp
+++ b/App/App.cpp
@@ -5,7 +5,7 @@
 #include &amp;lt;pwd.h&amp;gt;
 #define MAX_PATH FILENAME_MAX
 #include "sgx_urts.h"
-#include "sgx_status.h"
+//#include "sgx_status.h"
 #include "App.h"
 #include "Enclave_u.h"
 
diff --git a/Makefile b/Makefile
index 5abf919..5da2152 100644
--- a/Makefile
+++ b/Makefile
@@ -89,13 +89,13 @@ else
 endif
 
 Enclave_Cpp_Files := Enclave/Enclave.cpp $(wildcard Enclave/Edger8rSyntax/*.cpp) $(wildcard Enclave/TrustedLibrary/*.cpp)
-Enclave_Include_Paths := -IInclude -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -I$(NBENCHDIR)
+Enclave_Include_Paths := -IInclude -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx -I$(NBENCHDIR)
 
 Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths)
 Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++03 -nostdinc++
 Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \
 	-Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \
-	-Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \
+	-Wl,--start-group -lsgx_tstdc -lsgx_tcxx -l$(Crypto_Library_Name) -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 \&lt;/PRE&gt;

&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Rodolfo&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 23:37:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162995#M2909</guid>
      <dc:creator>Rodolfo_S_</dc:creator>
      <dc:date>2019-06-10T23:37:55Z</dc:date>
    </item>
    <item>
      <title>Hi Rodolfo,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162996#M2910</link>
      <description>&lt;P&gt;Hi Rodolfo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the patch output.&amp;nbsp; I indeed applied all those changes, yet it still doesn't work... Could you check if my attached patched package compiles okay on your machine:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Also, I cannot find any Enclave's library that defines the problematic sgx_oc_cpuidex() function:&lt;/P&gt;
&lt;PRE class="brush:; class-name:dark;"&gt;$ find /opt/intel/sgxsdk/lib64/ -exec sh -c 'nm {} | grep "cpuidex" ' \; -print 2&amp;gt; /dev/null
000000000000b630 T sgx_oc_cpuidex
/opt/intel/sgxsdk/lib64/libsgx_urts_sim.so
0000000000000000 T sgx_cpuidex
                 U sgx_oc_cpuidex
/opt/intel/sgxsdk/lib64/libsgx_tstdc.a
0000000000000a50 T sgx_oc_cpuidex
/opt/intel/sgxsdk/lib64/libsgx_urts.so&lt;/PRE&gt;

&lt;P&gt;libsgx_urts.so&amp;nbsp;is the App's library (not the Enclave's).&lt;BR /&gt;Does your machine output the same?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 00:30:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162996#M2910</guid>
      <dc:creator>Ko__Ronny</dc:creator>
      <dc:date>2019-06-11T00:30:00Z</dc:date>
    </item>
    <item>
      <title>Hi, Ronny.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162997#M2911</link>
      <description>&lt;P&gt;Hi, Ronny.&lt;/P&gt;&lt;P&gt;Yes, I do get exactly the same output as you do, but that is the expected behavior because the "sgx_oc_cpuidex" is an ocall, so it shouldn't be defined in the trusted libraries.&lt;/P&gt;&lt;P&gt;What sdk version are you using? Also, are there any other errors when compiling that code?&lt;/P&gt;&lt;P&gt;I'm afraid I can't reproduce your error here (compiling the code in a container with sdk 2.5 installed).&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Rodolfo&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 02:14:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162997#M2911</guid>
      <dc:creator>Rodolfo_S_</dc:creator>
      <dc:date>2019-06-11T02:14:19Z</dc:date>
    </item>
    <item>
      <title>Hi Rodolfo,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162998#M2912</link>
      <description>&lt;P&gt;Hi Rodolfo,&lt;/P&gt;&lt;P&gt;I retested after installing SDK 2.5, but still gets the same error:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:bash; class-name:dark;"&gt;/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'
&lt;/PRE&gt;

&lt;P&gt;I think this error occurs because libsgx_tstdc.a uses the untrusted sgx_oc_cpuidex function, which none of the below libraries define:&lt;/P&gt;
&lt;P&gt;Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH)&amp;nbsp; -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group&amp;nbsp; -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group&amp;nbsp; -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-pie,-eenclave_entry -Wl,--export-dynamic&amp;nbsp;&amp;nbsp; -Wl,--defsym,__ImageBase=0&lt;/P&gt;
&lt;P&gt;And nbench's Makefile's $(Enclave_Name) target ties to compile it with the following command:&lt;/P&gt;

&lt;PRE class="brush:bash; class-name:dark;"&gt;g++ Enclave/encl_emfloat.o Enclave/Enclave_t.o Enclave/Enclave.o -o enclave.so -m64 -O2 -Wl,--no-undefined -nostdlib -nodefaultlibs -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
&lt;/PRE&gt;

&lt;P&gt;and therefore we get the following error (because the above command's input files defines the sgx_oc_cpuidex() function):&lt;/P&gt;

&lt;PRE class="brush:bash; class-name:dark;"&gt;/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

&lt;/PRE&gt;

&lt;P&gt;Is my reasoning correct? If so, I'm not sure how to solve this problem..&lt;/P&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 03:39:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162998#M2912</guid>
      <dc:creator>Ko__Ronny</dc:creator>
      <dc:date>2019-06-11T03:39:58Z</dc:date>
    </item>
    <item>
      <title>I found a solution to fix</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162999#M2913</link>
      <description>&lt;P&gt;I found a solution to fix this problem. In the file Enclave/Enclave.edl, I added the following in the enclave{} block:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:bash; class-name:dark;"&gt;from "sgx_tstdc.edl" import sgx_oc_cpuidex;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We need this because the trusted library (libsgx_tstdc.a) is calling this untrusted function. By adding the above, the Makefile generates a Ocall for this function with the enclave can call. But I'm still not sure why your compilation worked without adding the above in Enclave.edl.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 01:12:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1162999#M2913</guid>
      <dc:creator>Ko__Ronny</dc:creator>
      <dc:date>2019-06-12T01:12:33Z</dc:date>
    </item>
    <item>
      <title>Thank You , I was looking for</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1163000#M2914</link>
      <description>&lt;P&gt;Thank You , I was looking for this fix.&lt;BR /&gt;&lt;BR /&gt;You save my life. Thanks again.&lt;/P&gt;&lt;P&gt;Kevin79,&lt;BR /&gt;&lt;SUP&gt;&lt;A href="https://www.todotech20.com"&gt;https://www.todotech20.com&lt;/A&gt;&lt;/SUP&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 02:05:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/undefined-reference-to-sgx-oc-cpuidex/m-p/1163000#M2914</guid>
      <dc:creator>Jose__Kevin</dc:creator>
      <dc:date>2019-07-14T02:05:25Z</dc:date>
    </item>
  </channel>
</rss>

