Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Compiling of demo enclaves failing

Marion_M_Intel
Employee
711 Views

Hello,

giving SGX a quick spin, I am already failing on compiling the sample projects that come with the SGX SDK. I'd suspect the mistake to be buried in the setup, seems I can't figure out where though. I'm using VS2015 with SGX SDK version 1.8 and Intel C++ Compiler 17.0.

The source I'm currently looking at is the Cxx11SGXDemo included with the SDK, the errors I'm seeing are consistent though throughout all the demo projects (see below).

I'm sure there is something obvious I am missing, just what? 

Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	429	
Error	#45	#undef may not be used on this predefined name	                        Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\__sgx	86	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	336	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	337	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	338	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	383	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	384	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	428	
Error	#264	floating-point value does not fit in required floating-point type	Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\limits	430	
Error		argument of type "long *" is incompatible with parameter of type "int *"Enclave	C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\atomic	1998	
0 Kudos
8 Replies
Hoang_N_Intel
Employee
711 Views

If you change the project setting to use the Microsoft VC++ compiler in the project setting (please see attachment for a screenshot), it should fix all these errors that you see.

0 Kudos
Marion_M_Intel
Employee
711 Views

Hello, thank you very much for the quick reply. Done as told, and now running into linker errors as shown below. 

Error	LNK1120	1 unresolved externals	Enclave	C:\Users\mmarscha\Desktop\SGX\Cxx11SGXDemo\Release\Enclave.dll	1	
Error	LNK2019	unresolved external symbol __ftoui3 referenced in function "public: struct std::pair<class std::__hash_iterator<struct std::__hash_node<int,void *> *>,bool> __thiscall std::__hash_table<int,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<int> >::__insert_unique_value<int const &>(int const &)" (??$__insert_unique_value@ABH@?$__hash_table@HU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@H@2@@std@@QAE?AU?$pair@V?$__hash_iterator@PAU?$__hash_node@HPAX@std@@@std@@_N@1@ABH@Z)	Enclave	...\Libcxx.obj	1	
0 Kudos
Hoang_N_Intel
Employee
711 Views

It is because the DLL is in the output directory. Please go into your project setting and change the "Working Directory" from $(ProjectDir) to $(OutDir)

 

 

 

0 Kudos
Marion_M_Intel
Employee
711 Views

This sadly did not change anything regarding the linker errors :) I found though that Debug builds, regardless of the working directory. Any idea what I'm missing? Project settings for both debug and release look the same. 

 

0 Kudos
Hoang_N_Intel
Employee
711 Views

Can you set /NODEFAULTLIB when linking for the Enclave project?

Please see attachment on how to set using the project setting for linker. Please let us know the result.

0 Kudos
Marion_M_Intel
Employee
711 Views

That flag was already set on the Enclave project, but I found something else. If I disable optimization (Release version) I can compile linker error free. I changed /O2 to /Od, same as is set for Debug.  

My experience with Visual Studio is limitied, could that be that speed optimization introduces linker errors?

0 Kudos
ginzberg__yehonatan
711 Views

Hi,

Had the same issue on a private project I'm working on, when compiling the enclave on PreRelease/Win32 compilation fails for some of the object files on "error LNK2001: unresolved external symbol __ftoui3" - While Debug/Win32 compiles fine. I believe that we face the same issue as Marion's output to x86 directory. Testing Marion's suggestion made PreRelease/Win32 compile, but I want optimizations..

The solution I've taken: I tested PreRelease/X64 and it compiled without these errors. I hope that by posting here it'll help lost souls in the future.

In addition, Hoang Nguyen, looking at the differences between PreRelease/Win32 and PreRelease/x64 under linker settings the only effective difference is under General -> Additional Library Directories. The $(Platform) directs each of the configurations to a different SGX SDK libraries path. Maybe there is an issue with the Win32 libraries? I'm running on top of Intel SGX SDK for Windows v1.9.100.41172 (not the latest nowadays).

0 Kudos
ginzberg__yehonatan
711 Views

Hoang Nguyen, to reproduce the issue, I opened a fresh "Cxx11SGXDemo" - the default compiler (Intel C++ 16.0 Compiler) works just fine for PreRelease\Win32, setting the compiler to Visual Studio 2015 (v140) reproduced the issue (and again, PreRelease\x64, does compile).

1>Libcxx.obj : error LNK2019: unresolved external symbol __ftoui3 referenced in function "public: struct std::pair<class std::__hash_iterator<struct std::__hash_node<int,void *> *>,bool> __thiscall std::__hash_table<int,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<int> >::__insert_unique_value<int const &>(int const &)" (??$__insert_unique_value@ABH@?$__hash_table@HU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@H@2@@std@@QAE?AU?$pair@V?$__hash_iterator@PAU?$__hash_node@HPAX@std@@@std@@_N@1@ABH@Z)

Can get someone to look into it?

0 Kudos
Reply