[toolchains] Add grpc ra_tls into toolchains
This commit is contained in:
parent
7809658233
commit
fa5dfc690d
@ -14,7 +14,6 @@ function build_ratls()
|
|||||||
pushd ${RATLS_DIR}
|
pushd ${RATLS_DIR}
|
||||||
./download_and_prepare.sh
|
./download_and_prepare.sh
|
||||||
./build_and_install.sh musl
|
./build_and_install.sh musl
|
||||||
./build_occlum_instance.sh musl
|
|
||||||
|
|
||||||
cp ./grpc-src/examples/cpp/ratls/build/libgrpc_ratls_client.so ${DEP_LIBS_DIR}/
|
cp ./grpc-src/examples/cpp/ratls/build/libgrpc_ratls_client.so ${DEP_LIBS_DIR}/
|
||||||
cp ./grpc-src/examples/cpp/ratls/build/libhw_grpc_proto.so ${DEP_LIBS_DIR}/
|
cp ./grpc-src/examples/cpp/ratls/build/libhw_grpc_proto.so ${DEP_LIBS_DIR}/
|
||||||
|
34
tools/toolchains/grpc_ratls/build.sh
Executable file
34
tools/toolchains/grpc_ratls/build.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
INSTALL_DIR=/opt/occlum/toolchains/grpc_ratls
|
||||||
|
RATLS_DIR=${script_dir}/ra_tls
|
||||||
|
|
||||||
|
pushd ${RATLS_DIR}
|
||||||
|
echo "Download and prepare grpc ra_tls"
|
||||||
|
./download_and_prepare.sh
|
||||||
|
|
||||||
|
echo "Build and install musl-libc grpc ra_tls"
|
||||||
|
./build_and_install.sh musl
|
||||||
|
mkdir -p ${INSTALL_DIR}/musl
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/libgrpc_ratls_client.so ${INSTALL_DIR}/musl/
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/libgrpc_ratls_server.so ${INSTALL_DIR}/musl/
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/libhw_grpc_proto.so ${INSTALL_DIR}/musl/
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/server ${INSTALL_DIR}/musl/
|
||||||
|
|
||||||
|
echo "Build and install glibc grpc ra_tls"
|
||||||
|
./build_and_install.sh
|
||||||
|
mkdir -p ${INSTALL_DIR}/glibc
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/libgrpc_ratls_client.so ${INSTALL_DIR}/glibc/
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/libgrpc_ratls_server.so ${INSTALL_DIR}/glibc/
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/libhw_grpc_proto.so ${INSTALL_DIR}/glibc/
|
||||||
|
cp ./grpc-src/examples/cpp/ratls/build/server ${INSTALL_DIR}/glibc/
|
||||||
|
|
||||||
|
# Do clean
|
||||||
|
rm -rf grpc-src
|
||||||
|
rm -f *.tar.gz
|
||||||
|
rm -rf cJSON*
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
@ -6,17 +6,19 @@ source ./env.sh
|
|||||||
BUILD_TYPE=Release
|
BUILD_TYPE=Release
|
||||||
|
|
||||||
if [[ $1 == "musl" ]]; then
|
if [[ $1 == "musl" ]]; then
|
||||||
echo "*** Build and run musl-libc demo ***"
|
echo "*** Build musl-libc grpc_ratls ***"
|
||||||
CC=occlum-gcc
|
CC=occlum-gcc
|
||||||
CXX=occlum-g++
|
CXX=occlum-g++
|
||||||
DCAP_LIB_PATH="/opt/occlum/toolchains/dcap_lib/musl"
|
DCAP_LIB_PATH="/opt/occlum/toolchains/dcap_lib/musl"
|
||||||
INSTALL_PREFIX="/usr/local/occlum/x86_64-linux-musl"
|
INSTALL_PREFIX="/usr/local/occlum/x86_64-linux-musl"
|
||||||
|
GRPC_INSTALL_PATH="/tmp/grpc_ratls/musl"
|
||||||
else
|
else
|
||||||
echo "*** Build and run glibc demo ***"
|
echo "*** Build glibc grpc_ratls ***"
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CXX=g++
|
CXX=g++
|
||||||
DCAP_LIB_PATH="/opt/occlum/toolchains/dcap_lib/glibc"
|
DCAP_LIB_PATH="/opt/occlum/toolchains/dcap_lib/glibc"
|
||||||
INSTALL_PREFIX="/usr/local"
|
INSTALL_PREFIX="/usr/local"
|
||||||
|
GRPC_INSTALL_PATH="/tmp/grpc_ratls/glibc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build and install cJSON
|
# Build and install cJSON
|
||||||
@ -30,9 +32,9 @@ function build_cjson() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function build_grpc_ratls() {
|
function build_grpc_ratls() {
|
||||||
# Copy occlum dcap lib first
|
rm -rf ${GRPC_INSTALL_PATH} && mkdir -p ${GRPC_INSTALL_PATH}
|
||||||
|
# Copy occlum dcap lib first to ease linking
|
||||||
cp ${DCAP_LIB_PATH}/libocclum_dcap.so* ${INSTALL_PREFIX}/lib
|
cp ${DCAP_LIB_PATH}/libocclum_dcap.so* ${INSTALL_PREFIX}/lib
|
||||||
cp /opt/occlum/toolchains/dcap_lib/inc/occlum_dcap.h ${INSTALL_PREFIX}/include/
|
|
||||||
|
|
||||||
# Copy ratls added/updated files to grpc source
|
# Copy ratls added/updated files to grpc source
|
||||||
cp -rf grpc/${GRPC_VERSION}/* ${GRPC_PATH}/
|
cp -rf grpc/${GRPC_VERSION}/* ${GRPC_PATH}/
|
||||||
@ -44,7 +46,7 @@ function build_grpc_ratls() {
|
|||||||
pushd ${ABSEIL_PATH}
|
pushd ${ABSEIL_PATH}
|
||||||
rm -rf build && mkdir build && cd build
|
rm -rf build && mkdir build && cd build
|
||||||
cmake -DCMAKE_CXX_STANDARD=11 -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
|
cmake -DCMAKE_CXX_STANDARD=11 -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
|
||||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${GRPC_INSTALL_PATH} \
|
||||||
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} ..
|
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} ..
|
||||||
make -j `nproc`
|
make -j `nproc`
|
||||||
make install
|
make install
|
||||||
@ -58,7 +60,8 @@ function build_grpc_ratls() {
|
|||||||
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
|
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
|
||||||
-DDEFINE_SGX_RA_TLS_OCCLUM_BACKEND=ON \
|
-DDEFINE_SGX_RA_TLS_OCCLUM_BACKEND=ON \
|
||||||
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} \
|
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} \
|
||||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
|
-DCMAKE_PREFIX_PATH=${GRPC_INSTALL_PATH} \
|
||||||
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${GRPC_INSTALL_PATH} ..
|
||||||
make -j `nproc`
|
make -j `nproc`
|
||||||
make install
|
make install
|
||||||
popd
|
popd
|
||||||
@ -67,10 +70,14 @@ function build_grpc_ratls() {
|
|||||||
pushd ${GRPC_PATH}/examples/cpp/ratls
|
pushd ${GRPC_PATH}/examples/cpp/ratls
|
||||||
rm -rf build && mkdir -p build
|
rm -rf build && mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
cmake -D CMAKE_PREFIX_PATH=${INSTALL_PREFIX} -D CMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
cmake -DCMAKE_PREFIX_PATH=${GRPC_INSTALL_PATH} \
|
||||||
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||||
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} ..
|
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} ..
|
||||||
make -j `nproc`
|
make -j `nproc`
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
# Clean temp occlum dcap lib
|
||||||
|
rm ${INSTALL_PREFIX}/lib/libocclum_dcap.so*
|
||||||
}
|
}
|
||||||
|
|
||||||
build_cjson
|
build_cjson
|
3
demos/ra_tls/build_occlum_instance.sh → tools/toolchains/grpc_ratls/ra_tls/build_occlum_instance.sh
3
demos/ra_tls/build_occlum_instance.sh → tools/toolchains/grpc_ratls/ra_tls/build_occlum_instance.sh
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
function get_mr() {
|
function get_mr() {
|
||||||
cd ${script_dir}/occlum_$1 && occlum print $2
|
cd ${script_dir}/occlum_$1 && occlum print $2
|
||||||
}
|
}
|
||||||
@ -55,6 +57,7 @@ function build_instance() {
|
|||||||
|
|
||||||
if [[ $1 == "musl" ]]; then
|
if [[ $1 == "musl" ]]; then
|
||||||
echo "*** Build musl-libc Occlum instance ***"
|
echo "*** Build musl-libc Occlum instance ***"
|
||||||
|
cp /opt/occlum/toolchains/dcap_lib/musl/libocclum_dcap.so.0.1.0 /usr/local/occlum/x86_64-linux-musl/lib/
|
||||||
else
|
else
|
||||||
echo "*** Build glibc Occlum instance ***"
|
echo "*** Build glibc Occlum instance ***"
|
||||||
# glibc version requires libnss
|
# glibc version requires libnss
|
@ -55,6 +55,7 @@ option(DEFINE_SGX_RA_TLS_OCCLUM_BACKEND "SGX Occlum Backend" OFF)
|
|||||||
if(DEFINE_SGX_RA_TLS_OCCLUM_BACKEND)
|
if(DEFINE_SGX_RA_TLS_OCCLUM_BACKEND)
|
||||||
message("SGX_RA_TLS_OCCLUM_BACKEND is defined")
|
message("SGX_RA_TLS_OCCLUM_BACKEND is defined")
|
||||||
include_directories(/opt/intel/sgxsdk/include)
|
include_directories(/opt/intel/sgxsdk/include)
|
||||||
|
include_directories(/opt/occlum/toolchains/dcap_lib/inc)
|
||||||
add_definitions(-DSGX_RA_TLS_OCCLUM_BACKEND)
|
add_definitions(-DSGX_RA_TLS_OCCLUM_BACKEND)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user