- Mark as New
- Subscribe to RSS Feed
- Report Inappropriate Content
I need to build a dynamic library that will act as a wrapper for an enclave dynamic library. Reasoning behind that is to provide an interface that could be integrated with a NodeJS application (using node-ffi) as well as to implement error handling. I have already done this on Windows and it worked like a charm - my application dynamically loaded both Enclave DLL and my wrapper DLL and did what I expected it to. However it turned out that this will have to run under Linux, so I'm trying to do the same under Linux which turned out to be problematic.
What have I done so far:
- Installed SGX as per https://github.com/intel/linux-sgx and tested it using SampleEnclave app
- Copied Makefile from https://github.com/intel/linux-sgx to my project and adapted it for my needs (kept changes to minimum)
- Built app using make and got Enclave.signed.so
- Built my EnclaveWrapper.so with
g++ -shared -fPIC -Wl,-soname,Enclave.signed.so -o EnclaveWrapper.so App/*.o
- Built a simple test app that calls a method from EnclaveWrapper.so with
g++ -c test.cpp
- Attempted to link both dynamic libs to a test app with
g++ -o prog test.o -L. -l:EnclaveWrapper.so -l:Enclave.signed.so -lm
... but it failed with following messages:
./EnclaveWrapper.so: undefined reference to `sgx_thread_set_untrusted_event_ocall'
./EnclaveWrapper.so: undefined reference to `sgx_thread_setwait_untrusted_events_ocall'
./EnclaveWrapper.so: undefined reference to `sgx_destroy_enclave'
./EnclaveWrapper.so: undefined reference to `sgx_ecall'
./EnclaveWrapper.so: undefined reference to `sgx_create_enclave'
./EnclaveWrapper.so: undefined reference to `sgx_oc_cpuidex'
./EnclaveWrapper.so: undefined reference to `sgx_thread_set_multiple_untrusted_events_ocall'
./EnclaveWrapper.so: undefined reference to `sgx_thread_wait_untrusted_event_ocall'
collect2: error: ld returned 1 exit status
Which looks like the linkage to Enclave.signed.so has failed.
Now, I do not have so much experience with developing under Linux, so it was tempting to assume this issue is not related to SGX. However I created a simple project in which I'm doing exactly the same linkage but with no SGX involved. It worked like a charm, so it seems I'm doing something not-too-SGXy ;)
Any help appreciated! I intentionally haven't included my code/makefile because I wanted to keep it as simple as possible and also I don't think those are relevant, since code worked on Windows. If needed, I can of course provide source, via GitHub or just by pasting here.
Thanks for your replies!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Printer Friendly Page