Closed ssahai closed 3 years ago
It turns out that the mbedtls
libraries were not being linked in the this command in the Makefile:
clang++-8 -o genquote_enclave attestation.o crypto.o ecalls.o dispatcher.o remoteattestation_t.o -L/opt/openenclave/share/pkgconfig/../../lib/openenclave/enclave -nostdlib -nodefaultlibs -nostartfiles -Wl,--no-undefined -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--export-dynamic -Wl,-pie -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,now -Wl,-gc-sections -loeenclave -loelibcxx -loelibc -loesyscall -loecore
Adding the library flags: -loecryptombedtls -lmbedx509 -lmbedtls -lmbedcrypto
solved majority of undefined references
in the above error snapshot.
The final command that worked:
clang++-8 -o genquote_enclave attestation.o crypto.o ecalls.o dispatcher.o remoteattestation_t.o -L/opt/openenclave/share/pkgconfig/../../lib/openenclave/enclave -nostdlib -nodefaultlibs -nostartfiles -Wl,--no-undefined -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--export-dynamic -Wl,-pie -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,now -Wl,-gc-sections -loeenclave -loelibcxx -loelibc -loecryptombedtls -lmbedx509 -lmbedtls -lmbedcrypto -loecore -loesyscall
However, there is still an undefined reference to: 'time'
. Executing the above command gives the following linker error:
/opt/openenclave/share/pkgconfig/../../lib/openenclave/enclave/libmbedx509.a(x509.c.o): In function `x509_get_current_time':
/source/openenclave/3rdparty/mbedtls/mbedtls/library/x509.c:935: undefined reference to `time'
/source/openenclave/3rdparty/mbedtls/mbedtls/library/x509.c:935: undefined reference to `time'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@ssahai - thank you for reporting and troubleshooting this issue! This issue was caused by changes to the OE SDK to support both mbedtls and openssl crypto libraries, forcing developers to specifically select one or the other.
The issue has been fixed (commit). I've tested on a fresh Azure VM running:
If you have any other issues, don't hesitate to file another issue.
This issue is for a: (mark with an
x
)Getting linker error while building
sgx.attest.sample
.Minimal steps to reproduce
On executing:
Getting a linker error, in the last command for
make build
i.e. this line of the Makefile.OS and Version?
Detailed Output
The output of
make build
command: