To let you try out the programs in this chapter immediately, we've set up a Docker image that has all the tools and libraries we'll need throughout this book. It's based on Ubuntu 19.04.
In order to set it up, follow these steps:
- Download and install the Docker Engine from www.docker.com.
- Pull the image from Docker Hub: docker pull kasperondocker/system_programming_cookbook:latest.
- The image should now be available. Type in the following command to view the image: docker images.
- Now, you should have the following image: kasperondocker/system_programming_cookbook.
- Run the Docker image with an interactive shell with the help of the following command: docker run -it --cap-add sys_ptrace kasperondocker/system_programming_cookbook:latest /bin/bash.
- The shell on the running container is now available. Use root@39a5a8934370/# cd /BOOK/ to get all the programs that have been developed for the chapters in this book.
The --cap-add sys_ptrace argument is needed to allow GDB to set breakpoints in the Docker container which, by default, Docker does not allow.
Disclaimer: The C++20 standard has been approved (that is, technically finalized) by WG21 in a meeting in Prague at the end of February. This means that the GCC compiler version that this book uses, 8.3.0, does not include (or has very, very limited support for) the new and cool C++20 features. For this reason, the Docker image does not include the C++20 recipe code. GCC keeps the development of the newest features in branches (you have to use appropriate flags for that, for example, -std=c++2a); therefore, you are encouraged to experiment with them by yourself. So, clone and explore the GCC contracts and module branches and have fun.