occlum/demos/hello_cc
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
..
.gitignore Polish the demos 2019-10-19 02:04:13 +00:00
CMakeLists.txt Polish the demos 2019-10-19 02:04:13 +00:00
hello_world.cc Polish the demos 2019-10-19 02:04:13 +00:00
Makefile Polish the demos 2019-10-19 02:04:13 +00:00
README.md Polish the demos 2019-10-19 02:04:13 +00:00

A Sample C++ Project with Makefile and CMake

This project demonstrates how to use Makefile/CMake to build C++ projects for Occlum.

  1. Build hello_world with Makefile
make

Or you can build hello_world with CMake

mkdir build && cd build
cmake ../ -DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_CXX_FLAGS="-fPIC -pie"
make
cd ..
cp build/hello_world .

Either way, the resulting hello_world can be found in the current directory.

  1. (Optional) Run hello_world on Linux
LD_LIBRARY_PATH=/usr/local/occlum/x86_64-linux-musl/lib ./hello_world
  1. Run hello_world on Occlum
mkdir occlum_workspace && cd occlum_workspace
occlum init
cp ../hello_world image/bin
occlum build
occlum run /bin/hello_world