occlum/demos/hello_bazel/README.md
Tate, Hongliang Tian f9376ec4ba Polish the demos
1. Rename demo/ to demos/
2. Add demos/README.md
2019-10-19 02:04:13 +00:00

24 lines
836 B
Markdown

# A Sample C++ Project with Bazel
This project demonstrates how to use Bazel to build C++ projects for Occlum. To install Bazel on Ubuntu, follow the instructions [here](https://docs.bazel.build/versions/master/install-ubuntu.html).
1. Download a Bazel sample project in C++ and build it with Occlum toolchain
```
./build_bazel_sample.sh
```
When completed, the resulting `hello-world` can be found in `examples/cpp-tutorial/stage3/bazel-bin/main` directory.
2. (Optional) Run `hello-world` on Linux
```
LD_LIBRARY_PATH=/usr/local/occlum/x86_64-linux-musl/lib ./examples/cpp-tutorial/stage3/bazel-bin/main/hello-world
```
3. Run `hello-world` on Occlum
```
mkdir occlum_workspace && cd occlum_workspace
occlum init
cp ../examples/cpp-tutorial/stage3/bazel-bin/main/hello-world image/bin
occlum build
occlum run /bin/hello-world
```