Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[#!] #!/bin/sh -> #!/usr/bin/env sh
[simgrid.git] / doc / doxygen / install.doc
index 60b5213..88d880e 100644 (file)
@@ -33,7 +33,7 @@ bits, Windows 64 bits, FreeBSD (64 bits).
 
 @subsection install_binary_java_builder Nightly built Java Package
 
-For Windows, head to [AppVeyor](https://ci.appveyor.com/project/mquinson/simgrid).
+For Windows, head to [AppVeyor](https://ci.appveyor.com/project/simgrid/simgrid).
 Click on the artefact link on the right, and grab your file. If the latest build failed, there will be no artefact. Then
 you will need to first click on "History" on the top and search for the last successful build.
 
@@ -62,21 +62,42 @@ will appear on the top of the resulting page.
 @subsection install_src_deps Getting the Dependencies
 
 Recompiling an official archive is not much more complex. SimGrid only uses very standard tools:
-  - C compiler, C++ compiler, make and friends.
+  - C compiler, C++ compiler, make and friends. SimGrid is rather
+    demanding on the compiler. We use the C++11 standard, and older
+    compilers tend to fail on us. It seems that g++ 5.0 or higher is
+    required nowadays (because of boost). 
+    SimGrid compiles well with `clang` too.
   - perl (but you may try to go without it)
   - We use cmake to configure our compilation
       ([download page](http://www.cmake.org/cmake/resources/software.html)).
-      You need cmake version 2.8.8 or higher. You may want to use ccmake
-      for a graphical interface over cmake.
+      You need cmake version 2.8.8 or higher. 
+      `ccmake` provides a nicer graphical interface compared to `cmake`.
+      Press `t` in `ccmake` if you need to see absolutely all
+      configuration options (e.g., if your python installation is not standard).
   - boost:
+    - Debian / Ubuntu: `apt-get install libboost-dev libboost-context-dev`
     - Max OS X: with [fink](http://www.finkproject.org/): `fink install boost1.53.nopython`,
       or with homebrew: `brew install boost`
-    - Debian / Ubuntu: `apt-get install libboost-dev libboost-context-dev`
-  - Java (if you want to build the Java bindings): Grab a
-    [full JDK](http://www.oracle.com/technetwork/java/javase/downloads)
+  - Java (if you want to build the Java bindings): 
+    - Debian / Ubuntu: `apt-get install default-jdk libgcj17-dev` (any
+      version of libgcj will do it; you can use libgcj16-dev or libgcj18-dev
+      instead, depending on your version of Debian/Ubuntu)
+    - Mac OS X or Windows: Grab a [full JDK](http://www.oracle.com/technetwork/java/javase/downloads)
+  - Lua (if you want to build with lua enabled): Your version of Lua
+    must be 5.3. SimGrid won't work with Lua 5.2 nor with 5.1, and
+    probably not with Lua 5.4 either.
+    - Debian / Ubuntu: `apt-get install liblua5.3-dev lua5.3`
+    - Windows: choco install lua53
+    - From the source: you need to patch the sources to build dynamic libraries 
+      - [Download lua 5.3](http://www.lua.org/download.html). SimGrid
+        won't work with lua 5.2 as lua breaks the compatibility.
+      - Open the archive: `tar xvfz lua-5.3.*.tar.gz`
+      - Enter the directory: `cd lua-5.3*`
+      - Patch the sources: `patch -p1 < /path/to/simgrid/...../tools/lualib.patch`
+      - Build and install lua: `make linux && sudo make install`
 
 For platform-specific details, please see  @ref install_cmake_mac,
-@ref install_cmake_windows and @ref install_src_32bits
+@ref install_cmake_windows, @ref install_java and @ref install_src_32bits
 
 @subsection install_src_fetch Getting the Sources
 
@@ -101,38 +122,51 @@ git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid
 
 @subsection install_src_config Build Configuration
 
-Note that compile-time options are very different from @ref options "run-time options".
-
-@subsubsection install_cmake_howto Compilation Options
-
-The default configuration should be fine for most usages, but if you need to change something, there are several ways 
-to do so. First, you can use environment variables. For example, you can change the compilers used by issuing these 
-commands before launching cmake:
+This section is about *compile-time options*, that are very different
+from @ref options "run-time options". Compile-time options fall into
+two categories. @ref install_cmake_list "SimGrid-specific options"
+define which part of the framework to compile while 
+@ref install_cmake_howto "generic options" are provided by cmake
+itself. 
+
+@subsubsection install_cmake_howto Generic build-time options
+
+These options specify for example the path to various system elements
+(Python path, compiler to use, etc). In most case, cmake automatically
+discovers the right value for these ones, but you can set them
+manually on need.  Notable such variables include @c CC and @c CXX,
+defining respectively the C and C++ compiler executables, @c CFLAGS
+and @c CXXFLAGS respectively specifying extra options to pass to the C
+and C++ compilers, or @c PYTHON_EXECUTABLE specifying the path to the
+python executable.  The best way to discover the exact name of the
+option that you need to change is to press 't' in the ccmake graphical
+interface, as all options are shown (and documented) in the advanced
+mode.
+
+Once you know their name, there is several ways to change the value of
+build-time options. You can naturally use the ccmake graphical
+interface for that, or you can use environment variables, or you can
+prefer the @c -D flag of @c cmake.
+
+For example, you can change the compilers with environment variables
+by issuing these commands before launching cmake:
 
 @verbatim
-export CC=gcc-4.7
-export CXX=g++-4.7
+export CC=gcc-5.1
+export CXX=g++-5.1
 @endverbatim
 
-Note that other variables are available, such as CFLAGS and CXXFLAGS to add options respectively for the C and C++ 
-compilers.
-
-Another way to do so is to use the -D argument of cmake as follows.
+The same can be done by passing @c -D parameters to cmake, as follows.
 Note that the ending dot is mandatory (see @ref install_cmake_outsrc).
 
 @verbatim
 cmake -DCC=clang -DCXX=clang++ .
 @endverbatim
 
-Finally, you can use the ccmake graphical interface to change these settings. 
-
-@verbatim
-ccmake .
-@endverbatim
-
 @subsubsection install_cmake_list SimGrid compilation options
 
-In addition to the classical cmake configuration variables, SimGrid accepts several options, as listed below.
+Here is the list of SimGrid-specific @ref install_src_config
+"build-time options".
 
   @li <b>CMAKE_INSTALL_PREFIX</b> (path): Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
 
@@ -158,7 +192,7 @@ In addition to the classical cmake configuration variables, SimGrid accepts seve
       Jedule external tool.
 
   @li <b>enable_lua</b> (ON/OFF) to enjoy the lua bindings to the
-      SimGrid internals.
+      SimGrid internals (this require the liblua5.3-dev and lua-5.3 packages or equivalent).
 
   @li <b>enable_lib_in_jar</b> (ON/OFF) to make sure that the native
       java bindings are bundled in the jar file.
@@ -170,11 +204,10 @@ In addition to the classical cmake configuration variables, SimGrid accepts seve
   @li <b>enable_maintainer_mode</b> (ON/OFF) is only needed if you plan to modify very specific parts of SimGrid
       (e.g., the XML parsers and other related elements). Moreover, this adds an extra dependency on flex and flexml.
 
-  @li <b>enable_mallocators</b> (ON/OFF) has to be disabled when tracking memory issues within SimGrid, or the caching 
-      mechanism used internally will fool the debuggers.
+  @li <b>enable_mallocators</b> (ON/OFF) has to be disabled when tracking memory issues within SimGrid, 
+      or our internal memory caching mechanism will fool the debuggers.
 
-  @li <b>enable_model-checking</b> (ON/OFF) if you actually plan to
-      use the model-checking feature of SimGrid. This execution mode
+  @li <b>enable_model-checking</b> (ON/OFF) This execution gear
       is very usable now, but enabling this option at compile time
       will **hinder simulation speed** even when the model-checker is
       not activated at run time.
@@ -255,6 +288,44 @@ with MS Visual C. <a href="http://clang.llvm.org/docs/MSVCCompatibility.html">cl
 sounds promising to fix this. If you get something working, please
 @ref community_contact "tell us".
 
+@subsubsection install_java Build the Java bindings
+
+Once you have the [full JDK](http://www.oracle.com/technetwork/java/javase/downloads) installed
+(on Debian/Ubuntu, grab the package ```default-jdk``` for that), things should be as simple as:
+
+~~~~{.sh}
+cmake -Denable_java=ON .
+make 
+~~~~
+
+After the compilation, the file ```simgrid.jar``` is produced in the
+root directory. If you only want to build the jarfile and its
+dependencies, type ```make simgrid-java_jar```. It will save you the
+time of building every C examples and other things that you don't need
+for Java.
+
+** **Error: jni could not be found**. Sometimes, the build system fails
+to find the JNI headers. In this case, you need to first locate them as follows:
+
+~~~~{.sh}
+$ locate jni.h
+/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
+/usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
+~~~~
+
+Then, set the JAVA_INCLUDE_PATH environment variable to the right
+path, and relaunch cmake. If you have several version of jni installed
+(as above), use the right one (check the java version you use with
+```javac -version```).
+
+~~~~{.sh}
+export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
+cmake -Denable_java=ON .
+make
+~~~~
+
+Note that the filename ```jni.h``` was removed from the path.
+
 @subsubsection install_src_32bits 32 bits Builds on Multi-arch Linux
 
 On a multiarch x86_64 Linux, it should be possible to compile a 32 bit
@@ -274,7 +345,7 @@ cmake . \
 If needed, implement @c i686-linux-gnu-gfortran as a script:
 
 @verbatim
-#!/bin/sh
+#!/usr/bin/env sh
 exec gfortran -m32 "$@"
 @endverbatim
 
@@ -330,78 +401,4 @@ ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that y
                                       # That's fine, I do so all the time myself.
 @endverbatim
 
-@section install_setting_own Setting up your own code
-
-Directly modifying the SimGrid examples will make it harder to upgrade
-to the next version of SimGrid. Instead, you should create your own
-working directory somewhere on your disk
-(say `/home/joe/MyFirstScheduler/`).
-
-Here is a Makefile that will work if your project is composed of three
-C files named @c util.h, @c util.c and @c mysimulator.c. You should
-take it as a starting point, and adapt it to your code. There is a
-plenty of documentation and tutorial on Makefile if the file's
-comments are not enough for you.
-
-@verbatim
-# The first rule of a Makefile is the default target. It will be built when make is called with no parameter
-# Here, we want to build the binary 'mysimulator'
-all: mysimulator
-
-# This second rule lists the dependencies of the mysimulator binary
-# How this dependencies are linked is described in an implicit rule below
-mysimulator: mysimulator.o util.o
-
-# These third give the dependencies of the each source file
-mysimulator.o: mysimulator.c util.h # list every .h that you use
-util.o: util.c util.h
-
-# Some configuration
-SIMGRID_INSTALL_PATH = /opt/simgrid # Where you installed simgrid
-CC = gcc                            # Your compiler
-WARNING = -Wshadow -Wcast-align -Waggregate-return -Wmissing-prototypes \
-          -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes \
-          -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls \
-          -Wnested-externs -Wpointer-arith -Wwrite-strings -finline-functions
-
-# CFLAGS = -g -O0 $(WARNINGS) # Use this line to make debugging easier
-CFLAGS = -g -O2 $(WARNINGS) # Use this line to get better performance
-
-# No change should be mandated past that line
-#############################################
-# The following are implicit rules, used by default to actually build
-# the targets for which you listed the dependencies above.
-
-# The blanks before the $(CC) must be a Tab char, not spaces
-%: %.o
-       $(CC) -L$(SIMGRID_INSTALL_PATH)/lib/    $(CFLAGS) $^ -lsimgrid -o $@
-%.o: %.c
-       $(CC) -I$(SIMGRID_INSTALL_PATH)/include $(CFLAGS) -c -o $@ $<
-
-clean:
-       rm -f *.o *~
-.PHONY: clean
-@endverbatim
-
-@subsection install_setting_own_trouble Troubleshooting your code setup
-
-Sometimes, the following error message (or similar) will be produced.
-@verbatim
-masterworker.c:209: undefined reference to `sg_version_check'
-masterworker.c:209: undefined reference to `MSG_init_nocheck'
-(and possibly many other undefined references)
-@endverbatim
-
-It means that the system does not manage to find simgrid when it tries
-to execute your programs. Specify where to search with the
-<tt>LD_LIBRARY_PATH</tt> variable. Try running the following command
-before executing your code. If it helps, you should add this line to
-your ~/.bashrc so that it gets executed each time you log into your
-computer.
-
-@verbatim
-export LD_LIBRARY_PATH=/opt/simgrid/lib
-@endverbatim
-
-
 */