diff --git a/demos/grpc/download_and_install_grpc.sh b/demos/grpc/download_and_install_grpc.sh index ea5c9169..5f1c2e83 100755 --- a/demos/grpc/download_and_install_grpc.sh +++ b/demos/grpc/download_and_install_grpc.sh @@ -1,6 +1,7 @@ #!/bin/sh -install_dir=/usr/local/occlum/x86_64-linux-musl/ -export PATH=$PATH:$install_dir/bin +INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl/ +GRPC_SRC_DIR=$PWD/grpc +export PATH=$PATH:$INSTALL_DIR/bin git clone https://github.com/grpc/grpc.git cd grpc @@ -12,54 +13,52 @@ then fi # Install c-ares -cd third_party/cares/cares +cd $GRPC_SRC_DIR/third_party/cares/cares git submodule update --init . git checkout tags/cares-1_15_0 mkdir -p build cd build cmake ../ \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \ - -DCMAKE_INSTALL_PREFIX=$install_dir + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR if [ $? -ne 0 ] then echo "cares cmake failed" exit 1 fi -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "cares make failed" exit 1 fi make install -cd ../../../.. # Install zlib -cd third_party/zlib +cd $GRPC_SRC_DIR/third_party/zlib git submodule update --init . git checkout tags/v1.2.11 mkdir -p build cd build cmake ../ \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \ - -DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_INSTALL_PREFIX=$install_dir \ + -DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE if [ $? -ne 0 ] then echo "zlib cmake failed" exit 1 fi -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "zlib make failed" exit 1 fi make install -cd ../../.. # Install protobuf -cd third_party/protobuf +cd $GRPC_SRC_DIR/third_party/protobuf git submodule update --init . git checkout tags/v3.10.0 cd cmake @@ -68,7 +67,7 @@ cd build cmake ../ \ -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=TRUE \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \ - -DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_INSTALL_PREFIX=$install_dir \ + -DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE if [ $? -ne 0 ] @@ -77,27 +76,26 @@ then exit 1 fi -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "protobuf make failed" exit 1 fi make install -cd ../../../.. -cp $install_dir/bin/protoc /usr/bin +cp $INSTALL_DIR/bin/protoc /usr/bin # Install gRPC -cd cmake +cd $GRPC_SRC_DIR/cmake mkdir -p build cd build cmake ../.. \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \ -DCMAKE_CXX_COMPILER=occlum-g++ -DgRPC_INSTALL=ON -DgRPC_PROTOBUF_PROVIDER=package \ -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package \ - -DgRPC_SSL_PROVIDER=package -DCMAKE_PREFIX_PATH=$install_dir \ - -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE -DCMAKE_INSTALL_PREFIX=$install_dir + -DgRPC_SSL_PROVIDER=package -DCMAKE_PREFIX_PATH=$INSTALL_DIR \ + -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR if [ $? -ne 0 ] then @@ -105,7 +103,7 @@ then exit 1 fi -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "grpc make failed" diff --git a/demos/grpc/download_and_install_openssl.sh b/demos/grpc/download_and_install_openssl.sh index b15037e1..b139c0b8 100755 --- a/demos/grpc/download_and_install_openssl.sh +++ b/demos/grpc/download_and_install_openssl.sh @@ -14,7 +14,7 @@ then echo "./config command failed." exit 1 fi -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "make command failed." diff --git a/demos/grpc/prepare_client_server.sh b/demos/grpc/prepare_client_server.sh index b7b209a9..38dd62c6 100755 --- a/demos/grpc/prepare_client_server.sh +++ b/demos/grpc/prepare_client_server.sh @@ -1,15 +1,17 @@ #!/bin/sh +DEMO_DIR=$PWD -cd grpc/examples/cpp/helloworld -git apply ../../../../Makefile.patch +cd $DEMO_DIR/grpc/examples/cpp/helloworld +git apply $DEMO_DIR/Makefile.patch if [ $? -ne 0 ] then echo "patch failed" exit 1 fi -cp ../../protos/helloworld.proto . -cd ../../../../ +cp $DEMO_DIR/grpc/examples/protos/helloworld.proto . + +cd $DEMO_DIR mkdir -p client mkdir -p server diff --git a/demos/grpc/run_client_on_host.sh b/demos/grpc/run_client_on_host.sh index 5d201404..5408cd67 100755 --- a/demos/grpc/run_client_on_host.sh +++ b/demos/grpc/run_client_on_host.sh @@ -1,12 +1,12 @@ #!/bin/sh -install_dir=/usr/local/occlum/x86_64-linux-musl +INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl -export PATH=$PATH:$install_dir/bin +export PATH=$PATH:$INSTALL_DIR/bin cd client -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "demo make failed" diff --git a/demos/grpc/run_client_on_occlum.sh b/demos/grpc/run_client_on_occlum.sh index 4ea419a9..0da03743 100755 --- a/demos/grpc/run_client_on_occlum.sh +++ b/demos/grpc/run_client_on_occlum.sh @@ -1,11 +1,11 @@ #!/bin/bash -install_dir=/usr/local/occlum/x86_64-linux-musl +INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl -export PATH=$PATH:$install_dir/bin +export PATH=$PATH:$INSTALL_DIR/bin cd client -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "demo make failed" @@ -26,9 +26,9 @@ fi mkdir -p image/etc cp /etc/resolv.conf image/etc cp ../greeter_client image/bin -cp $install_dir/lib/libprotobuf.so.3.10.0.0 image/lib -cp $install_dir/lib/libcares.so.2 image/lib -cp $install_dir/lib/libz.so.1 image/lib +cp $INSTALL_DIR/lib/libprotobuf.so.3.10.0.0 image/lib +cp $INSTALL_DIR/lib/libcares.so.2 image/lib +cp $INSTALL_DIR/lib/libz.so.1 image/lib if [ $? -ne 0 ] then echo "libraries copied failed" diff --git a/demos/grpc/run_server_on_host.sh b/demos/grpc/run_server_on_host.sh index c0d37ab7..afec9151 100755 --- a/demos/grpc/run_server_on_host.sh +++ b/demos/grpc/run_server_on_host.sh @@ -1,12 +1,12 @@ #!/bin/sh -install_dir=/usr/local/occlum/x86_64-linux-musl +INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl -export PATH=$PATH:$install_dir/bin +export PATH=$PATH:$INSTALL_DIR/bin cd server -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "demo make failed" diff --git a/demos/grpc/run_server_on_occlum.sh b/demos/grpc/run_server_on_occlum.sh index 0b603af0..0da98cba 100755 --- a/demos/grpc/run_server_on_occlum.sh +++ b/demos/grpc/run_server_on_occlum.sh @@ -1,10 +1,10 @@ #!/bin/bash -install_dir=/usr/local/occlum/x86_64-linux-musl -export PATH=$PATH:$install_dir/bin +INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl +export PATH=$PATH:$INSTALL_DIR/bin cd server -make -j8 +make -j$(nproc) if [ $? -ne 0 ] then echo "demo make failed" @@ -25,9 +25,9 @@ fi mkdir -p image/etc cp /etc/resolv.conf image/etc cp ../greeter_server image/bin -cp $install_dir/lib/libprotobuf.so.3.10.0.0 image/lib -cp $install_dir/lib/libcares.so.2 image/lib -cp $install_dir/lib/libz.so.1 image/lib +cp $INSTALL_DIR/lib/libprotobuf.so.3.10.0.0 image/lib +cp $INSTALL_DIR/lib/libcares.so.2 image/lib +cp $INSTALL_DIR/lib/libz.so.1 image/lib if [ $? -ne 0 ] then echo "libraries copied failed" diff --git a/demos/remote_attestation/download_and_build.sh b/demos/remote_attestation/download_and_build.sh index a0963189..5d6612d3 100755 --- a/demos/remote_attestation/download_and_build.sh +++ b/demos/remote_attestation/download_and_build.sh @@ -32,7 +32,7 @@ if [ ! -d "$CURLDIR" ] ; then mv curl-curl-7_29_0 curl && \ echo "Download curl successfully" || exit 1 else - echo "The openssl code is already existent" + echo "The curl code is already existent" fi # Download other dependencies @@ -88,7 +88,8 @@ if [ ! -f "$INSTALLDIR/lib/libcurl.so" ] ; then echo "Building curl ..." CC=occlum-gcc CXX=occlum-g++ ./configure \ --prefix=$INSTALLDIR \ - --with-ssl=$INSTALLDIR && \ + --with-ssl=$INSTALLDIR \ + --without-zlib && \ make -j${nproc} && \ sudo make install && \ echo "Build curl successfully" || exit 1