Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix a typo in the Makefile we propose to our users
[simgrid.git] / doc / doxygen / install.doc
index eabdcc4..1ce4cd8 100644 (file)
@@ -3,12 +3,13 @@
 
 @tableofcontents
 
+SimGrid should work out of the box on Linux, Mac OSX, FreeBSD and
+Windows (under windows, only the Java interfaces are available atm).
+
 The easiest way to install SimGrid is to go for a binary package.
 Under Debian or Ubuntu, this is very easy as SimGrid is directly
 integrated to the official repositories.  If you just want to use
-Java, simply copy the jar file on your disk and you're set. Note that
-under Windows, you should go for Java, as the native C interface is
-not supported on that OS.
+Java, simply copy the jar file on your disk and you're set.
 
 Recompiling an official archive is not much more complex, actually.
 SimGrid has very few dependencies and rely only on very standard
@@ -92,22 +93,14 @@ SimGrid only uses very standard tools:
       You need cmake version 2.8.8 or higher. You may want to use ccmake
       for a graphical interface over cmake.
   - LibBoost:
-    - osX: with <a href="http://www.finkproject.org/">fink</a>: `sudo fink install boost1.53.nopython`
+    - osX: with <a href="http://www.finkproject.org/">fink</a>: `fink install boost1.53.nopython`,
+      or with homebrew: `brew install boost`
     - debian: `apt-get install libboost-dev libboost-context-dev`
+  - Java (only needed if you want to use the Java bindings): Grab a
+    full JDK from http://www.oracle.com/technetwork/java/javase/downloads
 
-On MacOSX, it is advised to use the clang compiler (version 3.0 or
-higher), from either MacPort or XCode.  See also @ref install_cmake_mac.
-
-Building from the source on Windows, may be something of an adventure.
-We never managed to compile SimGrid with something else than MinGW-64
-ourselves. We usually use the
-<a href="http://www.activestate.com/activeperl/downloads">activestate</a>
-version of Perl, and the
-<a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">msys</a>
-version of git on this architecture, but YMMV. You can have a look at
-the configuration scripts in the appveyor.yml file, but you are
-basically on your own here. Sorry. We are not fluent with Windows so
-we cannot really help. 
+For platform specific details, please see  @ref install_cmake_mac and
+@ref install_cmake_windows.
 
 @subsection install_src_fetch Retrieving the source
 
@@ -165,7 +158,7 @@ In addition to the classical cmake configuration variables, SimGrid
 accepts several options, as listed below.
 
   @li <b>CMAKE_INSTALL_PREFIX</b> (path): Where to install SimGrid
-      (e.g. /usr/local or /opt).
+      (/opt/simgrid or /usr/local or elsewhere).
 
   @li <b>enable_compile_optimizations</b> (ON/OFF): request the
       compiler to produce efficient code. You want to activate it,
@@ -198,10 +191,6 @@ accepts several options, as listed below.
       (the XML parsers and other related elements). Adds an extra
       dependency on flex and flexml.
 
-  @li <b>enable_tracing</b> (ON/OFF): disable this if you have issues
-      with the tracing module. But this module is now very stable and
-      you really should try to enjoy this beauty.
-
   @li <b>enable_smpi</b> (ON/OFF): disable this if you have issues
       with the module allowing to run MPI code on top of SimGrid. This
       module very stable, but if you really don't need it, you can
@@ -223,9 +212,6 @@ accepts several options, as listed below.
   @li <b>enable_ns3</b> (ON/OFF): whether you want to use ns3.
       See section @ref pls_simgrid_configuration_ns3.
   @li <b>NS3_HINT</b> (path): Where to search for NS3 (eg /usr or /opt).
-  @li <b>enable_latency_bound_tracking</b> (ON/OFF): enable it if you
-      want to be warned when communications are limited by round trip
-      time while doing packet-level simulation.
   @li <b>enable_documentation</b> (ON/OFF) : whether the documentation should be
        generated during the compilation. Default is ON.
 
@@ -255,9 +241,9 @@ cmake [options] ..
 make
 @endverbatim
 
-\subsubsection install_cmake_mac Cmake on Mac OS X
+\subsubsection install_cmake_mac Building on Mac OS X
 
-SimGrid compiles like a charm with clang on Mac OS X:
+SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
 
 @verbatim
 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
@@ -276,7 +262,30 @@ warning that the "-pthread" argument is not used, if it appears.
 CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
 @endverbatim
 
-\subsection install_src_compil Compiling SimGrid
+In the El Capitan version of Max OS X, Apple decided that users don't
+need no /usr/include directory anymore. If you are hit by this pure
+madness, just run the following command to restore that classical
+UNIX directory: `xcode-select -install`
+
+\subsubsection install_cmake_windows Building on Windows
+
+Building from the source on Windows, may be something of an adventure.
+We never managed to compile SimGrid with something else than MinGW-64
+ourselves. We usually use the
+<a href="http://www.activestate.com/activeperl/downloads">activestate</a>
+version of Perl, and the
+<a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">msys</a>
+version of git on this architecture, but YMMV. You can have a look at
+the configuration scripts in the appveyor.yml file, but you are
+basically on your own here. Sorry. We are not fluent with Windows so
+we cannot really help. 
+
+The drawback of MinGW-64 is that the produced DLL are not compatible
+with MS Visual C. If you need it, <a href="http://clang.llvm.org/docs/MSVCCompatibility.html">clang-cl</a>
+sounds promising. If you manage to get something working, please tell
+us how you achieved it.
+
+\subsection install_src_compil SimGrid main compilation targets
 
 In most cases, compiling and installing SimGrid is enough:
 
@@ -331,8 +340,6 @@ ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that y
 
 \section install_setting_own Setting up your own code
 
-\subsection install_setting_MSG MSG code on Unix
-
 Do not build your simulator by modifying the SimGrid examples.  Go
 outside the SimGrid source tree and create your own working directory
 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
@@ -360,52 +367,66 @@ Makefile. It is a generic Makefile that we have used many times with
 our students when we teach the C language.
 
 \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 'masterslave'
 all: masterslave
+
+# This second rule lists the dependencies of the masterslave binary
+# How this dependencies are linked is described in an implicit rule below
 masterslave: masterslave.o sched.o
 
-INSTALL_PATH = $$HOME
-CC = gcc
-PEDANTIC_PARANOID_FREAK =       -O0 -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
-REASONABLY_CAREFUL_DUDE =      -Wall
-NO_PRAYER_FOR_THE_WICKED =     -w -O2
-WARNINGS =                     $(REASONABLY_CAREFUL_DUDE)
-CFLAGS = -g $(WARNINGS)
-
-INCLUDES = -I$(INSTALL_PATH)/include
-DEFS = -L$(INSTALL_PATH)/lib/
-LDADD = -lm -lsimgrid
-LIBS =
+# These third give the dependencies of the each source file
+masterslave.o: masterslave.c sched.h # list every .h that you use
+sched.o: sched.c sched.h
 
-%: %.o
-       $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
+# 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 performances
+
+# 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) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
+       $(CC) -I$(SIMGRID_INSTALL_PATH)/include $(CFLAGS) -c -o $@ $<
 
 clean:
-       rm -f $(BIN_FILES) *.o *~
-.SUFFIXES:
+       rm -f *.o *~
 .PHONY: clean
-
 \endverbatim
 
-The first two lines indicates what should be build when typing make
-(<tt>masterslave</tt>) and of which files it is to be made of
-(<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
-that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
-(look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
-the static version, remove the <tt>-lsimgrid</tt> and add a
-<tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
-after the <tt>LIBS = </tt>.
+The comments of this file should be enough to understand what's going
+on. If you are completely new to makefiles, you should install the
+<tt>make-doc</tt> package and type this command in a terminal: 
+<tt>info make</tt>.
 
-More generally, if you have never written a Makefile by yourself, type
-in a terminal: <tt>info make</tt> and read the introduction. The
-previous example should be enough for a first try but you may want to
-perform some more complex compilations...
+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
 
 */