Search code examples
c++visual-c++sgx

SGX demo application doesn't compile


Through Visual Studio SGX plugin, I created a demo application whose EDL is the following:

enclave {
    from "sgx_tstdc.edl" import *;
    trusted {
        public char* sign([in, string] const char* message, unsigned saltLength);
};
    untrusted { };
};

The sign function, right now, just returns a nullptr, so it shouldn't be the problem.

When I try to compile it with MSVC, it gives me the error _mm_lfence identifier not found.

This function is automatically used by the SGX proxy function and I have no control over it.

Any clue on what is going on?


Solution

  • After various tests, I noticed that MSVC as well as Intel compiler, tried to compile the file as C++ file, while it was plain C.

    Manually setting C as target, solved the issue.

    Hope this helps future readers.