X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dccf1b41e9c7b5a696f01abceaa2779fe65f154f..7def8a1471cff759a06b836d283a39cbd0f0864f:/doc/doxygen/install_yours.doc diff --git a/doc/doxygen/install_yours.doc b/doc/doxygen/install_yours.doc index 3e4d319f6b..1046f524c2 100644 --- a/doc/doxygen/install_yours.doc +++ b/doc/doxygen/install_yours.doc @@ -27,15 +27,28 @@ project(MyFirstScheduler) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +find_package(SimGrid REQUIRED) +include_directories(${SimGrid_INCLUDE_DIR}) + set(SIMULATOR_SOURCES main.c other.c util.c) add_executable(my_simulator ${SIMULATOR_SOURCES}) -target_link_libraries(my_simulator simgrid) +target_link_libraries(my_simulator ${SimGrid_LIBRARY}) set(OTHER_SOURCES blah.c bar.c foo.h) add_executable(other_xp ${OTHER_SOURCES}) -target_link_libraries(other_xp simgrid) +target_link_libraries(other_xp ${SimGrid_LIBRARY}) @endverbatim +For that, you need FindSimGrid.cmake, +that is located at the root of the SimGrid tree. You can either copy +this file into the `cmake/Modules` directory of your project, or use +the version installed on the disk. Both solutions present advantages +and drawback: if you copy the file, you have to keep it in sync +manually but your project will produce relevant error messages when +trying to compile on a machine where SimGrid is not installed. Please +also refer to the file header for more information. + @section install_yours_makefile Building your project with Makefile Here is a Makefile that will work if your project is composed of three @@ -84,7 +97,15 @@ clean: .PHONY: clean @endverbatim -@section install_yours_javaexamples Building the Java examples in Eclipse +@section install_yours_cppeclipsedevenv Develop in C++ with SimGrid with Eclipse + +If you wish to develop your plugin or modify SimGrid using Eclipse. You have to run cmake and import it as a Makefile project. + +Next you have to activate C++11 in your build settings, add -std=c++11 in the CDT GCC Built-in compiler settings. + +![Eclipse preference page.](eclipseScreenShot.png) + +@section install_yours_javaexample Building the Java examples in Eclipse If you want to build our Java examples in Eclipse, get the whole source code and open the archive on your disk. In Eclipse, select @@ -105,21 +126,29 @@ SimGrid. @section install_yours_trouble Troubleshooting your project setup -@subsection install_yours_trouble_libpath Many undefined references +@subsection install_yours_trouble_libpath error while loading shared libraries: libsimgrid.so + +Sometimes, the following error message (or similar) will be produced: +@verbatim +./masterworker1: error while loading shared libraries: libsimgrid.so: +cannot open shared object file: No such file or directory +@endverbatim -Sometimes, the following error message (or similar) will be produced. +The same problem can make the execution of your programs spit pages +and pages of errors similar to the following. If there is only a few +undefined references, then you want to read the next section. @verbatim masterworker.c:209: undefined reference to `sg_version_check' masterworker.c:209: undefined reference to `MSG_init_nocheck' (and 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. +In both cases, it means that the system does not manage to find the +simgrid library when it tries to execute your programs. Under Linux, +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 @@ -133,8 +162,8 @@ the SimGrid library somewhere on your disk. Under Linux, you can find which version was used with the following command that will display the full path to every used dynamic library. -Once you've found the obsolete copy of SimGrid, just erase it and -relaunch your program. +Once you've found the obsolete copy of SimGrid, just erase it, and +recompile and relaunch your program. @verbatim ldd yoursimulator @endverbatim