This commit makes the toolchain easier to use in two folds: 1. When compiling C/C++ source files, no need to add "-fPIC -pie" flags manually; 2. When running executables generated by the Occlum toolchain on Linux, no need to set the `LD_LIBRARY_PATH` manually. |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| CMakeLists.txt | ||
| hello_world.c | ||
| Makefile | ||
| README.md | ||
A Sample C Project with Makefile and CMake
This project demonstrates how to use Makefile/CMake to build C projects for Occlum.
- Build
hello_worldwith 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.
- (Optional) Run
hello_worldon Linux
./hello_world
- Run
hello_worldon Occlum
mkdir occlum_workspace && cd occlum_workspace
occlum init
cp ../hello_world image/bin
occlum build
occlum run /bin/hello_world