How To Install optcomp on Ubuntu 18.04

In this tutorial we learn how to install optcomp on Ubuntu 18.04. optcomp is syntax extension for optional compilation with cpp-like directives (tools)

Introduction

In this tutorial we learn how to install optcomp on Ubuntu 18.04.

What is optcomp

optcomp is:

Optcomp is a syntax extension which handles #if, #else, … directives in OCaml source files. Compared to cpp:

  • it does not interpret //, /*, and */ as comment delimiters
  • it does not complains about missing '
  • it is easier to integrate in the build process when using other camlp4 syntax extensions
  • it does not do macro expansion while cpp does Compared to pa_macro, it does not require code that will be dropped to be valid OCaml code. This can be useful for code that optionnally uses GADTs, but can be compiled with older versions of OCaml.

This package contains command-line tools.

There are three methods to install optcomp on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install optcomp Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install optcomp using apt-get by running the following command:

sudo apt-get -y install optcomp

Install optcomp Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install optcomp using apt by running the following command:

sudo apt -y install optcomp

Install optcomp Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install optcomp using aptitude by running the following command:

sudo aptitude -y install optcomp

How To Uninstall optcomp on Ubuntu 18.04

To uninstall only the optcomp package we can use the following command:

sudo apt-get remove optcomp

Uninstall optcomp And Its Dependencies

To uninstall optcomp and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove optcomp

Remove optcomp Configurations and Data

To remove optcomp configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge optcomp

Remove optcomp configuration, data, and all of its dependencies

We can use the following command to remove optcomp configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge optcomp

References

Summary

In this tutorial we learn how to install optcomp package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.