9 SimGrid should work out of the box on Linux, macOS, FreeBSD, and
10 Windows (under Windows, you need to install the Windows Subsystem
11 Linux to get more than the Java bindings).
19 To get all of SimGrid on Debian or Ubuntu, simply type one of the
20 following lines, or several lines if you need several languages.
24 apt install libsimgrid-dev # if you want to develop in C or C++
25 apt install simgrid-java # if you want to develop in Java
26 apt install python3-simgrid # if you want to develop in Python
28 If you build pre-compiled packages for other distributions, drop us an
31 .. _install_java_precompiled:
36 The jar file can be retrieved from the `Release page
37 <https://framagit.org/simgrid/simgrid/releases>`_. This file is
38 self-contained, including the native components for Linux, macOS and
39 Windows. Copy it to your project's classpath and you're set.
41 Nightly built Java Package
42 ^^^^^^^^^^^^^^^^^^^^^^^^^^
44 For non-Windows systems (Linux, macOS, or FreeBSD), head to `Jenkins <https://ci.inria.fr/simgrid/job/SimGrid>`_.
45 In the build history, pick the last green (or at least yellow) build that is not blinking (i.e., not currently under
46 build). In the list, pick a system that is close to yours, and click on the ball in the Debug row. The build artifact
47 will appear at the top of the resulting page.
49 For Windows, head to `AppVeyor <https://ci.appveyor.com/project/simgrid/simgrid>`_.
50 Click on the artifact link on the right, and grab your file. If the latest build failed, there will be no artifact. Then
51 you will need to first click on "History" at the top and look for the last successful build.
53 Binary Java Troubleshooting
54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 Here are some error messages that you may get when trying to use the
59 Your architecture is not supported by this jarfile
60 If your system is not supported, you should compile your
61 own jarfile :ref:`by compiling SimGrid <install_src>` from the source.
62 Library not found: boost-context
63 You should obviously install the ``boost-context`` library on your
64 machine, for example with ``apt``.
66 Version numbering and deprecation
67 ---------------------------------
69 SimGrid tries to be both a research instrument that you can trust, and
70 a vivid project targeting the future issues. We have 4 stable versions
71 per year, numbered 3.24 or 3.25. Backward compatibility is ensured for
72 one year: Code compiling without warning on 3.24 will still compile
73 with 3.28, but maybe with some deprecation warnings. You should update
74 your SimGrid installation at least once a year and fix those
75 deprecation warnings: the compatibility wrappers are usually removed
76 after 4 versions. Another approach is to never update your SimGrid
77 installation, but we don't provide any support to old versions.
79 Interim versions (also called pre-versions) may be released between
80 stable releases. They are numbered 3.X.Y, with even Y (for example,
81 3.23.2 was released on July 8. 2019 as a pre-version of 3.24). These
82 versions should be as usable as regular stable releases, even if they
83 may be somewhat less tested and documented. They play no role in our
84 deprecation handling, and they are not really announced to not spam
87 Version numbered 3.X.Y with odd Y are git versions. They often work,
88 but no guarantee is given whatsoever (all releases are given "as is",
89 but that's even more so for these unreleased versions).
93 Installing from the Source
94 --------------------------
96 Getting the Dependencies
97 ^^^^^^^^^^^^^^^^^^^^^^^^
99 C++ compiler (either g++, clang, or icc).
100 We use the C++14 standard, and older compilers tend to fail on
101 us. It seems that g++ 5.0 or higher is required nowadays (because of
102 boost). SimGrid compiles well with `clang` or `icc` too.
104 SimGrid should build without Python. That is only needed by our regression test suite.
106 ``ccmake`` provides a nicer graphical interface compared to ``cmake``.
107 Press ``t`` in ``ccmake`` if you need to see absolutely all
108 configuration options (e.g., if your Python installation is not standard).
109 boost (at least v1.48, v1.59 recommended)
110 - On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
111 - On macOS with homebrew: ``brew install boost``
113 - Debian / Ubuntu: ``apt install default-jdk libgcj18-dev`` (or
114 any version of libgcj)
115 - macOS or Windows: Grab a `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_
116 Lua (optional -- must be v5.3)
117 - SimGrid won't work with any other version of Lua.
118 - Debian / Ubuntu: ``apt install liblua5.3-dev lua5.3``
119 - Windows: ``choco install lua53``
121 - You need to patch the sources to build dynamic libraries. First `download lua 5.3 <http://www.lua.org/download.html>`_
122 - Open the archive: ``tar xvfz lua-5.3.*.tar.gz``
123 - Enter the directory: ``cd lua-5.3*``
124 - Patch the sources: ``patch -p1 < /path/to/simgrid/...../tools/lualib.patch``
125 - Build and install lua: ``make linux && sudo make install``
127 For platform-specific details, please see below.
132 Grab the last **stable release** from `FramaGit
133 <https://framagit.org/simgrid/simgrid/releases>`_, and compile it as follows:
135 .. code-block:: shell
137 tar xf simgrid-3-XX.tar.gz
139 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
143 If you want to stay on the **bleeding edge**, get the current git version,
144 and recompile it as with stable archives. You may need some extra
147 .. code-block:: shell
149 git clone https://framagit.org/simgrid/simgrid.git
151 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
155 .. _install_src_config:
160 This section is about **compile-time options**, which are very
161 different from :ref:`run-time options <options>`. Compile-time options
162 fall into two categories. **SimGrid-specific options** define which part
163 of the framework to compile while **Generic options** are provided by
168 Our build system often gets mixed up if you change something on
169 your machine after the build configuration. For example, if
170 SimGrid fails to detect your fortran compiler, it is not enough to
171 install a fortran compiler. You also need to delete all Cmake
172 files, such as ``CMakeCache.txt``. Since Cmake also generates some
173 files in the tree, you may need to wipe out your complete tree and
174 start with a fresh one when you install new dependencies.
176 Another (better) solution is to :ref:`build out of the source tree
177 <install_cmake_outsrc>`.
179 Generic build-time options
180 """"""""""""""""""""""""""
182 These options specify, for example, the path to various system elements (Python
183 path, compiler to use, etc). In most case, CMake automatically discovers the
184 right value for these elements, but you can set them manually as needed.
185 Notably, such variables include ``CC`` and ``CXX``, defining the paths to the C
186 and C++ compilers; ``CFLAGS`` and ``CXXFLAGS`` specifying extra options to pass
187 to the C and C++ compilers; and ``PYTHON_EXECUTABLE`` specifying the path to the
190 The best way to discover the exact name of the option that you need to
191 change is to press ``t`` in the ``ccmake`` graphical interface, as all
192 options are shown (and documented) in the advanced mode.
194 Once you know their name, there are several ways to change the values of
195 build-time options. You can naturally use the ccmake graphical
196 interface for that, or you can use environment variables, or you can
197 prefer the ``-D`` flag of ``cmake``.
199 For example, you can change the compilers by issuing these commands to set some
200 environment variables before launching cmake:
202 .. code-block:: shell
207 The same can be done by passing ``-D`` parameters to cmake, as follows.
208 Note that the dot at the end is mandatory (see :ref:`install_cmake_outsrc`).
210 .. code-block:: shell
212 cmake -DCC=clang -DCXX=clang++ .
214 SimGrid compilation options
215 """""""""""""""""""""""""""
217 Here is the list of all SimGrid-specific compile-time options (the
218 default choice is in upper case).
220 CMAKE_INSTALL_PREFIX (path)
221 Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
223 enable_compile_optimizations (ON/off)
224 Ask the compiler to produce efficient code. You probably want to
225 leave this option activated, unless you plan to modify SimGrid itself:
226 efficient code takes more time to compile, and appears mangled to some debuggers.
228 enable_compile_warnings (on/OFF)
229 Ask the compiler to issue error messages whenever the source
230 code is not perfectly clean. If you are a SimGrid developer, you
231 have to activate this option to enforce the code quality. As a
232 regular user, this option is of little use.
234 enable_debug (ON/off)
235 Disabling this option discards all log messages of severity
236 debug or below at compile time (see :ref:`outcome_logs`). The resulting
237 code is marginaly faster than if you discard these messages at
238 runtime, but it obviously becomes impossible to get any debug
239 info from SimGrid when things go wrong.
241 enable_documentation (on/OFF)
242 Generates the documentation pages. Building the documentation is not
243 as easy as it used to be, and you should probably use the online
247 Generates the java bindings of SimGrid. You must also enable MSG for
250 enable_jedule (on/OFF)
251 Produces execution traces from SimDag simulations, which can then be visualized with the
252 Jedule external tool.
255 Generate the lua bindings to the SimGrid internals (requires lua-5.3).
257 enable_lib_in_jar (ON/off)
258 Embeds the native java bindings into the produced jar file.
261 Enables the *Link Time Optimization* in the C++ compiler.
262 This feature really speeds up the code produced, but it is fragile
263 with older gcc versions.
265 enable_maintainer_mode (on/OFF)
266 (dev only) Regenerates the XML parsers whenever the DTD is modified (requires flex and flexml).
268 enable_mallocators (ON/off)
269 Activates our internal memory caching mechanism. This produces faster
270 code, but it may fool the debuggers.
272 enable_model-checking (on/OFF)
273 Activates the formal verification mode. This will **hinder
274 simulation speed** even when the model checker is not activated at
278 Activates the :ref:`MSG <MSG_doc>` legacy interface.
281 Activates the ns-3 bindings. See section :ref:`model_ns3`.
284 Allows one to run MPI code on top of SimGrid.
286 enable_smpi_ISP_testsuite (on/OFF)
287 Adds many extra tests for the model checker module.
289 enable_smpi_MPICH3_testsuite (on/OFF)
290 Adds many extra tests for the MPI module.
292 minimal-bindings (on/OFF)
293 Take as few optional dependencies as possible, to get minimal
294 library bindings in Java and Python.
296 SMPI_C_FLAGS, SMPI_CXX_FLAGS, SMPI_Fortran_FLAGS (string)
297 Default compiler options to use in smpicc, smpicxx, or smpiff.
298 This can be useful to set options like "-m32" or "-m64".
300 Reset the build configuration
301 """""""""""""""""""""""""""""
303 To empty the CMake cache (either when you add a new library or when
304 things go seriously wrong), simply delete your ``CMakeCache.txt``. You
305 may also want to directly edit this file in some circumstances.
307 .. _install_cmake_outsrc:
309 Out of Tree Compilation
310 ^^^^^^^^^^^^^^^^^^^^^^^
312 By default, the files produced during the compilation are placed in
313 the source directory. It is however often better to put them all in a
314 separate directory: cleaning the tree becomes as easy as removing this
315 directory, and you can have several such directories to test several
316 parameter sets or architectures.
318 For that, go to the directory where the files should be produced, and
319 invoke cmake (or ccmake) with the full path to the SimGrid source as
322 .. code-block:: shell
329 Existing Compilation Targets
330 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
332 In most cases, compiling and installing SimGrid is enough:
334 .. code-block:: shell
337 make install # try "sudo make install" if you don't have the permission to write
339 In addition, several compilation targets are provided in SimGrid. If
340 your system is well configured, the full list of targets is available
341 for completion when using the ``Tab`` key. Note that some of the
342 existing targets are not really for public consumption so don't worry
343 if some do not work for you.
345 - **make**: Build the core of SimGrid that gets installed, but not any example.
346 - **make tests**: Build the tests and examples.
347 - **make simgrid**: Build only the SimGrid library. Not any example nor the helper tools.
348 - **make s4u-comm-pingpong**: Build only this example (works for any example)
349 - **make java-all**: Build all Java examples and their dependencies
350 - **make clean**: Clean the results of a previous compilation
351 - **make install**: Install the project (doc/ bin/ lib/ include/)
352 - **make uninstall**: Uninstall the project (doc/ bin/ lib/ include/)
353 - **make dist**: Build a distribution archive (tar.gz)
354 - **make distcheck**: Check the dist (make + make dist + tests on the distribution)
355 - **make documentation**: Create SimGrid documentation
357 If you want to see what is really happening, try adding ``VERBOSE=1`` to
358 your compilation requests:
360 .. code-block:: shell
364 .. _install_src_test:
369 Once everything is built, you may want to test the result. SimGrid
370 comes with an extensive set of regression tests (as described in the
371 @ref inside_tests "insider manual"). The tests are not built by
372 default, so you first have to build them with ``make tests``. You can
373 then run them with ``ctest``, that comes with CMake. We run them
374 every commit and the results are on `our Jenkins <https://ci.inria.fr/simgrid/>`_.
376 .. code-block:: shell
378 make tests # Build the tests
379 ctest # Launch all tests
380 ctest -R s4u # Launch only the tests whose names match the string "s4u"
381 ctest -j4 # Launch all tests in parallel, at most 4 concurrent jobs
382 ctest --verbose # Display all details on what's going on
383 ctest --output-on-failure # Only get verbose for the tests that fail
385 ctest -R s4u -j4 --output-on-failure # You changed S4U and want to check that you didn't break anything, huh?
386 # That's fine, I do so all the time myself.
388 .. _install_cmake_mac:
390 macOS-specific instructions
391 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
393 SimGrid compiles like a charm with clang (version 3.0 or higher) on macOS:
395 .. code-block:: shell
397 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
401 Troubleshooting your macOS build.
403 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
404 This was reported with the XCode version of clang 4.1. The work
405 around is to edit the ``CMakeCache.txt`` file directly, to change
408 ``CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer``
410 You can safely ignore the warning about "-pthread" not being used, if it appears.
412 /usr/include does not seem to exist
413 This directory does not exist by default on modern macOS versions,
414 and you may need to create it with ``xcode-select -install``
416 .. _install_cmake_windows:
418 Windows-specific instructions
419 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
421 The best solution to get SimGrid working on windows is to install the
422 Ubuntu subsystem of Windows 10. All of SimGrid (but the model checker)
423 works in this setting.
425 Native builds not very well supported. Have a look to our `appveypor
427 <https://framagit.org/simgrid/simgrid/blob/master/.appveyor.yml>`_ to
428 see how we manage to use mingw-64 to build the DLL that the Java file
431 The drawback of MinGW-64 is that the produced DLL are not compatible
432 with MS Visual C. Some clang-based tools seem promising to fix this,
433 but this is of rather low priority for us. It it's important for you
434 and if you get it working, please @ref community_contact "tell us".
436 Python-specific instructions
437 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
439 Once you have the Python development headers installed as well as a
440 recent version of the `pybind11 <https://pybind11.readthedocs.io/en/stable/>`
441 module (version at least 2.4), recompiling the Python bindings from
442 the source should be as easy as:
444 .. code-block:: shell
446 # cd simgrid-source-tree
447 python setup.py build install
449 Starting with SimGrid 3.13, it should even be possible to install
450 simgrid without downloading the source with pip:
452 .. code-block:: shell
456 Java-specific instructions
457 ^^^^^^^^^^^^^^^^^^^^^^^^^^
459 Once you have the `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_ installed,
460 things should be as simple as:
462 .. code-block:: shell
464 cmake -Denable_java=ON -Dminimal-bindings=ON .
465 make simgrid-java_jar # Only build the jarfile
467 After the compilation, the file ```simgrid.jar``` is produced in the
470 **Troubleshooting Java Builds**
472 Sometimes, the build system fails to find the JNI headers. First locate them as follows:
474 .. code-block:: shell
477 /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
478 /usr/lib/jvm/java-9-openjdk-amd64/include/jni.h
479 /usr/lib/jvm/java-10-openjdk-amd64/include/jni.h
482 Then, set the JAVA_INCLUDE_PATH environment variable to the right
483 path, and relaunch cmake. If you have several versions of JNI installed
484 (as above), pick the one corresponding to the report of
487 .. code-block:: shell
489 export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
490 cmake -Denable_java=ON .
493 Note that the filename ```jni.h``` was removed from the path.
495 Linux Multi-Arch specific instructions
496 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
498 On a multiarch x86_64 Linux, it should be possible to compile a 32-bit
499 version of SimGrid with something like:
501 .. code-block:: shell
506 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \
508 -DCMAKE_SYSTEM_PROCESSOR=i386 \
509 -DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \
510 -DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \
511 -DSMPI_C_FLAGS=-m32 \
512 -DSMPI_CXX_FLAGS=-m32 \
513 -DSMPI_Fortran_FLAGS=-m32
515 If needed, implement ``i686-linux-gnu-gfortran`` as a script:
517 .. code-block:: shell
520 exec gfortran -m32 "$@"