Page 1 of 1

Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 11:21 am
by mallwright
Hi,

I have built the ARGoS Simulator from source and I'm trying to compile the examples. However the CMakeLists.txt file for the examples is hard coded to point to: /usr/share/argos2/FindARGoS.cmake.

In order to get the example to build, I copied FindARGoS.cmake to my source directory which contains the build bash script build.sh

I have modified the find_path parameters as follows:

Code: Select all

# # Find the header file # FIND_PATH(ARGOS_INCLUDE_DIR NAMES argos2/simulator/simulator.h PATHS ./ DOC "ARGoS header location" ) # # Find the library directory # FIND_PATH(ARGOS_LINK_DIR NAMES libargos2_simulator.so PATHS argos2/build/simulator/ DOC "ARGoS library location" )
However when I try to build this using the command:
developer@developer-vbox:~/Desktop/Workspace/argos2-examples-build$ cmake -DCMAKE_BUILD_TYPE=Release ../argos2-examples/

I receive the following error:

Code: Select all

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE): Could NOT find ARGoS (missing: ARGOS_LINK_DIR) Call Stack (most recent call first): /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE) /home/developer/Desktop/Workspace/argos2/FindARGoS.cmake:34 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:6 (find_package)
I think this might be related to the layout of the directories and location of the shared libraries which are as follows:

Location of libraries after installing from .deb on Ubuntu
user@devmach:/usr/lib/argos2$ ls
libargos2_common_control_interface.so
libargos2_simulator_povray_renderer.so
libargos2_common_utility.so
libargos2_simulator_qtopengl_renderer.so
libargos2_libs_freeimage.so
libargos2_simulator_sensors.so
libargos2_simulator_actuators.so
libargos2_simulator.so
libargos2_simulator_dynamic_linking.so
libargos2_simulator.so.2.0
libargos2_simulator_factories.so
libargos2_simulator_space.so
libargos2_simulator_physics_engines_dynamics2d.so
libargos2_simulator_text_renderer.so
libargos2_simulator_physics_engines_kinematics2d.so
libargos2_simulator_visualizations.so
libargos2_simulator_physics_engines_pointmass3d.so
libchipmunk.so
libargos2_simulator_physics_engines.so

Layout of the shared libraries after a build (relative to the directory containing build.sh):
./common/simulator/utility/libargos2_common_utility.so
./common/simulator/control_interface/libargos2_common_control_interface.so
./simulator/actuators/libargos2_simulator_actuators.so
./simulator/sensors/libargos2_simulator_sensors.so
./simulator/libargos2_simulator.so
./simulator/visualizations/libargos2_simulator_visualizations.so
./simulator/visualizations/povray/libargos2_simulator_povray_renderer.so
./simulator/visualizations/text/libargos2_simulator_text_renderer.so
./simulator/factories/libargos2_simulator_factories.so
./simulator/physics_engines/dynamics2d/libargos2_simulator_physics_engines_dynamics2d.so
./simulator/physics_engines/dynamics2d/chipmunk-physics/libchipmunk.so
./simulator/physics_engines/pointmass3d/libargos2_simulator_physics_engines_pointmass3d.so
./simulator/physics_engines/libargos2_simulator_physics_engines.so
./simulator/physics_engines/kinematics2d/libargos2_simulator_physics_engines_kinematics2d.so
./simulator/dynamic_linking/libargos2_simulator_dynamic_linking.so
./simulator/space/libargos2_simulator_space.so
./simulator/libs/FreeImage/libargos2_libs_freeimage.so

Any thoughts?

Re: Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 11:29 am
by mallwright
I also modified the CMakeLists.txt in the examples directory to point to the location where my modified FindARGoS.cmake file was located.

Re: Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 11:39 am
by pincy
It isn't necessary to modify the FindARGoS.cmake script. In my experience, the fastest way to get what you want is to modify the base CMakeLists.txt file of the examples.
Just substitute the line that says:

Code: Select all

find_package(ARGoS REQUIRED)
with the following three lines:

Code: Select all

set(ARGOS_INCLUDE_DIR /path/to/argos2-sources) set(ARGOS_LINK_DIR /path/to/argos2-sources/build/common/simulator/control_interface /path/to/argos2-sources/build/common/simulator/utility /path/to/argos2-sources/build/simulator) add_definitions(-DTIXML_USE_CPP)
Then erase the build/ directory of the examples and repeat the steps to configure the build.

Re: Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 11:55 am
by mallwright
Wow that worked perfectly! Cheers!

I have some errors regarding TinyXML (‘ticpp’ does not name a type) but they should be trivial to resolve.

Thanks again!

Re: Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 12:14 pm
by pincy
The error you get about ticpp should be solved if you add the "add_definitions(...)" line above. Without that line, the C++ extensions of TinyXML are not compiled and you get the error about ticpp.

Re: Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 12:16 pm
by mallwright
Resolved. The line above should read:

add_definitions(-DTIXML_USE_TICPP)
not
add_definitions(-DTIXML_USE_CPP)

Re: Compiling the examples when building ARGoS from source

Posted: Wed May 09, 2012 12:38 pm
by pincy
You're right. I should copy-paste more often :-) Thanks for spotting it!