Skip to content

Eclipse Integration

In this section, we explain how to set up the Eclipse IDE such that you can develop and in particular, code that executed inside of an enclave. The instructions have been tested on Ubuntu 18.04.

Installing Eclipse

  1. Download the Eclipse IDE for C/C++ Developers for Linux 64-bit from https://www.eclipse.org/downloads/packages/
  2. Extract it to a suitable location, e.g. tar -xzf "eclipse-cpp-2019-03-R-linux-gtk-x86_64.tar.gz" -C ~/
  3. (optional) If you want to have a desktop entry for eclipse, open or create ~/.local/share/applications/.desktop and add the following content:
    [Desktop Entry]
    Comment=Eclipse
    Terminal=false
    Name=Eclipse
    Exec=/home/myusername/eclipse/eclipse
    Type=Application
    Icon=/home/myusername/eclipse/icon.xpm
    

    (Make sure to adapt the paths accordingly.)

Creating a workspace

  1. Create a new folder as your workspace, e.g.: mkdir ~/eclipse-workspace
  2. Clone or copy the code you want to work with into the workspace, e.g.: cd ~/eclipse-workspace && git clone ...
  3. Start Eclipse! (Use the desktop entry or run ~/eclipse/eclipse)
  4. When prompted, select the created workspace folder and Launch
  5. Click on Workbench at the top right

Configure Eclipse for developing applications using SCONE

We show the steps to integrate SCONE with Eclipse. We assume that you have already installed scone-gcc and scone-gdb one the machine your are now installing Eclipse:

  1. In Eclipse, select File > Import... > C/C++ > Existing Code as Makefile Project > Next
  2. Existing Code Location: Select <your-path-to-workspace>/<path_to_project>/<your_project>.
  3. Select Linux GCC as Toolchain
  4. Click Finish
  5. Right-click the <your_project> project, select Properties > C/C++ Build > Environment
  6. Add the following entries: CC=scone-gcc, CFLAGS=-g -Og, PATH=<your-build-directory>/built/bin (Tick Add to all configurations for PATH. Your regular PATH will be added automatically.) Application build environment configuration
  7. Apply and Close
  8. Press Ctrl+B to build. Both SCONE (if configured) and the test applications will be built.
  9. While the <your_project> is selected, Select Run > Debug configurations...
  10. Double-click C/C++ Application
  11. Change Name to <your_app>, C/C++ Application to target/<your_app>
  12. Switch to tab Environment and add all environment variables used by SCONE, example: Application debug environment configuration
  13. Switch to tab Debugger and change GDB debugger to scone-gdb
  14. If the build-oot.sh script is used to build outside the source directory, it is advised to re-map the sources back to their original location for Debugging purposes: Switch to tab Source and Add... a Path Mapping with Name SCONE mapping, Add Compilation path <your-scone-build-directory> and Local file system path <your-scone-source-directory> (Selecting the local path is tricky, as a button seems to not be rendered correctly. Click on the empty space highlighted in the screenshot below) Path mapping
  15. OK > Apply > Debug
  16. When asked, Switch view
  17. The debugger is launched and the application is halted in main (can be disabled in the Debugger settings of the launch configuration). You can show local variables, Ctr+Click to follow references, etc. as usual Debugger view
  18. Continue with F8