apache / incubator-teaclave-sgx-sdk

Apache Teaclave (incubating) SGX SDK helps developers to write Intel SGX applications in the Rust programming language, and also known as Rust SGX SDK.
https://teaclave.apache.org
Apache License 2.0
1.17k stars 263 forks source link

Build sgx_unwind v1.15 falied #404

Closed Marky-Shi closed 2 years ago

Marky-Shi commented 2 years ago

When I compiled sgx_unwind I encountered some errors, here is the configuration of my machine, I hope you can help solve it, thank you very much. OS:ubuntu 20.04 Rust : rustc 1.61.0-nightly (458262b13 2022-03-09) Intel sgx sdk version: 2.17 sgx driver version: 2.11.054c9c4c

 --- stderr
  autoreconf: Entering directory `.'
  autoreconf: configure.ac: not using Gettext
  autoreconf: running: aclocal --force
  autoreconf: configure.ac: tracing
  autoreconf: running: libtoolize --copy --force
  autoreconf: running: /usr/bin/autoconf --force
  autoreconf: running: /usr/bin/autoheader --force
  autoreconf: running: automake --add-missing --copy --force-missing
  configure.ac:18: installing 'config/compile'
  configure.ac:11: installing 'config/missing'
  src/Makefile.am:371: warning: whitespace following trailing backslash
  src/Makefile.am:372: warning: whitespace following trailing backslash
  src/Makefile.am: installing 'config/depcomp'
  src/Makefile.am:165: warning: variable 'libunwind_dwarf_generic_la_SOURCES' is defined but no program or
  src/Makefile.am:165: library has 'libunwind_dwarf_generic_la' as canonical name (possible typo)
  src/Makefile.am:619: warning: variable 'libunwind_x86_64_la_SOURCES' is defined but no program or
  src/Makefile.am:619: library has 'libunwind_x86_64_la' as canonical name (possible typo)
  src/Makefile.am:168: warning: variable 'libunwind_dwarf_generic_la_LIBADD' is defined but no program or
  src/Makefile.am:168: library has 'libunwind_dwarf_generic_la' as canonical name (possible typo)
  src/Makefile.am:621: warning: variable 'libunwind_x86_64_la_LIBADD' is defined but no program or
  src/Makefile.am:621: library has 'libunwind_x86_64_la' as canonical name (possible typo)
  src/Makefile.am:620: warning: variable 'libunwind_x86_64_la_LDFLAGS' is defined but no program or
  src/Makefile.am:620: library has 'libunwind_x86_64_la' as canonical name (possible typo)
  autoreconf: Leaving directory `.'
  grep: ./configure: No such file or directory
  grep: ./configure: No such file or directory
  expr: syntax error: unexpected argument ‘30’
  sed: -e expression #1, char 1: unknown command: `,'
  grep: ./configure: No such file or directory
  expr: syntax error: unexpected argument ‘30’
  sed: -e expression #1, char 1: unknown command: `,'
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lfind_dynamic_proc_info.c:1: warning: "UNW_LOCAL_ONLY" redefined
      1 | #define UNW_LOCAL_ONLY
        |
  <command-line>: note: this is the location of the previous definition
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lget_accessors.c:1: warning: "UNW_LOCAL_ONLY" redefined
      1 | #define UNW_LOCAL_ONLY
        |
  <command-line>: note: this is the location of the previous definition
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/x86_64/Los-linux.c:1: warning: "UNW_LOCAL_ONLY" redefined
      1 | #define UNW_LOCAL_ONLY
        |
  <command-line>: note: this is the location of the previous definition
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lget_proc_name.c:1: warning: "UNW_LOCAL_ONLY" redefined
      1 | #define UNW_LOCAL_ONLY
        |
  <command-line>: note: this is the location of the previous definition
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/init.c:26:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lget_proc_info_by_ip.c:1: warning: "UNW_LOCAL_ONLY" redefined
      1 | #define UNW_LOCAL_ONLY
        |
  <command-line>: note: this is the location of the previous definition
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Gfind_dynamic_proc_info.c:26,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lfind_dynamic_proc_info.c:4:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Ldyn-extract.c:1: warning: "UNW_LOCAL_ONLY" redefined
      1 | #define UNW_LOCAL_ONLY
        |
  <command-line>: note: this is the location of the previous definition
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Gget_accessors.c:26,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lget_accessors.c:4:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/mempool.c:27:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/x86_64/unwind_i.h:35,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/x86_64/Gos-linux.c:28,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/x86_64/Los-linux.c:4:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Gget_proc_name.c:26,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lget_proc_name.c:4:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/x86_64/is_fpreg.c:28:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/os-linux.c:29:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/dyn-info-list.c:26:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  make[4]: *** [Makefile:1765: mi/init.lo] Error 1
  make[4]: *** Waiting for unfinished jobs....
  make[4]: *** [Makefile:1765: mi/Lfind_dynamic_proc_info.lo] Error 1
  make[4]: *** [Makefile:1765: mi/Lget_accessors.lo] Error 1
  make[4]: *** [Makefile:1765: mi/Lget_proc_name.lo] Error 1
  make[4]: *** [Makefile:1765: mi/mempool.lo] Error 1
  make[4]: *** [Makefile:1765: x86_64/Los-linux.lo] Error 1
  make[4]: *** [Makefile:1765: x86_64/is_fpreg.lo] Error 1
  make[4]: *** [Makefile:1765: mi/dyn-info-list.lo] Error 1
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Gget_proc_info_by_ip.c:26,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Lget_proc_info_by_ip.c:4:  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  make[4]: *** [Makefile:1765: os-linux.lo] Error 1
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/flush_cache.c:26:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  In file included from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread.h:37,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/libunwind_i.h:52,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Gdyn-extract.c:26,
                   from /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/src/mi/Ldyn-extract.c:4:
  /home/Scc/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/d2d339c/sgx_unwind/../sgx_unwind/libunwind/include/pthread_compat.h:39:10: fatal error: sgx_spinlock.h: No such file or directory
     39 | #include "sgx_spinlock.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  make[4]: *** [Makefile:1765: mi/Lget_proc_info_by_ip.lo] Error 1
  make[4]: *** [Makefile:1765: mi/flush_cache.lo] Error 1
  make[4]: *** [Makefile:1765: mi/Ldyn-extract.lo] Error 1
  make[3]: *** [Makefile:1225: all] Error 2
  make[2]: *** [Makefile:592: all-recursive] Error 1
make[1]: *** [Makefile:61: libenclave.a] Error 101
make[1]: Leaving directory '/home/Scc/Scc-project/tee-worker/enclave-runtime'
make: *** [Makefile:208: enclave] Error 2
Marky-Shi commented 2 years ago

This may have something to do with the SGX environment settings on my machine, and when I compile in source code, the terminal will return such an error. Then I tried to introduce the missing file as an absolute path and the compilation passed.

hiroki-chen commented 2 years ago

A recommended way would be to add a line to your shell rc file, like this echo "source /opt/intel/sgxsdk/environment" >> ~/.zshrc (I'm using zsh). This would automatically set all the needed environment variables to proper values.