Closed bl4ck5un closed 6 years ago
Hi Fan, did you pull the latest baiduxlab/sgx-rust? Here is my running log
node10 ding ~ sgx rust-sgx-sdk docker pull baiduxlab/sgx-rust
Using default tag: latest
latest: Pulling from baiduxlab/sgx-rust
Digest: sha256:2388efbbfdae5decab59953a14e15dfbbde96b830a24b6c510946929b38a278d
Status: Image is up to date for baiduxlab/sgx-rust:latest
node10 ding ~ sgx rust-sgx-sdk docker run -ti --rm -v /home/ding/sgx/rust-sgx-sdk:/root/sgx --device /dev/isgx baiduxlab/sgx-rust
root@d7747378919e:~# cd sgx/third_party/
root@d7747378919e:~/sgx/third_party# git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
root@d7747378919e:~/sgx/third_party# cd ..
root@d7747378919e:~/sgx# git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
root@d7747378919e:~/sgx# cd samplecode/helloworld/
root@d7747378919e:~/sgx/samplecode/helloworld# make
/opt/sgxsdk/bin/x64/sgx_edger8r --trusted enclave/Enclave.edl --search-path /opt/sgxsdk/include --search-path ../../edl --trusted-dir enclave
/opt/sgxsdk/bin/x64/sgx_edger8r --untrusted enclave/Enclave.edl --search-path /opt/sgxsdk/include --search-path ../../edl --untrusted-dir app
GEN => enclave/Enclave_t.c enclave/Enclave_t.h app/Enclave_u.c app/Enclave_u.h
CC <= app/Enclave_u.c
CXX <= app/app.c
make -C ../../sgx_ustdc/ 2> /dev/null
make[1]: Entering directory '/root/sgx/sgx_ustdc'
cc -c -O2 -fPIC -Wno-attributes backtrace.c -o backtrace.o
cc -c -O2 -fPIC -Wno-attributes env.c -o env.o
cc -c -O2 -fPIC -Wno-attributes fs.c -o fs.o
cc -c -O2 -fPIC -Wno-attributes net.c -o net.o
cc -c -O2 -fPIC -Wno-attributes stdio.c -o stdio.o
cc -c -O2 -fPIC -Wno-attributes time.c -o time.o
ar rcsD libsgx_ustdc.a backtrace.o env.o fs.o net.o stdio.o time.o
make[1]: Leaving directory '/root/sgx/sgx_ustdc'
cp ../../sgx_ustdc/libsgx_ustdc.a ./lib
LINK => bin/app
make -C ./enclave/
make[1]: Entering directory '/root/sgx/samplecode/helloworld/enclave'
cargo build --release
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading filetime v0.1.15
Compiling cfg-if v0.1.2
Compiling sgx_types v0.9.6 (file:///root/sgx/sgx_types)
Compiling unwind v0.0.0 (file:///root/sgx/libunwind)
Compiling libc v0.2.36
Compiling sgx_trts v0.9.6 (file:///root/sgx/sgx_trts)
Compiling filetime v0.1.15
Compiling sgx_tprotected_fs v0.9.6 (file:///root/sgx/sgx_tprotected_fs)
Compiling sgx_alloc v0.9.6 (file:///root/sgx/sgx_alloc)
Compiling build_helper v0.1.0 (file:///root/sgx/build_helper)
Compiling sgx_tstd v0.9.6 (file:///root/sgx/sgx_tstd)
Compiling Helloworldsampleenclave v0.9.6 (file:///root/sgx/samplecode/helloworld/enclave)
Finished release [optimized] target(s) in 5.69 secs
cp ./target/release/libhelloworldsampleenclave.a ../lib/libenclave.a
make[1]: Leaving directory '/root/sgx/samplecode/helloworld/enclave'
make -C ../../compiler-rt/ 2> /dev/null
make[1]: Entering directory '/root/sgx/compiler-rt'
cc -c -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants -fstack-protector -O2 -UDEBUG -DNDEBUG -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type -Waddress -Wsequence-point -Wformat-security -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow -Wcast-align -Wconversion -Wredundant-decls -DITT_ARCH_IA64 -ffreestanding -nostdinc -fvisibility=hidden -fpie -O2 -I../common/inc/ muloti4.c -o muloti4.o
ar rcsD libcompiler-rt-patch.a muloti4.o
make[1]: Leaving directory '/root/sgx/compiler-rt'
CC <= enclave/Enclave_t.c
cp ../../compiler-rt/libcompiler-rt-patch.a ./lib
LINK => enclave/enclave.so
<!-- Please refer to User's Guide for the explanation of each field -->
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<StackMaxSize>0x40000</StackMaxSize>
<HeapMaxSize>0x100000</HeapMaxSize>
<TCSNum>1</TCSNum>
<TCSPolicy>1</TCSPolicy>
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
tcs_num 1, tcs_max_num 1, tcs_min_pool 1
The required memory is 1622016B.
Succeed.
SIGN => bin/enclave.signed.so
root@d7747378919e:~/sgx/samplecode/helloworld#
For sgx-rust-experimental, it should work as well:
node10 ding ~ sgx rust-sgx-sdk docker run -ti --rm -v /home/ding/sgx/rust-sgx-sdk:/root/sgx --device /dev/isgx baiduxlab/sgx-rust-experimental
root@884a37db789c:~# cd sgx/samplecode/helloworld/
root@884a37db789c:~/sgx/samplecode/helloworld# make
/opt/sgxsdk/bin/x64/sgx_edger8r --trusted enclave/Enclave.edl --search-path /opt/sgxsdk/include --search-path ../../edl --trusted-dir enclave
/opt/sgxsdk/bin/x64/sgx_edger8r --untrusted enclave/Enclave.edl --search-path /opt/sgxsdk/include --search-path ../../edl --untrusted-dir app
GEN => enclave/Enclave_t.c enclave/Enclave_t.h app/Enclave_u.c app/Enclave_u.h
CC <= app/Enclave_u.c
CXX <= app/app.c
make -C ../../sgx_ustdc/ 2> /dev/null
make[1]: Entering directory '/root/sgx/sgx_ustdc'
cc -c -O2 -fPIC -Wno-attributes backtrace.c -o backtrace.o
cc -c -O2 -fPIC -Wno-attributes env.c -o env.o
cc -c -O2 -fPIC -Wno-attributes fs.c -o fs.o
cc -c -O2 -fPIC -Wno-attributes net.c -o net.o
cc -c -O2 -fPIC -Wno-attributes stdio.c -o stdio.o
cc -c -O2 -fPIC -Wno-attributes time.c -o time.o
ar rcsD libsgx_ustdc.a backtrace.o env.o fs.o net.o stdio.o time.o
make[1]: Leaving directory '/root/sgx/sgx_ustdc'
cp ../../sgx_ustdc/libsgx_ustdc.a ./lib
LINK => bin/app
make -C ./enclave/
make[1]: Entering directory '/root/sgx/samplecode/helloworld/enclave'
cargo build --release
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading filetime v0.1.15
Compiling unwind v0.0.0 (file:///root/sgx/libunwind)
Compiling cfg-if v0.1.2
Compiling libc v0.2.36
Compiling sgx_types v0.9.6 (file:///root/sgx/sgx_types)
Compiling sgx_trts v0.9.6 (file:///root/sgx/sgx_trts)
Compiling filetime v0.1.15
Compiling build_helper v0.1.0 (file:///root/sgx/build_helper)
Compiling sgx_alloc v0.9.6 (file:///root/sgx/sgx_alloc)
Compiling sgx_tprotected_fs v0.9.6 (file:///root/sgx/sgx_tprotected_fs)
Compiling sgx_tstd v0.9.6 (file:///root/sgx/sgx_tstd)
Compiling Helloworldsampleenclave v0.9.6 (file:///root/sgx/samplecode/helloworld/enclave)
Finished release [optimized] target(s) in 5.67 secs
cp ./target/release/libhelloworldsampleenclave.a ../lib/libenclave.a
make[1]: Leaving directory '/root/sgx/samplecode/helloworld/enclave'
make -C ../../compiler-rt/ 2> /dev/null
make[1]: Entering directory '/root/sgx/compiler-rt'
cc -c -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants -fstack-protector -O2 -UDEBUG -DNDEBUG -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type -Waddress -Wsequence-point -Wformat-security -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow -Wcast-align -Wconversion -Wredundant-decls -DITT_ARCH_IA64 -ffreestanding -nostdinc -fvisibility=hidden -fpie -O2 -I../common/inc/ muloti4.c -o muloti4.o
ar rcsD libcompiler-rt-patch.a muloti4.o
make[1]: Leaving directory '/root/sgx/compiler-rt'
CC <= enclave/Enclave_t.c
cp ../../compiler-rt/libcompiler-rt-patch.a ./lib
LINK => enclave/enclave.so
<!-- Please refer to User's Guide for the explanation of each field -->
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<StackMaxSize>0x40000</StackMaxSize>
<HeapMaxSize>0x100000</HeapMaxSize>
<TCSNum>1</TCSNum>
<TCSPolicy>1</TCSPolicy>
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
tcs_num 1, tcs_max_num 1, tcs_min_pool 1
The required memory is 1622016B.
Succeed.
SIGN => bin/enclave.signed.so
root@884a37db789c:~/sgx/samplecode/helloworld#
That's really weird.
fanz@dhcp-rhodes-3057 ~ $ docker pull baiduxlab/sgx-rust
Using default tag: latest
latest: Pulling from baiduxlab/sgx-rust
Digest: sha256:2388efbbfdae5decab59953a14e15dfbbde96b830a24b6c510946929b38a278d
Status: Image is up to date for baiduxlab/sgx-rust:latest
root@5f834a289889:~/sgx/samplecode/helloworld# make
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
Makefile:149: recipe for target 'app/app.o' failed
make: *** [app/app.o] Error 4
If it works for you, then it's probably something with my Docker? I can try it on my Linux host later.
The docker image + current repo code work on my macbook (macOS + docker for mac 17.03.1-ce).
ding … baidu x-lab rust-sgx-sdk uname -a
Darwin dingyu-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
ding … baidu x-lab rust-sgx-sdk docker run --rm -ti -v /Users/ding/sgx/baidu/x-lab/rust-sgx-sdk:/root/sgx baiduxlab/sgx-rust
root@741307a10214:~# cd sgx/
root@741307a10214:~/sgx# git clean -fxd
Removing compiler-rt/libcompiler-rt-patch.a
Removing compiler-rt/muloti4.o
Removing samplecode/helloworld/app/Enclave_u.c
Removing samplecode/helloworld/app/Enclave_u.h
Removing samplecode/helloworld/app/Enclave_u.o
Removing samplecode/helloworld/app/app.o
Removing samplecode/helloworld/bin/app
Removing samplecode/helloworld/bin/enclave.signed.so
Removing samplecode/helloworld/enclave/Cargo.lock
Removing samplecode/helloworld/enclave/Enclave_t.c
Removing samplecode/helloworld/enclave/Enclave_t.h
Removing samplecode/helloworld/enclave/Enclave_t.o
Removing samplecode/helloworld/enclave/enclave.so
Removing samplecode/helloworld/enclave/target/
Removing samplecode/helloworld/lib/libcompiler-rt-patch.a
Removing samplecode/helloworld/lib/libenclave.a
Removing samplecode/helloworld/lib/libsgx_ustdc.a
Removing sgx_ustdc/backtrace.o
Removing sgx_ustdc/env.o
Removing sgx_ustdc/fs.o
Removing sgx_ustdc/libsgx_ustdc.a
Removing sgx_ustdc/net.o
Removing sgx_ustdc/stdio.o
Removing sgx_ustdc/time.o
root@741307a10214:~/sgx# git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
root@741307a10214:~/sgx# cd samplecode/helloworld/
root@741307a10214:~/sgx/samplecode/helloworld# make
/opt/sgxsdk/bin/x64/sgx_edger8r --trusted enclave/Enclave.edl --search-path /opt/sgxsdk/include --search-path ../../edl --trusted-dir enclave
/opt/sgxsdk/bin/x64/sgx_edger8r --untrusted enclave/Enclave.edl --search-path /opt/sgxsdk/include --search-path ../../edl --untrusted-dir app
GEN => enclave/Enclave_t.c enclave/Enclave_t.h app/Enclave_u.c app/Enclave_u.h
CC <= app/Enclave_u.c
CXX <= app/app.c
make -C ../../sgx_ustdc/ 2> /dev/null
make[1]: Entering directory '/root/sgx/sgx_ustdc'
cc -c -O2 -fPIC -Wno-attributes backtrace.c -o backtrace.o
cc -c -O2 -fPIC -Wno-attributes env.c -o env.o
cc -c -O2 -fPIC -Wno-attributes fs.c -o fs.o
cc -c -O2 -fPIC -Wno-attributes net.c -o net.o
cc -c -O2 -fPIC -Wno-attributes stdio.c -o stdio.o
cc -c -O2 -fPIC -Wno-attributes time.c -o time.o
ar rcsD libsgx_ustdc.a backtrace.o env.o fs.o net.o stdio.o time.o
make[1]: Leaving directory '/root/sgx/sgx_ustdc'
cp ../../sgx_ustdc/libsgx_ustdc.a ./lib
LINK => bin/app
make -C ./enclave/
make[1]: Entering directory '/root/sgx/samplecode/helloworld/enclave'
cargo build --release
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading filetime v0.1.15
Compiling libc v0.2.36
Compiling unwind v0.0.0 (file:///root/sgx/libunwind)
Compiling sgx_types v0.9.6 (file:///root/sgx/sgx_types)
Compiling cfg-if v0.1.2
Compiling sgx_trts v0.9.6 (file:///root/sgx/sgx_trts)
Compiling filetime v0.1.15
Compiling sgx_tprotected_fs v0.9.6 (file:///root/sgx/sgx_tprotected_fs)
Compiling sgx_alloc v0.9.6 (file:///root/sgx/sgx_alloc)
Compiling build_helper v0.1.0 (file:///root/sgx/build_helper)
Compiling sgx_tstd v0.9.6 (file:///root/sgx/sgx_tstd)
Compiling Helloworldsampleenclave v0.9.6 (file:///root/sgx/samplecode/helloworld/enclave)
Finished release [optimized] target(s) in 9.76 secs
cp ./target/release/libhelloworldsampleenclave.a ../lib/libenclave.a
make[1]: Leaving directory '/root/sgx/samplecode/helloworld/enclave'
make -C ../../compiler-rt/ 2> /dev/null
make[1]: Entering directory '/root/sgx/compiler-rt'
cc -c -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants -fstack-protector -O2 -UDEBUG -DNDEBUG -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type -Waddress -Wsequence-point -Wformat-security -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow -Wcast-align -Wconversion -Wredundant-decls -DITT_ARCH_IA64 -ffreestanding -nostdinc -fvisibility=hidden -fpie -O2 -I../common/inc/ muloti4.c -o muloti4.o
ar rcsD libcompiler-rt-patch.a muloti4.o
make[1]: Leaving directory '/root/sgx/compiler-rt'
CC <= enclave/Enclave_t.c
cp ../../compiler-rt/libcompiler-rt-patch.a ./lib
LINK => enclave/enclave.so
<!-- Please refer to User's Guide for the explanation of each field -->
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<StackMaxSize>0x40000</StackMaxSize>
<HeapMaxSize>0x100000</HeapMaxSize>
<TCSNum>1</TCSNum>
<TCSPolicy>1</TCSPolicy>
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
tcs_num 1, tcs_max_num 1, tcs_min_pool 1
The required memory is 1622016B.
Succeed.
SIGN => bin/enclave.signed.so
root@741307a10214:~/sgx/samplecode/helloworld# exit
docke ding … baidu x-lab rust-sgx-sdk docker --version
Docker version 17.03.1-ce, build c6d412e
I guess something's wrong with your environment setup. It's really weird.
Please keep me updated on your progress. Any other one who has the same problem, please let me know in this thread.
@bl4ck5un Did you import your user root ("~/") into the docker environment? I wonder if ~/.rustup
and ~/.cargo
is over-ride by your docker container.
No, I didn’t. I just run docker run -ti --rm -v ~/dev/rust-sgx-sdk:/root/sgx baiduxlab/sgx-rust
.
@bl4ck5un
what's the output of rustc --version
and cargo --version
and rustup toolchain list
of yours? Mine is
root@09e12bbe4a73:~/sgx/third_party# rustc --version
rustc 1.25.0-nightly (0c6091fbd 2018-02-04)
root@09e12bbe4a73:~/sgx/third_party# cargo --version
cargo 0.26.0-nightly (1d6dfea44 2018-01-26)
root@09e12bbe4a73:~/sgx/third_party# rustup toolchain list
nightly-2018-02-05-x86_64-unknown-linux-gnu (default)
The build still fails on macOS with Docker version 17.12.0-ce, build c97c6d6 with the following Rust toolchain:
$ docker run -ti --rm -v ~/dev/rust-sgx-sdk:/root/sgx baiduxlab/sgx-rust
root@fd32108f027e:~# rustc --version
rustc 1.25.0-nightly (0c6091fbd 2018-02-04)
root@fd32108f027e:~# cargo --version
cargo 0.26.0-nightly (1d6dfea44 2018-01-26)
root@fd32108f027e:~# rustup toolchain list
nightly-2018-02-05-x86_64-unknown-linux-gnu (default)
But I confirm that everything works as expected on my Linux host. This seems to be a weird issue with my macOS env setup.
Seems to be a bug of docker? or ... a feature? Is it possible that there is something I failed to setup but docker depends on? Please advise.
@dingelish No clue. I'm going to close the issue for now as it is not a problem with this repo :)
Compiling
helloworld
sample code onbaiduxlab/rust-sgx
gives the following error:On
baiduxlab/sgx-rust-experimental
, however, I get something like: