Get Started!
We provide here sample instructions to quickly start with MOPSA. More detailed instructions are available in the MOPSA User Manual.
Installation
MOPSA is available for 64-bit platforms under Linux, macOS, and also Windows (through Windows Subsystem for Linux 2).
You’ll need OCaml with Opam 2.1.0. Other dependencies can be installed automatically through Opam.
Opam Installation
Starting with Version 1.0, we provide Opam packaging. You can install the latest stable version simply with:
opam install mopsa
Installation from Git
Alternatively, in order to get the latest development version or some specific branch, you can compile the sources from the git repository hosted in our GitLab project :
git clone https://gitlab.com/mopsa/mopsa-analyzer.git
cd mopsa-analyzer
opam pin add mopsa --with-doc --with-test .
It is also possible to compile MOPSA by hand (e.g., to pass specific configure
options).
After cloning and cd-ing in mopsa-analyzer
, you’ll use Opam once to install dependencies:
opam install --deps-only --with-doc --with-test .
and then run:
./configure
make
make install
Finally, check that everything is working with make tests
.
It should run a bunch of C and Python analyses, which should report Analysis terminated successfully
.
Using Docker
To avoid local installation, we also provide a ready-to-use, Ubuntu-based docker image
available on dockerhub as: mopsa/mopsa-analyzer
.
It is updated infrequently, but at least as often as stable releases.
docker pull mopsa/mopsa-analyzer
docker run -it mopsa/mopsa-analyzer
eval $(opam env)
# play with mopsa...
First analysis
Here is an example from the documentation showing how to analyze a small C program, the unix tool time
from GNU:
wget https://ftp.gnu.org/gnu/time/time-1.9.tar.gz
tar xaf time-1.9.tar.gz
cd time-1.9
./configure CC=clang
mopsa-build make
mopsa-c mopsa.db
This example shows the capabilities of MOPSA to analyze a simple C program depending only on the C standard library (for which a model is bundled with MOPSA) fully automatically, with minimal configuration steps.
Using mopsa-build
, MOPSA automatically collects the list of C source files to analyze and build a database mopsa.db
, which is used by the analysis (note that, although the program is compiled as a side-effect of mopsa-build
, the generated binaries are not used, only the sources are).
In the end, MOPSA should report a list of alarms.
/usr/include
for the C library headers.
Analysis results may vary.
Going Further
The documentation provides additional analysis examples, notably:
- Juliet benchmarks, with an analysis setup provided in a GitLab project
- Coreutil benchmarks with an analysis setup provided in a GitLab project
- Python benchmarks
- C/Python multilanguage benchmarks