Install zlib in occlum-gcc toolchians

This commit is contained in:
LI Qing 2020-07-16 09:11:11 +08:00 committed by Tate, Hongliang Tian
parent a6dbce21cc
commit 81eb364c5b
9 changed files with 31 additions and 61 deletions

@ -23,6 +23,6 @@ echo "${new_json}" > Occlum.json
cp ../web_server image/bin cp ../web_server image/bin
occlum build occlum build
# 3. Run the hello world sample # 3. Run the web server sample
echo -e "${BLUE}occlum run /bin/web_server${NC}" echo -e "${BLUE}occlum run /bin/web_server${NC}"
occlum run /bin/web_server occlum run /bin/web_server

@ -7,7 +7,7 @@ Downlaod, build and install openssl into `/usr/local/occlum/x86_64-linux-musl/li
``` ```
## Step 2: ## Step 2:
Download, build and install cares, zlib, protobuf and finally gRPC into `/usr/local/occlum/x86_64-linux-musl/lib`: Download, build and install cares, protobuf and finally gRPC into `/usr/local/occlum/x86_64-linux-musl/lib`:
``` ```
./download_and_install_grpc.sh ./download_and_install_grpc.sh
``` ```

@ -36,29 +36,6 @@ then
fi fi
make install make install
# Install 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_NO_SYSTEM_FROM_IMPORTED=TRUE
if [ $? -ne 0 ]
then
echo "zlib cmake failed"
exit 1
fi
make -j$(nproc)
if [ $? -ne 0 ]
then
echo "zlib make failed"
exit 1
fi
make install
# Install protobuf # Install protobuf
cd $GRPC_SRC_DIR/third_party/protobuf cd $GRPC_SRC_DIR/third_party/protobuf
git submodule update --init . git submodule update --init .

@ -11,14 +11,6 @@ show_usage() {
} }
build_opencv() { build_opencv() {
rm -rf deps/zlib && mkdir -p deps/zlib
pushd deps/zlib
git clone https://github.com/madler/zlib .
CC=occlum-gcc CXX=occlum-g++ ./configure --prefix=$PREFIX
make
sudo make install
popd
rm -rf deps/opencv && mkdir -p deps/opencv rm -rf deps/opencv && mkdir -p deps/opencv
pushd deps/opencv pushd deps/opencv
git clone https://github.com/opencv/opencv . git clone https://github.com/opencv/opencv .

@ -2,16 +2,7 @@
set -e set -e
SRC_DIR="tensorflow_src" SRC_DIR="tensorflow_src"
# 1. Install dependent zlib # 1. Build tensorflow lite and the demo program
mkdir -p deps/zlib
pushd deps/zlib
git clone https://github.com/madler/zlib .
CC=occlum-gcc CXX=occlum-g++ ./configure --prefix=/usr/local/occlum/x86_64-linux-musl
make
sudo make install
popd
# 2. Build tensorflow lite and the demo program
mkdir -p $SRC_DIR mkdir -p $SRC_DIR
pushd $SRC_DIR pushd $SRC_DIR
git clone https://github.com/tensorflow/tensorflow . git clone https://github.com/tensorflow/tensorflow .
@ -21,7 +12,7 @@ git apply ../patch/fix-tflite-Makefile-v1.15.0-rc0.diff
make -j 3 -f tensorflow/lite/tools/make/Makefile make -j 3 -f tensorflow/lite/tools/make/Makefile
popd popd
# 3. Download tflite model and labels # 2. Download tflite model and labels
mkdir models mkdir models
curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz | tar xzv -C ./models curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz | tar xzv -C ./models
curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ./models mobilenet_v1_1.0_224/labels.txt curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ./models mobilenet_v1_1.0_224/labels.txt

@ -89,21 +89,21 @@ RUN curl https://sh.rustup.rs -sSf | \
cargo -V cargo -V
# Install Occlum toolchain # Install Occlum toolchain
COPY toolchains/gcc/* /tmp/ COPY toolchains/gcc /tmp/gcc
WORKDIR /tmp WORKDIR /tmp
RUN ./build.sh RUN cd gcc && ./build.sh && ./install_zlib.sh && rm -rf /tmp/gcc
ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH" ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH"
# Install Occlum Golang toolchain # Install Occlum Golang toolchain
COPY toolchains/golang/* /tmp/ COPY toolchains/golang /tmp/golang
WORKDIR /tmp WORKDIR /tmp
RUN ./build.sh RUN cd golang && ./build.sh && rm -rf /tmp/golang
ENV PATH="/usr/local/occlum/golang/bin:$PATH" ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH"
# Install Occlum Rust toolchain # Install Occlum Rust toolchain
COPY toolchains/rust/* /tmp/ COPY toolchains/rust /tmp/rust
WORKDIR /tmp WORKDIR /tmp
RUN ./build.sh RUN cd rust && ./build.sh && rm -rf /tmp/rust
ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH" ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/intel/sgxsdk/sdk_libs" ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/intel/sgxsdk/sdk_libs"

@ -76,21 +76,21 @@ RUN curl https://sh.rustup.rs -sSf | \
cargo -V cargo -V
# Install Occlum toolchain # Install Occlum toolchain
COPY toolchains/gcc/* /tmp/ COPY toolchains/gcc /tmp/gcc
WORKDIR /tmp WORKDIR /tmp
RUN ./build.sh RUN cd gcc && ./build.sh && ./install_zlib.sh && rm -rf /tmp/gcc
ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH" ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH"
# Install Occlum Golang toolchain # Install Occlum Golang toolchain
COPY toolchains/golang/* /tmp/ COPY toolchains/golang /tmp/golang
WORKDIR /tmp WORKDIR /tmp
RUN ./build.sh RUN cd golang && ./build.sh && rm -rf /tmp/golang
ENV PATH="/usr/local/occlum/golang/bin:$PATH" ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH"
# Install Occlum Rust toolchain # Install Occlum Rust toolchain
COPY toolchains/rust/* /tmp/ COPY toolchains/rust /tmp/rust
WORKDIR /tmp WORKDIR /tmp
RUN ./build.sh RUN cd rust && ./build.sh && rm -rf /tmp/rust
ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH" ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/intel/sgxsdk/sdk_libs" ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/intel/sgxsdk/sdk_libs"

@ -0,0 +1,13 @@
#!/bin/bash
set -e
PREFIX=/opt/occlum/toolchains/gcc/x86_64-linux-musl
export PATH="/usr/local/occlum/bin:$PATH"
rm -rf zlib && mkdir -p zlib
pushd zlib
git clone https://github.com/madler/zlib .
git checkout -b v1.2.11 tags/v1.2.11
CC=occlum-gcc CXX=occlum-g++ ./configure --prefix=$PREFIX
make
sudo make install
popd

@ -34,6 +34,3 @@ CC=\$OCCLUM_GCC ${INSTALL_DIR}/bin/go "\$@"
EOF EOF
chmod +x ${INSTALL_DIR}/bin/occlum-go chmod +x ${INSTALL_DIR}/bin/occlum-go
# Make symbolic links
ln -sf ${INSTALL_DIR} /usr/local/occlum/golang