- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I have the latest linux SGX SDK. I am trying to do "protected" file handling using the sgx_fread, sgx_fopen etc.
My Enclave code compiles well when the header sgx_tprotected_fs.h is included.
However the linking stage return "undefined reference to sgx_fread" etc.
What library should be linked ?
Thanks,
Tina
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Tina.
From the Developer Reference, on page 106-107:
To use the Intel SGX Protected File System libraries:
1. The enclave must be linked with libsgx_tprotected_fs.a
2. The application must be linked with libsgx_uprotected_fs.a
3. The enclave’s EDL file must ‘import’ all the functions from sgx_tprotected_fs.edl
4. The source files should ‘include’ sgx_tprotected_fs.h
Regards,
Rodolfo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
Thanks. I linked the required libraries as follows. Somehow one lib seems to depend on the other and finally most of the link errors got resolved by having the following libraries linked:
sgxsdk/lib64/libsgx_tprotected_fs.a(lru_cache.o): In function `std::__1::__hash_table<std::__1::__hash_value_type<unsigned long, _map_node*>, std::__1::__unordered_map_hasher<unsigned long, std::__1::__hash_value_type<unsigned long, _map_node*>, std::__1::hash<unsigned long>, true>, std::__1::__unordered_map_equal<unsigned long, std::__1::__hash_value_type<unsigned long, _map_node*>, std::__1::equal_to<unsigned long>, true>, std::__1::allocator<std::__1::__hash_value_type<unsigned long, _map_node*> > >::rehash(unsigned long)': lru_cache.cpp:(.text._ZNSt3__112__hash_tableINS_17__hash_value_typeImP9_map_nodeEENS_22__unordered_map_hasherImS4_NS_4hashImEELb1EEENS_21__unordered_map_equalImS4_NS_8equal_toImEELb1EEENS_9allocatorIS4_EEE6rehashEm[_ZNSt3__112__hash_tableINS_17__hash_value_typeImP9_map_nodeEENS_22__unordered_map_hasherImS4_NS_4hashImEELb1EEENS_21__unordered_map_equalImS4_NS_8equal_toImEELb1EEENS_9allocatorIS4_EEE6rehashEm]+0x77): undefined reference to `std::__1::__next_prime(unsigned long)' lru_cache.cpp:(.text._ZNSt3__112__hash_tableINS_17__hash_value_typeImP9_map_nodeEENS_22__unordered_map_hasherImS4_NS_4hashImEELb1EEENS_21__unordered_map_equalImS4_NS_8equal_toImEELb1EEENS_9allocatorIS4_EEE6rehashEm[_ZNSt3__112__hash_tableINS_17__hash_value_typeImP9_map_nodeEENS_22__unordered_map_hasherImS4_NS_4hashImEELb1EEENS_21__unordered_map_equalImS4_NS_8equal_toImEELb1EEENS_9allocatorIS4_EEE6rehashEm]+0x104): undefined reference to `std::__1::__next_prime(unsigned long)' collect2: error: ld returned 1 exit status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi bergmann:
I have write a demo to show how to use protected fs, You can compare you makefile with mine.
I think the reason is lru_cache needs libc++-dev but you didn't link it.
The project is here :https://github.com/light1021/SGX-protected-fs-demo.
Regards
you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks. The project compiles now after adding libc++-dev.
I have one more question. The sgx_fread and sgx_fseek called in my program returns error. I then use sgx_error(fp) to return the error code. However I don't know what these error codes mean. Which header contains errors corresponding to sgx_ferror?I get a 0x16 as error code.
Thanks once again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi :
The errors are usually defined in sgx_error.h. But I didn't find you error code. Error codes related to protected FS are look like 0x700*. So I don't know what 0x16 stands for.
Kind regards
you
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page