robotology / gazebo-fmi

FMI import plugins for the Gazebo Simulator.
GNU Lesser General Public License v3.0
24 stars 5 forks source link

FindFMILibrary thinks that the build directory of FMILibrary is a legit include directory #8

Open prashanthr05 opened 6 years ago

prashanthr05 commented 6 years ago

I had followed the steps according to the README here. The FMI library was compiled and installed, the CMAKE_PREFIX_PATH was appended with the FMILibrary root folder. However, the compilation of gazebo-fmi fails with the following output

/usr/bin/cmake -H/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi -B/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build/CMakeFiles /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build'
make -f plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/build.make plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/depend
make[2]: Entering directory '/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build'
cd /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/plugins/actuator /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build/plugins/actuator /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build/plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build'
make -f plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/build.make plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/build
make[2]: Entering directory '/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build'
[ 33%] Building CXX object plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/FMIActuatorPlugin.cc.o
cd /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build/plugins/actuator && /usr/bin/c++   -DFMIActuatorPlugin_EXPORTS -DLIBBULLET_VERSION=2.83 -DLIBBULLET_VERSION_GT_282 -I/usr/include/gazebo-8 -I/usr/include/bullet -I/usr/include/simbody -I/usr/include/sdformat-5.3 -isystem /usr/include/ignition/math3 -I/usr/include/OGRE -I/usr/include/OGRE/Terrain -I/usr/include/OGRE/Paging -I/usr/include/ignition/transport3 -I/usr/include/uuid -isystem /usr/include/ignition/msgs0 -isystem /home/pramadoss/iit_ws/robotology_playground/FMILibrary/build  -g -fPIC   -std=c++11 -o CMakeFiles/FMIActuatorPlugin.dir/FMIActuatorPlugin.cc.o -c /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/plugins/actuator/FMIActuatorPlugin.cc
In file included from /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/plugins/actuator/FMIActuatorPlugin.hh:38:0,
                 from /home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/plugins/actuator/FMIActuatorPlugin.cc:28:
/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/plugins/actuator/FMUCoSimulation.hh:18:29: fatal error: FMI2/fmi2_types.h: No such file or directory
compilation terminated.
plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/build.make:62: recipe for target 'plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/FMIActuatorPlugin.cc.o' failed
make[2]: *** [plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/FMIActuatorPlugin.cc.o] Error 1
make[2]: Leaving directory '/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build'
CMakeFiles/Makefile2:135: recipe for target 'plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/all' failed
make[1]: *** [plugins/actuator/CMakeFiles/FMIActuatorPlugin.dir/all] Error 2
make[1]: Leaving directory '/home/pramadoss/iit_ws/robotology_playground/gazebo-fmi/build'
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
traversaro commented 6 years ago

Mh. That's strange. Which version of CMake are you using? Can you post the output of this command in the build directory: cat CMakeCache.txt | grep FMI ?

Thanks

traversaro commented 6 years ago

For some reason, your FMILibrary_INCLUDE_DIR seems to point to /home/pramadoss/iit_ws/robotology_playground/FMILibrary/build that indeed contains the fmilib.h searched by the FindFMILibrary.cmake script (https://github.com/robotology-playground/gazebo-fmi/blob/master/cmake/FindFMILibrary.cmake#L43).

Indeed, I am able to replicate your problem if I append FMILibrary/build instead of the actuall install prefix of the library. In a sense, it is a bug of the FindFMILibrary.cmake script.

traversaro commented 6 years ago

I guess the workaround for you is easy, but the actual fix in the FindFMILibrary is not obvious. See http://cmake.3232098.n2.nabble.com/find-path-for-multiple-files-td4666892.html . It is probably easier to just send a patch to FMILibrary for providing a proper FMILibraryConfig.cmake file.

prashanthr05 commented 6 years ago

Which version of CMake are you using?


cmake --versioncmake version 3.5.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).


>Can you post the output of this command in the build directory: cat CMakeCache.txt | grep FMI ?

cat CMakeCache.txt | grep FMI FMIActuatorPlugin_LIB_DEPENDS:STATIC=general;BulletSoftBody;general;BulletDynamics;general;BulletCollision;general;LinearMath;general;/usr/lib/x86_64-linux-gnu/libSimTKsimbody.so;general;/usr/lib/x86_64-linux-gnu/libSimTKmath.so;general;/usr/lib/x86_64-linux-gnu/libSimTKcommon.so;general;/usr/lib/libblas.so;general;/usr/lib/liblapack.so;general;/usr/lib/libblas.so;general;pthread;general;rt;general;dl;general;m;general;/usr/lib/x86_64-linux-gnu/libgazebo.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_client.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_gui.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_sensors.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_rendering.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_physics.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_ode.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_transport.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_msgs.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_util.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_common.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_gimpact.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_opcode.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_opende_ou.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_math.so;general;/usr/lib/x86_64-linux-gnu/libgazebo_ccd.so;general;/usr/lib/x86_64-linux-gnu/libboost_thread.so;general;/usr/lib/x86_64-linux-gnu/libboost_signals.so;general;/usr/lib/x86_64-linux-gnu/libboost_system.so;general;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;general;/usr/lib/x86_64-linux-gnu/libboost_program_options.so;general;/usr/lib/x86_64-linux-gnu/libboost_regex.so;general;/usr/lib/x86_64-linux-gnu/libboost_iostreams.so;general;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;general;/usr/lib/x86_64-linux-gnu/libboost_chrono.so;general;/usr/lib/x86_64-linux-gnu/libboost_atomic.so;general;/usr/lib/x86_64-linux-gnu/libpthread.so;optimized;/usr/lib/x86_64-linux-gnu/libprotobuf.so;debug;/usr/lib/x86_64-linux-gnu/libprotobuf.so;general;-lpthread;general;/usr/lib/x86_64-linux-gnu/libsdformat.so;general;ignition-math3;optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so;general;/usr/lib/x86_64-linux-gnu/libboost_thread.so;general;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;general;/usr/lib/x86_64-linux-gnu/libboost_system.so;general;/usr/lib/x86_64-linux-gnu/libboost_atomic.so;general;/usr/lib/x86_64-linux-gnu/libboost_chrono.so;general;/usr/lib/x86_64-linux-gnu/libpthread.so;optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;general;ignition-math3;general;/usr/lib/x86_64-linux-gnu/libignition-transport3.so;optimized;/usr/lib/x86_64-linux-gnu/libprotobuf.so;debug;/usr/lib/x86_64-linux-gnu/libprotobuf.so;general;-lpthread;general;zmq;general;uuid;general;ignition-msgs0;general;ignition-math3;general;ignition-msgs0;general;ignition-math3;general;FMILibrary::FMILibrary;general;stdc++fs; FMILibrary_INCLUDE_DIR:PATH=/home/pramadoss/iit_ws/robotology_playground/FMILibrary/build FMILibrary_LIBRARY:FILEPATH=/home/pramadoss/iit_ws/robotology_playground/FMILibrary/build/libfmilib_shared.so //Details about finding FMILibrary FIND_PACKAGE_MESSAGE_DETAILS_FMILibrary:INTERNAL=[FMILibrary::FMILibrary][/home/pramadoss/iit_ws/robotology_playground/FMILibrary/build][v()] //ADVANCED property for variable: FMILibrary_INCLUDE_DIR FMILibrary_INCLUDE_DIR-ADVANCED:INTERNAL=1 //ADVANCED property for variable: FMILibrary_LIBRARY FMILibrary_LIBRARY-ADVANCED:INTERNAL=1

prashanthr05 commented 6 years ago

Indeed, I am able to replicate your problem if I append FMILibrary/build instead of the actuall install prefix of the library.

True. The compilation however succeeds by adding FMI_root/install/lib and FMI_root/install/include to CMAKE_PREFIX_PATH.