X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6d9c67b14f86e16e2c4fefe44443e18bada3ed1a..147baad3c85745bba0138d0b4ba105e94d4ee91f:/doc/doxygen/install.doc?ds=sidebyside diff --git a/doc/doxygen/install.doc b/doc/doxygen/install.doc index d78e20aaa9..17922dbb9c 100644 --- a/doc/doxygen/install.doc +++ b/doc/doxygen/install.doc @@ -1,370 +1,298 @@ -/*! -\page install Installing Simgrid +/*! @page install Installing Simgrid -\section install_cmake Installing the SimGrid library +@tableofcontents -\subsection install_installing_cmake Installing cmake +SimGrid should work out of the box on Linux, Mac OSX, FreeBSD, and Windows (under windows, only the Java interfaces are +available at the moment). -You must have cmake in order to compile SimGrid. If you cannot find a -binary package of cmake for your system, you'll need to recompile it. -In turn, cmake has a few dependencies: +The easiest way to install SimGrid is to go for a @ref install_binary "binary package". Under Debian or Ubuntu, this is +very easy as SimGrid is directly integrated to the official repositories. For other Linux variants, you probably want +to go for a @ref install_src "source install". Please contact us if you want to contribute the build scripts for your +preferred distribution. If you just want to use @ref install_binary_java "Java", simply copy the jar file on your disk +and you're set. -For Unix and MacOS: - \li make - \li perl and libpcre - \li c and c++ compiler - \li ccmake for graphical used of CMake - \li cmake (download page) +@section install_binary Installing a binary package -On MacOSX some users reported that it is still possible to build with clang, provided that you -use at least clang3.0 installed with macport or with xcode. If it fails on you, try to - use gcc47. -\verbatim -port install clang-3.0 -port install gcc47 -\endverbatim +@subsection install_binary_linux Binary packages for linux -For Windows: - \li cmake 2.8 (download page) - \li MinGW (download page) - \li perl (download page) - \li git (download page) +Most of the developers use a Debian or Ubuntu system, and some of us happen to be Debian Maintainers, so the packages +for these systems are well integrated with these systems and very up-to-date. To install them, simply type: -Note that if you want change the compiler, you can simply specify the environment variables CC and CXX. -\verbatim - export CC=gcc-4.4 - export CXX=g++-4.4 - export CC=clang - export CXX=clang++ -\endverbatim +@verbatim +apt-get install simgrid +@endverbatim -\subsubsection install_cmakeoption1 SimGrid configuration options +@subsection install_binary_java Using the binary jar file -\verbatim -"cmake -D[name]=[value] ... ./" - -[name] enable_gtnets [value] ON/OFF or TRUE/FALSE or 1/0 - enable_ns3 ON/OFF or TRUE/FALSE or 1/0 - enable_lua ON/OFF or TRUE/FALSE or 1/0 - enable_compile_optimizations ON/OFF or TRUE/FALSE or 1/0 - enable_compile_warnings ON/OFF or TRUE/FALSE or 1/0 - enable_smpi ON/OFF or TRUE/FALSE or 1/0 - enable_maintainer_mode ON/OFF or TRUE/FALSE or 1/0 - enable_tracing ON/OFF or TRUE/FALSE or 1/0 - enable_coverage ON/OFF or TRUE/FALSE or 1/0 - enable_memcheck ON/OFF or TRUE/FALSE or 1/0 - enable_model-checking ON/OFF or TRUE/FALSE or 1/0 - enable_debug ON/OFF or TRUE/FALSE or 1/0 - enable_jedule ON/OFF or TRUE/FALSE or 1/0 - enable_latency_bound_tracking ON/OFF or TRUE/FALSE or 1/0 - enable_lib_static ON/OFF or TRUE/FALSE or 1/0 - enable_supernovae ON/OFF or TRUE/FALSE or 1/0 - enable_msg_deprecated ON/OFF or TRUE/FALSE or 1/0 - enable_print_message ON/OFF or TRUE/FALSE or 1/0 - gtnets_path - ns3_path - CMAKE_INSTALL_PREFIX - pipol_user -\endverbatim +The easiest way to install the Java bindings of SimGrid is to grab the jar file from the +[download page](https://gforge.inria.fr/frs/?group_id=12) and copy it in your classpath (typically, in the same +directory as your source code). If you go for that version, there is no need to install the C library as it is already +bundled within the jar file. Actually, only a bunch of architectures are supported this way to keep the jar file size +under control and because we don't have access to every exotic architectures ourselves. - \li enable_gtnets: set to true implies that user wants to use gtnets. +If the jarfile fails on you, complaining that your architecture is not supported, drop us an email on +. We may extend the jarfile for you, provided we have access to this +particular architecture to build SimGrid on it. - \li enable_ns3: set to true implies that user wants to use ns3. +If the error message is about the boost-context library, then you should install that library on your machine. This is +a known issue in the 3.12 release that will be fixed in the next release. - \li enable_lua: set to true implies that user wants to add lua language into simgrid compilation. +You can retrieve a nightly build of the jar file from our autobuilders. +For Windows, head to [AppVeyor](https://ci.appveyor.com/project/mquinson/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. +For non-Windows systems (Linux, Mac or FreeBSD), head to [Jenkins](https://ci.inria.fr/simgrid/job/SimGrid-Multi). +In the build history, pick the last green (or at least yellow) build that is not blinking (i.e., not currently under +build). In the list, pick a system that is close to yours, and click on the ball in the Debug row. The build artefact +will appear on the top of the resulting page. - \li enable_compile_optimizations: add flags "-O3 -finline-functions -funroll-loops -fno-strict-aliasing" +@section install_src Installing from source - \li enable_compile_warnings: add flags "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror" +@subsection install_src_deps Resolving the dependencies - \li enable_smpi: Set to true if you want to use smpi lib. Actually on simgrid v3.4.1 Mac doesn't support lib smpi. +Recompiling an official archive is not much more complex. SimGrid only uses very standard tools: + - C compiler, C++ compiler, make and friends. + - 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. + - LibBoost: + - osX: 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 (only needed if you want to use the Java bindings): Grab a + [full JDK](http://www.oracle.com/technetwork/java/javase/downloads) - \li enable_maintainer_mode: set to true it remakes some files. +For platform specific details, please see @ref install_cmake_mac and @ref install_cmake_windows. - \li enable_tracing: To enable the generation of simulation traces for visualization. +@subsection install_src_fetch Getting the sources - \li enable_coverage: When set to true this option enable code coverage by setting -fprofile-arcs -ftest-coverage flags. +You can download the *@SimGridRelease.tar.gz* archive from the +[download page](https://gforge.inria.fr/frs/?group_id=12). +Then, recompiling the archive should be done in a few lines: - \li enable_memcheck: When set to true this option enable tests for memcheck. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh} +tar xf @SimGridRelease.tar.gz +cd @SimGridRelease +cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid . +make +make install +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - \li enable_model-checking: Enable the model checking when set to true. +If you want to stay on the bleeding edge, you should get the latest git version, and recompile it as you would do for +an official archive. Depending on the files you change in the source tree, some extra tools may be needed. - \li enable_debug: If enable_debug is set to 'off' Simgrid compile flag has '-DNDEBUG' option. +@verbatim +git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid +@endverbatim - \li enable_jedule: To enable jedule mode, which creates visualizations of task schedules with Simdag. +@subsection install_src_config Configuring the build - \li enable_latency_bound_tracking: Set to on if you want to be warned when communications are limited by round trip time. +Note that compile-time options are very different from @ref options "run-time options". - \li enable_lib_static: Enable generated Simgrid and smpi static libraries. +\subsubsection install_cmake_howto Setting compilation options - \li enable_supernovae: Set to true make one file for each lib and compile with those generated files. +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: - \li enable_msg_deprecated: Simgrid is compiled with msg deprecated functions. +@verbatim +export CC=gcc-4.7 +export CXX=g++-4.7 +@endverbatim - \li enable_print_message: When set to true configuration print more debug output. +Note that other variables are available, such as CFLAGS and CXXFLAGS to add options respectively for the C and C++ +compilers. - \li gtnets_path: Path to gtnets install directory (ex /usr) +Another way to do so is to use the -D argument of cmake as follows. Note that the terminating dot is mandatory (see @ref +install_cmake_outsrc to understand its meaning). - \li ns3_path: Path to ns3 install directory (ex /usr) +@verbatim +cmake -DCC=clang -DCXX=clang++ . +@endverbatim - \li CMAKE_INSTALL_PREFIX: Path where are installed lib/ doc/ and include/ directories (ex /usr/local) +Finally, you can use a graphical interface such as ccmake to change these settings. Simply follow the instructions after +starting the interface. - \li pipol_user: specify your pipol username if you want to use the pipol-remote command. +@verbatim +ccmake . +@endverbatim -\subsubsection install_cmakeoption3 Initialization +\subsubsection install_cmake_list SimGrid compilation options -Those options are initialized the first time you launch "cmake ." without specified option. +In addition to the classical cmake configuration variables, SimGrid accepts several options, as listed below. -\verbatim -enable_gtnets on -enable_lua on -enable_smpi on -enable_tracing on -enable_compile_optimizations on -enable_debug on -enable_compile_warnings off -enable_maintainer_mode off -enable_coverage off -enable_memcheck off -enable_model-checking off -enable_jedule off -enable_latency_bound_tracking off -enable_lib_static off -CMAKE_INSTALL_PREFIX /usr/local -gtnets_path null -pipol_user null -\endverbatim + @li CMAKE_INSTALL_PREFIX (path): Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere). -\subsubsection install_cmakeoption4 How to reset the cache of options + @li enable_compile_optimizations (ON/OFF) to request the compiler to produce efficient code. You want to + activate it, unless you plan to debug SimGrid itself. Indeed, efficient code may be appear mangled to debuggers. -When options have been set they are keep into a cache file named "CMakeCache.txt". So if you want -reset values you just delete this file located to the project directory. + @li enable_compile_warnings (ON/OFF) to request the compiler to issue error messages whenever the source code + is not perfectly clean. If you are a SimGrid developer, you have to activate this option to enforce the code + quality. As a regular user, this option is likely to bring you issues only. -\subsection install_cmakecompilation Cmake compilation + @li enable_debug (ON/OFF) allows to discard all log messages of gravity debug or below at compile time, if + simulation speed matters. As there is quite a bunch of such log messages in SimGrid internals, this can reveal + faster than discarding them at runtime as usual. However, it obviously becomes impossible to get any debug + message from SimGrid if something goes wrong. -\subsubsection install_cmakecompilation1 With command line. + @li enable_documentation (ON/OFF) to generate the documentation pages. -On Unix or Mac platform: + @li enable_java (ON/OFF) to enjoy the java bindings of SimGrid. -\verbatim -cmake -D[name]=[value] ... ./ -make -\endverbatim + @li enable_jedule (ON/OFF) to get SimDag producing execution traces that can then be visualized with the + Jedule external tool. -On Windows platform: + @li enable_lua (ON/OFF) to enjoy the lua bindings of SimGrid. It adds an extra dependency on the lua library + and developer header files. -\verbatim -cmake -G"MinGW Makefiles" -D[name]=[value] ... ./ -mingw32-make -\endverbatim + @li enable_lib_in_jar (ON/OFF) to XXX -\subsubsection install_cmakecompilation2 With ccmake tool. + @li enable_lto (ON/OFF) to XXX -\verbatim -"ccmake ./" -\endverbatim -Then follow instructions. + @li enable_maintainer_mode (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. -\subsubsection install_cmakecompilation2bis Build out of source. + @li enable_mallocators (ON/OFF) has to be disabled when tracking memory issues within SimGrid, or the caching + mechanism used internally will fool the debuggers. -As cmake generate many files used for compilation, we recommend to make a build directory. -For examples you can make: + @li enable_model-checking (ON/OFF) if you actually plan to use the model-checking feature of + SimGrid. This execution mode is still under heavy work, but should be rather usable now. Be warned that + this option will hinder simulation speed even if you simulate without activating the model-checker. We are + working on improving this situation. -\verbatim -"navarrop@caraja:~/Developments$ cd simgrid/" -"navarrop@caraja:~/Developments/simgrid$ mkdir build_directory" -"navarrop@caraja:~/Developments/simgrid$ cd build_directory/" -"navarrop@caraja:~/Developments/simgrid/build_directory$ cmake ../" -"navarrop@caraja:~/Developments/simgrid/build_directory$ make" -\endverbatim + @li enable_ns3 (ON/OFF) if you want to use ns-3. See section @ref pls_simgrid_configuration_ns3. -Or completely out of sources: + @li enable_smpi (ON/OFF) has to be disabled if you have issues with the module allowing to run MPI code on + top of SimGrid. This module is very stable, but if you don't really need it, you can disable it safely. -\verbatim -"navarrop@caraja:~/Developments$ mkdir build_dir" -"navarrop@caraja:~/Developments$ cd build_dir/" -"navarrop@caraja:~/Developments/build_dir$ cmake ../simgrid/" -"navarrop@caraja:~/Developments/build_dir$ make" -\endverbatim + @li enable_smpi_ISP_testsuite (ON/OFF) to XXX -Those two kinds of compilation allow to delete files created by compilation more easily. + @li enable_smpi_MPICH3_testsuite (ON/OFF) to XXX -\subsubsection install_cmakecompilation3 Resume of command line +\subsubsection install_cmake_reset Resetting the compilation configuration - \li CMake -\verbatim -cmake configure the project for Unix and Mac -cmake -G"MinGW Makefiles" configure the project for Windows -make build all targets for Unix and Mac -ming32-make build all targets for windows -(g)make VERBOSE=1 build all targets and print build command lines -make check test all targets and summarize -make dist make the distrib -make distcheck check the dist (make + make dist + make check) -(g)make install install the project (doc/ bin/ lib/ include/) -(g)make uninstall uninstall the project (doc/ bin/ lib/ include/) -(g)make clean clean all targets -make simgrid_documentation Create simgrid documentation -\endverbatim +If you need to empty the cache of values saved by cmake (either because you added a new library or because something +seriously went wrong), you can simply delete the file CMakeCache.txt that is created at the root of the source tree. +You may also want to directly edit this file in some circumstances. -When the project have been successfully compiling and build you can make tests. +\subsubsection install_cmake_outsrc Compiling into a separate directory - \li CTest -\verbatim -ctest launch only tests -ctest -D Continuous -ctest -D Continuous(Start|Update|Configure|Build) -ctest -D Continuous(Test|Coverage|MemCheck|Submit) -ctest -D Experimental -ctest -D Experimental(Start|Update|Configure|Build) -ctest -D Experimental(Test|Coverage|MemCheck|Submit) -ctest -D Nightly -ctest -D Nightly(Start|Update|Configure|Build) -ctest -D Nightly(Test|Coverage|MemCheck|Submit) -ctest -D NightlyMemoryCheck -\endverbatim +By default, the files produced during the compilation are placed in +the source directory. As compilation generates a lot of files, it +is advised to put them all in a separate directory. It is then +easier to cleanup, and this allows to compile several configurations +out of the same source tree. For that, simply enter the directory +where you want the produced files to land, and invoke cmake (or +ccmake) with the full path to the SimGrid source as last argument. +This approach is called "out-of-source-tree compilation". -If you want to test before make a commit you can simply make "ctest -D Experimental" and then you can visualize results submitted into Cdash. (Go to Cdash site). +@verbatim +mkdir build +cd build +cmake [options] .. +make +@endverbatim -\subsection install_cmakeinstall How to install with cmake? +\subsubsection install_cmake_mac Building on Mac OS X -\subsubsection install_cmakeinstall1 From Git. +SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X: -\verbatim -git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid -cd simgrid -cmake -Denable_maintainer_mode=on -DCMAKE_INSTALL_PREFIX=/home/navarrop/Bureau/install_simgrid ./ +@verbatim +cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ . make -make install -\endverbatim - -\subsubsection install_cmakeinstall2 From a distrib - -\verbatim -wget https://gforge.inria.fr/frs/download.php/28674/simgrid-3.6.1.tar.gz -tar xf simgrid-3.6.1.tar.gz -cd simgrid-3.6.1 -cmake -DCMAKE_INSTALL_PREFIX=/home/navarrop/Bureau/install_simgrid ./ +@endverbatim + +With the XCode version of clang 4.1, you may get the following error message: +@verbatim +CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk +@endverbatim + +In that case, edit the CMakeCache.txt file directly, so that the +CMAKE_OSX_SYSROOT is similar to the following. Don't worry about the +warning that the "-pthread" argument is not used, if it appears. +@verbatim +CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer +@endverbatim + +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 +activestate +version of Perl, and the +msys +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, clang-cl +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: + +@verbatim make -make install -\endverbatim - -\section install_Win Installing the SimGrid framework on Windows - -\subsection install_Win_install Installing SimGrid with the automatic installer +make install # try "sudo make install" if you don't have the permission to write +@endverbatim + +In addition, several compilation targets are provided in SimGrid. If +your system is well configured, the full list of targets is available +for completion when using the Tab key. Note that some of the existing +targets are not really for public consumption so don't worry if some +stuff doesn't work for you. + +@verbatim +make simgrid Build only the SimGrid library and not any example +make masterslave Build only this example (and its dependencies) +make clean Clean the results of a previous compilation +make install Install the project (doc/ bin/ lib/ include/) +make uninstall Uninstall the project (doc/ bin/ lib/ include/) +make dist Build a distribution archive (tgz) +make distcheck Check the dist (make + make dist + tests on the distribution) +make documentation Create SimGrid documentation +@endverbatim + +If you want to see what is really happening, try adding VERBOSE=1 to +your compilation requests: + +@verbatim +make VERBOSE=1 +@endverbatim + +@subsection install_src_test Testing SimGrid + +Once everything is built, you may want to test the result. SimGrid +comes with an extensive set of regression tests (see @ref +inside_tests "that page of the insider manual" for more +details). Running the tests is done using the ctest binary that comes +with cmake. These tests are run for every commit and the result is +publicly available. -Before start the installation, you need to be sure to have the following dependencies: - \li cmake 2.8 (download page) - \li MinGW (download page) - \li perl (download page) - \li git (download page) - -Then download the package SimGrid Installer, -execute it and follow instructions. - -\htmlonly - -\endhtmlonly - -Step 1: Accept the license. - -\htmlonly - -\endhtmlonly - -Step 2: Select packets to install. - -\htmlonly - -\endhtmlonly - -Step 3: Choice where to install packets previously selected. Please don't use spaces in path. - -\htmlonly - -\endhtmlonly - -Step 4: Add CLASSPATH to environment variables. - -\htmlonly - -\endhtmlonly - -Step 5: Add PATH to environment variables. - -\htmlonly - -\endhtmlonly - -Step 6: Restart your computer to take in consideration environment variables. - -\subsection install_Win_compile1 Compile a project "HelloWorld" - -In the SimGrid install directory you should have an HelloWorld project to explain you how to start -compiling a source file. There are: \verbatim -- HelloWorld.c The example source file. -- CMakeLists.txt It allows to configure the project. -- FindPCRE.cmake This finds and links to the pcre library (Normally included - into Simgrid directory "GnuWin32"). -- README This explaination. +ctest # Launch all tests +ctest -R msg # Launch only the tests which name match the string "msg" +ctest -j4 # Launch all tests in parallel, at most 4 at the same time +ctest --verbose # Display all details on what's going on +ctest --output-on-failure # Only get verbose for the tests that fail + +ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that you didn't break anything, huh? + # That's fine, I do so all the time myself. \endverbatim -Now let's compile this example: -\li Run windows shell "cmd". -\li Open HelloWorld Directory ('cd' command line). -\li Create a build directory and change directory. (optional) -\li Type 'cmake -G"MinGW Makefiles" \' -\li Run mingw32-make -\li You should obtain a runnable example ("HelloWorld.exe"). - -For compiling your own code you can simply copy the HelloWorld project and rename source name. It will -create a target with the same name of the source. - -\subsection install_Win_compile2 How to add and compile a new example - -\li Put your source file into the helloWord directory. -\li Edit CMakeLists.txt by removing the Find Targets section and add those two lines into this section -\verbatim -################ -# FIND TARGETS # -################ -#It creates a target called 'TARGET_NAME.exe' with the sources 'SOURCES' -add_executable(TARGET_NAME SOURCES) -#Links TARGET_NAME with simgrid and pcre -target_link_libraries(TARGET_NAME simgrid pcre) -\endverbatim -\li To initialize and build your project, you'll need to run -\verbatim -cmake -G"MinGW Makefiles" \ -\endverbatim -\li Run "mingw32-make" -\li You should obtain "TARGET_NAME.exe". - -\subsection install_Win_ruby Setup a virtualbox to use SimGrid-Ruby on windows - -Allan Espinosa made these set of Vagrant rules available so that you -can use the SimGrid Ruby bindings in a virtual machine using -VirtualBox. Thanks to him for that. You can find his project here: -https://github.com/aespinosa/simgrid-vagrant - -\section install_mac Installing the SimGrid framework on Mac OS X - -The Mac OS X system is part of the UNIX family, but it exhibits some -specificities that complicate a bit the build of SimGrid. Current -versions of SimGrid (3.7.x) can only be build with the GCC Compiler, -but recent OS X version provide only an ancient version of that tool -in the hope to see the users switch to the LLVM compiler family. The -problem is that SimGrid uses internal libraries of GCC, for stack -manipulation for example. We are working on removing this dependency -onto gcc to ease the build process, but this is still ongoing. - -For the time being, you need to get a recent version of GCC on your -system to build SimGrid. Version 3.7.1 was successfully built on Mac -Lion 10.7.4 using a GCC compiler retrieved from macport. The package -used were gcc47, and the binary in the package were gcc-mp-4.7. - -\section install_setting_MSG Setting up your own MSG code +\section install_setting_own Setting up your own code Do not build your simulator by modifying the SimGrid examples. Go outside the SimGrid source tree and create your own working directory @@ -393,53 +321,89 @@ 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 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) $(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 -(masterslave) and of which files it is to be made of -(masterslave.o and sched.o). This makefile assumes -that you have set up correctly your LD_LIBRARY_PATH variable -(look, there is a LDADD = -lm -lsimgrid). If you prefer using -the static version, remove the -lsimgrid and add a -$(INSTALL_PATH)/lib/libsimgrid.a on the next line, right -after the LIBS = . - -More generally, if you have never written a Makefile by yourself, type -in a terminal: info make and read the introduction. The -previous example should be enough for a first try but you may want to -perform some more complex compilations... - - +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 +make-doc package and type this command in a terminal: +info make. + +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 +LD_LIBRARY_PATH 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 + +@subsection install_src_32 Compiling a 32 bit version + +On a multiarch x86_64 Linux, it should be possible to compile a 32 bit +version of SimGrid with something like: + +@verbatim +CFLAGS=-m32 \ +CXXFLAGS=-m32 \ +PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \ +cmake . \ +-DCMAKE_SYSTEM_PROCESSOR=i386 \ +-DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \ +-DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \ +-DCMAKE_Fortran_FLAGS=-m32 +@endverbatim + +where i686-linux-gnu-gfortran can be implemented as: + +@verbatim +#!/bin/sh +exec gfortran -m32 "$@" +@endverbatim */