1 (edited by abbey_chase 2019-09-23 05:26:10)

Topic: Can't build SGX_Linux sample

After much tribulations, I was able to run make on the SGX_Linux sample: basically, everything WolfSSL related seems to be missing. Here's the output:

-bash-4.2# make all
make -ef sgx_u.mk all
make[1]: Entering directory `/home/builduser/Downloads/wolfssl-examples/SGX_Linux'
GEN  =>  untrusted/Wolfssl_Enclave_u.c
cc -m64 -O2 -fPIC -Wno-attributes -IInclude -I/home/builduser/Downloads/wolfssl-4.1.0/ -I/home/builduser/Downloads/wolfssl-4.1.0/wolfcrypt/ -Iuntrusted -I/home/builduser/Documents/sgxroot/sgxsdk/include -DWOLFSSL_SGX -DNDEBUG -UEDEBUG -UDEBUG -c untrusted/Wolfssl_Enclave_u.c -o untrusted/Wolfssl_Enclave_u.o
CC   <=  untrusted/Wolfssl_Enclave_u.c
cc -m64 -O2 -fPIC -Wno-attributes -IInclude -I/home/builduser/Downloads/wolfssl-4.1.0/ -I/home/builduser/Downloads/wolfssl-4.1.0/wolfcrypt/ -Iuntrusted -I/home/builduser/Documents/sgxroot/sgxsdk/include -DWOLFSSL_SGX -DNDEBUG -UEDEBUG -UDEBUG -c untrusted/App.c -o untrusted/App.o
CC  <=  untrusted/App.c
cc -m64 -O2 -fPIC -Wno-attributes -IInclude -I/home/builduser/Downloads/wolfssl-4.1.0/ -I/home/builduser/Downloads/wolfssl-4.1.0/wolfcrypt/ -Iuntrusted -I/home/builduser/Documents/sgxroot/sgxsdk/include -DWOLFSSL_SGX -DNDEBUG -UEDEBUG -UDEBUG -c untrusted/client-tls.c -o untrusted/client-tls.o
CC  <=  untrusted/client-tls.c
cc -m64 -O2 -fPIC -Wno-attributes -IInclude -I/home/builduser/Downloads/wolfssl-4.1.0/ -I/home/builduser/Downloads/wolfssl-4.1.0/wolfcrypt/ -Iuntrusted -I/home/builduser/Documents/sgxroot/sgxsdk/include -DWOLFSSL_SGX -DNDEBUG -UEDEBUG -UDEBUG -c untrusted/server-tls.c -o untrusted/server-tls.o
CC  <=  untrusted/server-tls.c
LINK =>  App
make[1]: Leaving directory `/home/builduser/Downloads/wolfssl-examples/SGX_Linux'
make -ef sgx_t.mk all
make[1]: Entering directory `/home/builduser/Downloads/wolfssl-examples/SGX_Linux'
GEN  =>  trusted/Wolfssl_Enclave_t.c
CC   <=  trusted/Wolfssl_Enclave_t.c
cc -Wno-implicit-function-declaration -std=c11 -m64 -O2 -nostdinc -fvisibility=hidden -fpie -fstack-protector -IInclude -Itrusted -I/home/builduser/Downloads/wolfssl-4.1.0/ -I/home/builduser/Downloads/wolfssl-4.1.0/wolfcrypt/ -I/home/builduser/Documents/sgxroot/sgxsdk/include -I/home/builduser/Documents/sgxroot/sgxsdk/include/tlibc -I/home/builduser/Documents/sgxroot/sgxsdk/include/stlport-fno-builtin -fno-builtin-printf -I. -DWOLFSSL_SGX -c trusted/Wolfssl_Enclave.c -o trusted/Wolfssl_Enclave.o
CC  <=  trusted/Wolfssl_Enclave.c
-m64 -O2 -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L/home/builduser/Documents/sgxroot/sgxsdk/lib64 -L -lwolfssl.sgx.static.lib -Wl,--whole-archive -lsgx_trts_sim -Wl,--no-whole-archive -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_tcrypto -lsgx_tservice_sim -Wl,--end-group -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-pie,-eenclave_entry -Wl,--export-dynamic -Wl,--defsym,__ImageBase=0 -Wl,--version-script=trusted/Wolfssl_Enclave.lds@
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_new':
Wolfssl_Enclave.c:(.text+0x75): undefined reference to `wolfSSL_METHOD_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_use_certificate_chain_buffer_format':
Wolfssl_Enclave.c:(.text+0xb7): undefined reference to `wolfSSL_CTX_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_use_certificate_buffer':
Wolfssl_Enclave.c:(.text+0x107): undefined reference to `wolfSSL_CTX_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_use_PrivateKey_buffer':
Wolfssl_Enclave.c:(.text+0x157): undefined reference to `wolfSSL_CTX_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_load_verify_buffer':
Wolfssl_Enclave.c:(.text+0x1a7): undefined reference to `wolfSSL_CTX_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_set_cipher_list':
Wolfssl_Enclave.c:(.text+0x1ed): undefined reference to `wolfSSL_CTX_GetObjectSize'
trusted/Wolfssl_Enclave.o:Wolfssl_Enclave.c:(.text+0x225): more undefined references to `wolfSSL_CTX_GetObjectSize' follow
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_set_fd':
Wolfssl_Enclave.c:(.text+0x25c): undefined reference to `wolfSSL_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_connect':
Wolfssl_Enclave.c:(.text+0x295): undefined reference to `wolfSSL_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_write':
Wolfssl_Enclave.c:(.text+0x2ce): undefined reference to `wolfSSL_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_get_error':
Wolfssl_Enclave.c:(.text+0x30c): undefined reference to `wolfSSL_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_read':
Wolfssl_Enclave.c:(.text+0x34e): undefined reference to `wolfSSL_GetObjectSize'
trusted/Wolfssl_Enclave.o:Wolfssl_Enclave.c:(.text+0x385): more undefined references to `wolfSSL_GetObjectSize' follow
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_free':
Wolfssl_Enclave.c:(.text+0x3b5): undefined reference to `wolfSSL_CTX_GetObjectSize'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_Debugging_ON':
Wolfssl_Enclave.c:(.text+0x21): undefined reference to `wolfSSL_Debugging_ON'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_Debugging_OFF':
Wolfssl_Enclave.c:(.text+0x31): undefined reference to `wolfSSL_Debugging_OFF'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_Init':
Wolfssl_Enclave.c:(.text+0x41): undefined reference to `wolfSSL_Init'
trusted/Wolfssl_Enclave.o: In function `enc_wolfTLSv1_2_client_method':
Wolfssl_Enclave.c:(.text+0x51): undefined reference to `wolfTLSv1_2_client_method'
trusted/Wolfssl_Enclave.o: In function `enc_wolfTLSv1_2_server_method':
Wolfssl_Enclave.c:(.text+0x61): undefined reference to `wolfTLSv1_2_server_method'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_new':
Wolfssl_Enclave.c:(.text+0x8e): undefined reference to `wolfSSL_CTX_new'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_use_certificate_chain_buffer_format':
Wolfssl_Enclave.c:(.text+0xe2): undefined reference to `wolfSSL_CTX_use_certificate_chain_buffer_format'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_use_certificate_buffer':
Wolfssl_Enclave.c:(.text+0x132): undefined reference to `wolfSSL_CTX_use_certificate_buffer'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_use_PrivateKey_buffer':
Wolfssl_Enclave.c:(.text+0x182): undefined reference to `wolfSSL_CTX_use_PrivateKey_buffer'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_load_verify_buffer':
Wolfssl_Enclave.c:(.text+0x1d2): undefined reference to `wolfSSL_CTX_load_verify_buffer'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_set_cipher_list':
Wolfssl_Enclave.c:(.text+0x20e): undefined reference to `wolfSSL_CTX_set_cipher_list'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_new':
Wolfssl_Enclave.c:(.text+0x23e): undefined reference to `wolfSSL_new'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_set_fd':
Wolfssl_Enclave.c:(.text+0x27c): undefined reference to `wolfSSL_set_fd'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_connect':
Wolfssl_Enclave.c:(.text+0x2ae): undefined reference to `wolfSSL_connect'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_write':
Wolfssl_Enclave.c:(.text+0x2f0): undefined reference to `wolfSSL_write'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_get_error':
Wolfssl_Enclave.c:(.text+0x32c): undefined reference to `wolfSSL_get_error'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_read':
Wolfssl_Enclave.c:(.text+0x370): undefined reference to `wolfSSL_read'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_free':
Wolfssl_Enclave.c:(.text+0x39e): undefined reference to `wolfSSL_free'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_CTX_free':
Wolfssl_Enclave.c:(.text+0x3ce): undefined reference to `wolfSSL_CTX_free'
trusted/Wolfssl_Enclave.o: In function `enc_wolfSSL_Cleanup':
Wolfssl_Enclave.c:(.text+0x3e1): undefined reference to `wolfSSL_Cleanup'
collect2: error: ld returned 1 exit status
make[1]: *** [Wolfssl_Enclave.so] Error 1
make[1]: Leaving directory `/home/builduser/Downloads/wolfssl-examples/SGX_Linux'
make: *** [all] Error

Any clues?

Note that on line 71 of the Makefile, I had to replace:

-lsgx_tstdcxx

with:

-lsgx_tcxx

Since sgx_tstdcxx doesn't exist anymore in the latest version of the Intel SGX SDK

Share

Re: Can't build SGX_Linux sample

Hi Abbey,

There may be an options.h or some settings in the way. Please try from a fresh directory with the following commands on Linux (plus the one change you did in the Makefile).


(download and unzip wolfssl 4.1.0)
cd wolfssl-4.1.0/IDE/LINUX-SGX
make -f sgx_t_static.mk HAVE_WOLFSSL_TEST=1 HAVE_WOLFSSL_BENCHMARK=1 all
cd ../..

git clone [url]https://github.com/wolfssl/wolfssl-examples[/url]
cd wolfssl-examples/SGX_Linux
#(if SGX_SDK is not already set then)
export SGX_SDK=/opt/intel/sgxsdk
make SGX_MODE=HW SGX_PRERELEASE=1 SGX_WOLFSSL_LIB=../../IDE/LINUX-SGX/ WOLFSSL_ROOT=../../ SGX_DEBUG=0 HAVE_WOLFSSL_TEST=1
./App -t

If the issue persists after a fresh attempt using the above commands let me know and we can dig into it more to debug what is going on.

Regards,
Jacob

Share