Closed yc-huang closed 4 years ago
Can you give me the log with VERBOSE=1
? Like this:
docker run --rm -v $(pwd):/teaclave -w /teaclave \
-it teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:latest \
bash -c ". /root/.cargo/env && \
. /opt/sgxsdk/environment && \
mkdir -p build && cd build && \
cmake -DTEST_MODE=ON -DSGX_SIM_MODE=ON .. && \
make VERBOSE=1"
Following is the log with VERBOSE=1, thanks for you help:
docker run --rm -v $(pwd):/teaclave -w /teaclave \
> -it teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:latest \
> bash -c ". /root/.cargo/env && \
> . /opt/sgxsdk/environment && \
> mkdir -p build && cd build && \
> cmake -DTEST_MODE=ON -DSGX_SIM_MODE=ON .. && \
> make"
-- Submodule update
SGX_SDK=/opt/sgxsdk
SGX_MODE=SW
RUSTUP_TOOLCHAIN=nightly-2020-04-07
DCAP=OFF
BUILD_TYPE=debug
TEACLAVE_SYMLINKS=/tmp/teaclave_symlinks.3wK9WFJtKIG8
-- ====== /teaclave/build/environment GENERATED ======
-- Configuring done
-- Generating done
-- Build files have been written to: /teaclave/build
[ 0%] Built target prep
[ 12%] Built target pycomponent
[ 16%] Building sgxlib-teaclave_unit_tests, enclave info to /teaclave/build/intermediate/teaclave_unit_tests_enclave_info.toml
Compiling crc v2.0.0
error: could not compile `crc`.
Caused by:
process didn't exit successfully: `/teaclave/cmake/scripts/rustc_wrapper.sh --crate-name crc --edition=2018 /teaclave/build/cmake_tomls/sgx_trusted_lib/third_party/crates-sgx/vendor/crc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=00442ba3caacd126 -C extra-filename=-00442ba3caacd126 --out-dir /teaclave/build/target/trusted/debug/deps -L dependency=/teaclave/build/target/trusted/debug/deps --cap-lints allow --cfg test_mode --cfg sgx_sim --cfg test_mode` (signal: 9, SIGKILL: kill)
/usr/bin/ld: cannot find -lteaclave_unit_tests_enclave
collect2: error: ld returned 1 exit status
CMakeFiles/sgxlib-teaclave_unit_tests.dir/build.make:57: recipe for target 'CMakeFiles/sgxlib-teaclave_unit_tests' failed
make[2]: *** [CMakeFiles/sgxlib-teaclave_unit_tests] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/sgxlib-teaclave_unit_tests.dir/all' failed
make[1]: *** [CMakeFiles/sgxlib-teaclave_unit_tests.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
[centos@ip-172-31-19-164 incubator-teaclave]$ docker run --rm -v $(pwd):/teaclave -w /teaclave \
> -it teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:latest \
> bash -c ". /root/.cargo/env && \
> . /opt/sgxsdk/environment && \
> mkdir -p build && cd build && \
> cmake -DTEST_MODE=ON -DSGX_SIM_MODE=ON .. && \
> make VERBOSE=1"
-- Submodule update
SGX_SDK=/opt/sgxsdk
SGX_MODE=SW
RUSTUP_TOOLCHAIN=nightly-2020-04-07
DCAP=OFF
BUILD_TYPE=debug
TEACLAVE_SYMLINKS=/tmp/teaclave_symlinks.yV1IxJrrQAGG
-- ====== /teaclave/build/environment GENERATED ======
-- Configuring done
-- Generating done
-- Build files have been written to: /teaclave/build
/usr/bin/cmake -H/teaclave -B/teaclave/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /teaclave/build/CMakeFiles /teaclave/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/teaclave/build'
make -f CMakeFiles/prep.dir/build.make CMakeFiles/prep.dir/depend
make[2]: Entering directory '/teaclave/build'
cd /teaclave/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /teaclave /teaclave /teaclave/build /teaclave/build /teaclave/build/CMakeFiles/prep.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/teaclave/build'
make -f CMakeFiles/prep.dir/build.make CMakeFiles/prep.dir/build
make[2]: Entering directory '/teaclave/build'
/usr/bin/cmake -E env TEACLAVE_PROJECT_ROOT=/teaclave TEACLAVE_BUILD_ROOT=/teaclave/build TEACLAVE_OUT_DIR=/teaclave/build/intermediate TEACLAVE_SERVICE_INSTALL_DIR=/teaclave/release/services TEACLAVE_EXAMPLE_INSTALL_DIR=/teaclave/release/examples TEACLAVE_BIN_INSTALL_DIR=/teaclave/release/bin TEACLAVE_CLI_INSTALL_DIR=/teaclave/release/cli TEACLAVE_DCAP_INSTALL_DIR=/teaclave/release/dcap TEACLAVE_LIB_INSTALL_DIR=/teaclave/release/lib TEACLAVE_DOC_INSTALL_DIR=/teaclave/release/docs TEACLAVE_TEST_INSTALL_DIR=/teaclave/release/tests TEACLAVE_AUDITORS_DIR=/teaclave/release/services/auditors TEACLAVE_EXAMPLE_AUDITORS_DIR=/teaclave/release/examples/auditors TEACLAVE_TARGET_DIR=/teaclave/build/target TEACLAVE_CFG_DIR=/teaclave TEACLAVE_BUILD_CFG_DIR=/teaclave TEACLAVE_EDL_DIR=/teaclave/edl TEACLAVE_SYMLINKS=/tmp/teaclave_symlinks.yV1IxJrrQAGG SGX_SDK=/opt/sgxsdk SGX_MODE=SW DCAP=OFF ENCLAVE_OUT_DIR=/teaclave/build/intermediate RUSTUP_TOOLCHAIN=nightly-2020-04-07 RUST_SGX_SDK=/teaclave/third_party/rust-sgx-sdk MT_SCRIPT_DIR=/teaclave/cmake/scripts MT_SGXAPP_TOML_DIR=/teaclave/build/cmake_tomls/sgx_untrusted_app CARGO_INCREMENTAL= CMAKE_C_COMPILER=/usr/bin/cc CC=/teaclave/cmake/scripts/cc_wrapper.sh MT_RUSTC_WRAPPER=/teaclave/cmake/scripts/rustc_wrapper.sh CMAKE_SOURCE_DIR=/teaclave CMAKE_BINARY_DIR=/teaclave/build MESAPY_VERSION=eb769f13d6f9947b62aa04c2fb34496082bdadeb SGX_EDGER8R=/opt/sgxsdk/bin/x64/sgx_edger8r CMAKE_AR=/usr/bin/ar DCAP=OFF SGX_UNTRUSTED_CFLAGS=-m64\ -O2\ -fPIC\ -Wno-attributes\ -I/opt/sgxsdk/include\ -I/teaclave/third_party/rust-sgx-sdk/edl SGX_TRUSTED_CFLAGS=-m64\ -O2\ -nostdinc\ -fvisibility=hidden\ -fpie\ -fstack-protector\ -I/teaclave/third_party/rust-sgx-sdk/edl\ -I/teaclave/third_party/rust-sgx-sdk/common/inc\ -I/opt/sgxsdk/include\ -I/opt/sgxsdk/include/tlibc\ -I/opt/sgxsdk/include/stlport\ -I/opt/sgxsdk/include/epid /teaclave/cmake/scripts/prep.sh
make[2]: Leaving directory '/teaclave/build'
[ 0%] Built target prep
make -f CMakeFiles/pycomponent.dir/build.make CMakeFiles/pycomponent.dir/depend
make[2]: Entering directory '/teaclave/build'
cd /teaclave/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /teaclave /teaclave /teaclave/build /teaclave/build /teaclave/build/CMakeFiles/pycomponent.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/teaclave/build'
make -f CMakeFiles/pycomponent.dir/build.make CMakeFiles/pycomponent.dir/build
make[2]: Entering directory '/teaclave/build'
make[2]: Nothing to be done for 'CMakeFiles/pycomponent.dir/build'.
make[2]: Leaving directory '/teaclave/build'
[ 12%] Built target pycomponent
make -f CMakeFiles/sgxlib-teaclave_unit_tests.dir/build.make CMakeFiles/sgxlib-teaclave_unit_tests.dir/depend
make[2]: Entering directory '/teaclave/build'
cd /teaclave/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /teaclave /teaclave /teaclave/build /teaclave/build /teaclave/build/CMakeFiles/sgxlib-teaclave_unit_tests.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/teaclave/build'
make -f CMakeFiles/sgxlib-teaclave_unit_tests.dir/build.make CMakeFiles/sgxlib-teaclave_unit_tests.dir/build
make[2]: Entering directory '/teaclave/build'
[ 16%] Building sgxlib-teaclave_unit_tests, enclave info to /teaclave/build/intermediate/teaclave_unit_tests_enclave_info.toml
cd /teaclave/build/cmake_tomls/sgx_trusted_lib && /usr/bin/cmake -E env TEACLAVE_PROJECT_ROOT=/teaclave TEACLAVE_BUILD_ROOT=/teaclave/build TEACLAVE_OUT_DIR=/teaclave/build/intermediate TEACLAVE_SERVICE_INSTALL_DIR=/teaclave/release/services TEACLAVE_EXAMPLE_INSTALL_DIR=/teaclave/release/examples TEACLAVE_BIN_INSTALL_DIR=/teaclave/release/bin TEACLAVE_CLI_INSTALL_DIR=/teaclave/release/cli TEACLAVE_DCAP_INSTALL_DIR=/teaclave/release/dcap TEACLAVE_LIB_INSTALL_DIR=/teaclave/release/lib TEACLAVE_DOC_INSTALL_DIR=/teaclave/release/docs TEACLAVE_TEST_INSTALL_DIR=/teaclave/release/tests TEACLAVE_AUDITORS_DIR=/teaclave/release/services/auditors TEACLAVE_EXAMPLE_AUDITORS_DIR=/teaclave/release/examples/auditors TEACLAVE_TARGET_DIR=/teaclave/build/target TEACLAVE_CFG_DIR=/teaclave TEACLAVE_BUILD_CFG_DIR=/teaclave TEACLAVE_EDL_DIR=/teaclave/edl TEACLAVE_SYMLINKS=/tmp/teaclave_symlinks.yV1IxJrrQAGG SGX_SDK=/opt/sgxsdk SGX_MODE=SW DCAP=OFF ENCLAVE_OUT_DIR=/teaclave/build/intermediate RUSTUP_TOOLCHAIN=nightly-2020-04-07 RUST_SGX_SDK=/teaclave/third_party/rust-sgx-sdk MT_SCRIPT_DIR=/teaclave/cmake/scripts MT_SGXAPP_TOML_DIR=/teaclave/build/cmake_tomls/sgx_untrusted_app CARGO_INCREMENTAL= CMAKE_C_COMPILER=/usr/bin/cc CC=/teaclave/cmake/scripts/cc_wrapper.sh MT_RUSTC_WRAPPER=/teaclave/cmake/scripts/rustc_wrapper.sh RUSTFLAGS=\ --cfg\ test_mode\ --cfg\ sgx_sim\ --cfg\ test_mode /teaclave/cmake/scripts/cargo_build_ex.sh -p teaclave_unit_tests_enclave --target-dir /teaclave/build/target/trusted -Z package-features --features mesalock_sgx
Compiling crc v2.0.0
error: could not compile `crc`.
Caused by:
process didn't exit successfully: `/teaclave/cmake/scripts/rustc_wrapper.sh --crate-name crc --edition=2018 /teaclave/build/cmake_tomls/sgx_trusted_lib/third_party/crates-sgx/vendor/crc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=00442ba3caacd126 -C extra-filename=-00442ba3caacd126 --out-dir /teaclave/build/target/trusted/debug/deps -L dependency=/teaclave/build/target/trusted/debug/deps --cap-lints allow --cfg test_mode --cfg sgx_sim --cfg test_mode` (signal: 9, SIGKILL: kill)
cd /teaclave/build/cmake_tomls/sgx_trusted_lib && /usr/bin/cmake -E env TEACLAVE_PROJECT_ROOT=/teaclave TEACLAVE_BUILD_ROOT=/teaclave/build TEACLAVE_OUT_DIR=/teaclave/build/intermediate TEACLAVE_SERVICE_INSTALL_DIR=/teaclave/release/services TEACLAVE_EXAMPLE_INSTALL_DIR=/teaclave/release/examples TEACLAVE_BIN_INSTALL_DIR=/teaclave/release/bin TEACLAVE_CLI_INSTALL_DIR=/teaclave/release/cli TEACLAVE_DCAP_INSTALL_DIR=/teaclave/release/dcap TEACLAVE_LIB_INSTALL_DIR=/teaclave/release/lib TEACLAVE_DOC_INSTALL_DIR=/teaclave/release/docs TEACLAVE_TEST_INSTALL_DIR=/teaclave/release/tests TEACLAVE_AUDITORS_DIR=/teaclave/release/services/auditors TEACLAVE_EXAMPLE_AUDITORS_DIR=/teaclave/release/examples/auditors TEACLAVE_TARGET_DIR=/teaclave/build/target TEACLAVE_CFG_DIR=/teaclave TEACLAVE_BUILD_CFG_DIR=/teaclave TEACLAVE_EDL_DIR=/teaclave/edl TEACLAVE_SYMLINKS=/tmp/teaclave_symlinks.yV1IxJrrQAGG SGX_SDK=/opt/sgxsdk SGX_MODE=SW DCAP=OFF ENCLAVE_OUT_DIR=/teaclave/build/intermediate RUSTUP_TOOLCHAIN=nightly-2020-04-07 RUST_SGX_SDK=/teaclave/third_party/rust-sgx-sdk MT_SCRIPT_DIR=/teaclave/cmake/scripts MT_SGXAPP_TOML_DIR=/teaclave/build/cmake_tomls/sgx_untrusted_app CARGO_INCREMENTAL= CMAKE_C_COMPILER=/usr/bin/cc CC=/teaclave/cmake/scripts/cc_wrapper.sh MT_RUSTC_WRAPPER=/teaclave/cmake/scripts/rustc_wrapper.sh SGX_LIBRARY_PATH=/opt/sgxsdk/lib64 SGX_ENCLAVE_SIGNER=/opt/sgxsdk/bin/x64/sgx_sign Service_Library_Name=sgx_tservice_sim Trts_Library_Name=sgx_trts_sim TRUSTED_TARGET_DIR=/teaclave/build/target/trusted TARGET=debug SGX_COMMON_CFLAGS=-m64\ -O2 CUR_PKG_NAME=teaclave_unit_tests_enclave CUR_PKG_PATH=tests/unit/enclave CUR_INSTALL_DIR=/teaclave/release/tests /teaclave/cmake/scripts/sgx_link_sign.sh Enclave_fa_t
/usr/bin/ld: cannot find -lteaclave_unit_tests_enclave
collect2: error: ld returned 1 exit status
CMakeFiles/sgxlib-teaclave_unit_tests.dir/build.make:57: recipe for target 'CMakeFiles/sgxlib-teaclave_unit_tests' failed
make[2]: *** [CMakeFiles/sgxlib-teaclave_unit_tests] Error 1
make[2]: Leaving directory '/teaclave/build'
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/sgxlib-teaclave_unit_tests.dir/all' failed
make[1]: *** [CMakeFiles/sgxlib-teaclave_unit_tests.dir/all] Error 2
make[1]: Leaving directory '/teaclave/build'
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
not sure why it's SIGKILL, try start container with --oom-kill-disable and remain the same error...
Yes, this is very wired. I can compile it with the exact same command in a 32G memory PC.
How about directly build with the compilation command?
/teaclave/cmake/scripts/rustc_wrapper.sh --crate-name crc --edition=2018 /teaclave/build/cmake_tomls/sgx_trusted_lib/third_party/crates-sgx/vendor/crc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=00442ba3caacd126 -C extra-filename=-00442ba3caacd126 --out-dir /teaclave/build/target/trusted/debug/deps -L dependency=/teaclave/build/target/trusted/debug/deps --cap-lints allow --cfg test_mode --cfg sgx_sim --cfg test_mode
It runs with no output and then get killed...
I'm running this on a small aws node, I guess I might need to increase the hardware resource first...
Tried this on a new aws instance with 8GB memory and everything looks good now, thank you @mssun for your prompt help.
I'm following the document to try to setup a teeclave environment but failed with build errors, any suggestions? Thanks.