Fix the demo's compiling failure in some cases

Some demos based on CMake may search installed packages out of
Occlum toolchain's directory, this could cause some building
errors sometimes. By setting the $PKG_CONFIG_LIBDIR, we can make
CMake searching for packages in Occlum toolchain's directory only.
This commit is contained in:
LI Qing 2020-04-14 09:30:39 +00:00 committed by tate.thl
parent 3034cb992b
commit f9df83f559
5 changed files with 13 additions and 5 deletions

@ -1,7 +1,9 @@
#!/bin/sh
INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl/
INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl
GRPC_SRC_DIR=$PWD/grpc
export PATH=$PATH:$INSTALL_DIR/bin
# Tell CMake to search for packages in Occlum toolchain's directory only
export PKG_CONFIG_LIBDIR=$INSTALL_DIR/lib
git clone https://github.com/grpc/grpc.git
cd grpc

@ -36,7 +36,7 @@ build_opencv() {
-DBUILD_opencv_python=OFF -DBUILD_PYTHON_SUPPORT=OFF \
-DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF \
-DWITH_QT=OFF -DWITH_CUDA=OFF
make -j
make -j4
sudo make install
popd
}
@ -105,6 +105,9 @@ while [ -n "$1" ]; do
esac
done
# Tell CMake to search for packages in Occlum toolchain's directory only
export PKG_CONFIG_LIBDIR=$PREFIX/lib
if [ "$THREADING" == "TBB" ] ; then
echo "Build OpenVINO with TBB threading"
build_opencv

@ -4,5 +4,5 @@ cd ~
wget https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5.tar.gz && tar xf cmake-3.15.5.tar.gz
cd cmake-3.15.5
./bootstrap
make -j
make -j4
sudo make install

@ -2,7 +2,7 @@
Step 1: Download XGBoost and its dependencies, and then build XGBoost
```
./build_xgboost.sh
./download_and_build_xgboost.sh
```
When completed, the resulting XGBoost can be found in `xgboost_src` directory.

@ -1,6 +1,9 @@
#!/bin/bash
set -e
# Tell CMake to search for packages in Occlum toolchain's directory only
export PKG_CONFIG_LIBDIR=/usr/local/occlum/x86_64-linux-musl/lib
# Install the dependencies
apt-get update
apt-get install -y python3.5
@ -30,7 +33,7 @@ cd build
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=occlum-gcc -DCMAKE_CXX_COMPILER=occlum-g++
make -j
make -j4
popd
# Prepare data