Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
22 Views

protected_fs Link Error

Jump to solution

I'm trying to use the SGX protected file system in my enclave. From my understanding, this is how it should be set up:

 1. Include `"sgx_tprotected_fs.h"` in enclave source.
 2. Import `"sgx_tprotected_fs.edl"` in the enclave description file.
 3. Link the appropriate version of `"sgx_uprotected_fs.lib"` with the host app and `"sgx_tprotected_fs.lib"` with the enclave (the latter I don't understand why considering `"sgx_tprotected_fs.edl"` has no ECALLs).

I've done all of these but I'm still getting link errors when building the host app.

Am I doing something wrong or is there a problem with the SDK?

Here is my error log:

    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_exclusive_file_open referenced in function Enclave_u_sgxprotectedfs_exclusive_file_open
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_check_if_file_exists referenced in function Enclave_u_sgxprotectedfs_check_if_file_exists
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_fread_node referenced in function Enclave_u_sgxprotectedfs_fread_node
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_fwrite_node referenced in function Enclave_u_sgxprotectedfs_fwrite_node
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_fclose referenced in function Enclave_u_sgxprotectedfs_fclose
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_fflush referenced in function Enclave_u_sgxprotectedfs_fflush
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_remove referenced in function Enclave_u_sgxprotectedfs_remove
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_recovery_file_open referenced in function Enclave_u_sgxprotectedfs_recovery_file_open
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_fwrite_recovery_node referenced in function Enclave_u_sgxprotectedfs_fwrite_recovery_node
    1>Enclave_u.obj : error LNK2019: unresolved external symbol u_sgxprotectedfs_do_file_recovery referenced in function Enclave_u_sgxprotectedfs_do_file_recovery
    1>C:\Users\Arya\documents\visual studio 2015\Projects\Enclave_0\x64\Debug\App.exe : fatal error LNK1120: 10 unresolved externals

0 Kudos

Accepted Solutions
Highlighted
Employee
22 Views

I might be wrong, but the error messages seem to refer to the stlport library.

Could you replace sgx_tcxx.lib with sgx_tstdcxx.lib?

View solution in original post

0 Kudos
8 Replies
Highlighted
22 Views

Hi,

Please refer the below link for your reference.

https://software.intel.com/en-us/articles/overview-of-intel-protected-file-system-library-using-soft...

-Surenthar

- Surenthar Selvaraj
0 Kudos
Highlighted
New Contributor I
22 Views

Thank you!

I'd already followed the steps but had misspelled the library name. :)

0 Kudos
Highlighted
New Contributor I
22 Views

I'm having a new problem:

1>  Enc_t.c
1>     Creating library C:\Users\Arya\documents\visual studio 2015\Projects\Enc_0\Debug\Enc.lib and object C:\Users\Arya\documents\visual studio 2015\Projects\Enc_0\Debug\Enc.exp
1>sgx_tprotected_fs.lib(file_flush.obj) : error LNK2019: unresolved external symbol "public: __thiscall stlpmtx_std::__Named_exception::__Named_exception(class stlpmtx_std::basic_string<char,class stlpmtx_std::char_traits<char>,class stlpmtx_std::allocator<char> > const &)" (??0__Named_exception@stlpmtx_std@@QAE@ABV?$basic_string@DV?$char_traits@D@stlpmtx_std@@V?$allocator@D@2@@1@@Z) referenced in function "public: __thiscall stlpmtx_std::logic_error::logic_error(class stlpmtx_std::basic_string<char,class stlpmtx_std::char_traits<char>,class stlpmtx_std::allocator<char> > const &)" (??0logic_error@stlpmtx_std@@QAE@ABV?$basic_string@DV?$char_traits@D@stlpmtx_std@@V?$allocator@D@2@@1@@Z)
1>sgx_tprotected_fs.lib(lru_cache.obj) : error LNK2001: unresolved external symbol "public: __thiscall stlpmtx_std::__Named_exception::__Named_exception(class stlpmtx_std::basic_string<char,class stlpmtx_std::char_traits<char>,class stlpmtx_std::allocator<char> > const &)" (??0__Named_exception@stlpmtx_std@@QAE@ABV?$basic_string@DV?$char_traits@D@stlpmtx_std@@V?$allocator@D@2@@1@@Z)
1>sgx_tprotected_fs.lib(file_flush.obj) : error LNK2019: unresolved external symbol "public: __thiscall stlpmtx_std::__Named_exception::__Named_exception(class stlpmtx_std::__Named_exception const &)" (??0__Named_exception@stlpmtx_std@@QAE@ABV01@@Z) referenced in function "public: __thiscall stlpmtx_std::logic_error::logic_error(class stlpmtx_std::logic_error const &)" (??0logic_error@stlpmtx_std@@QAE@ABV01@@Z)
1>sgx_tprotected_fs.lib(lru_cache.obj) : error LNK2001: unresolved external symbol "public: __thiscall stlpmtx_std::__Named_exception::__Named_exception(class stlpmtx_std::__Named_exception const &)" (??0__Named_exception@stlpmtx_std@@QAE@ABV01@@Z)
1>sgx_tprotected_fs.lib(file_flush.obj) : error LNK2019: unresolved external symbol "public: virtual __thiscall stlpmtx_std::__Named_exception::~__Named_exception(void)" (??1__Named_exception@stlpmtx_std@@UAE@XZ) referenced in function "public: virtual __thiscall stlpmtx_std::logic_error::~logic_error(void)" (??1logic_error@stlpmtx_std@@UAE@XZ)
1>sgx_tprotected_fs.lib(lru_cache.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall stlpmtx_std::__Named_exception::~__Named_exception(void)" (??1__Named_exception@stlpmtx_std@@UAE@XZ)
1>sgx_tprotected_fs.lib(file_flush.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall stlpmtx_std::__Named_exception::what(void)const " (?what@__Named_exception@stlpmtx_std@@UBEPBDXZ)
1>sgx_tprotected_fs.lib(lru_cache.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall stlpmtx_std::__Named_exception::what(void)const " (?what@__Named_exception@stlpmtx_std@@UBEPBDXZ)
1>C:\Users\Arya\documents\visual studio 2015\Projects\Enc_0\Debug\Enc.dll : fatal error LNK1120: 4 unresolved externals

Seems to be missing some Mutex classes... :-?

I couldn't figure out what I should link with my enclave for solving that.

0 Kudos
Highlighted
Employee
22 Views

What C++ standard library are you linking your enclave with?

0 Kudos
Highlighted
New Contributor I
22 Views

I didn't change any of the default configurations, so I'd assume the ones provided by the SGX SDK.

It's linking with "sgx_tstdc.lib" and "sgx_tcxx.lib". That should work, right?

0 Kudos
Highlighted
Employee
23 Views

I might be wrong, but the error messages seem to refer to the stlport library.

Could you replace sgx_tcxx.lib with sgx_tstdcxx.lib?

View solution in original post

0 Kudos
Highlighted
New Contributor I
22 Views

It worked! Thank you!

0 Kudos
Highlighted
Employee
22 Views

The SGX SDK 1.7 was meant to use the new C++ library, sgx_tcxx.lib, by default.

It looks like the protected fs library was misconfigured at build time. Consider the bug filed. :)

0 Kudos