occlum/demos/hello_c
2021-09-17 15:50:15 +08: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.c Polish the demos 2019-10-19 02:04:13 +00:00
hello.yaml Modify hello_c demo with copy_bom 2021-09-17 15:50:15 +08:00
Makefile Improve Occlum GCC toolchain with new wrappers for binaries 2019-11-29 11:20:00 +00:00
README.md Modify hello_c demo with copy_bom 2021-09-17 15:50:15 +08: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_C_COMPILER=occlum-gcc
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
./hello_world
  1. Run hello_world on Occlum
mkdir occlum_workspace && cd occlum_workspace
occlum init && rm -rf image
copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template
occlum build
occlum run /bin/hello_world