Intel® Software Guard Extensions (Intel® SGX)
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
1218 Discussions

Compiling intel sgx application through visual studio command prompt

leibovitz__sarah
Beginner
94 Views

Is there any way to compile an intel-sgx app (and specifically- the untrusted part) in visual studio's command prompt so that  

the that header file and libraries will be recognized at compilation?

0 Kudos
1 Reply
Hoang_N_Intel
Employee
94 Views

The easiest way is to use the "MSBUILD" utility that comes with Visual Studio to give you the exact commands to build either the Enclave or the App on the command line.

Here are the few settings that you may need:

To include the current directory in the search:    set INCLUDE=.;%INCLUDE%

To include "rc.exe" in the build of the app:  set PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%

Here is how you can compile and build:  msbuild /p:useenv=true Enclave.vcxproj

and msbuild /p:useenv=true App.vcxproj

Here is an example of build command for the untrusted app:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\CL.exe /c /I"C:\Program Files (x86)\Intel\IntelSGXSDK\\include" /IC:\Cxx11SGXDemo\App\\Include /I"C:\Program Files (x86)\Intel\IntelSGXSDK\\include\epid" /IC:\Cxx11SGXDemo\App\\App /Zi /nologo /W2 /WX /Od /Oy- /D _MBCS /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc140.pdb" /Gd /TP /analyze- /errorReport:queue App.cpp TrustedLibrary\Libcxx.cpp
 
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Cxx11SGXDemo\App\Debug\App.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files (x86)\Intel\IntelSGXSDK\\bin\Win32\Debug" /WX sgx_uae_service.lib sgx_urts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB:libcmtd.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Cxx11SGXDemo\App\Debug\App.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Cxx11SGXDemo\App\Debug\App.lib" /MACHINE:X86 Debug\App.obj Debug\Enclave_u.obj Debug\Libcxx.obj

 

Reply