AutoRally / autorally

Software for the AutoRally platform
http://autorally.github.io
727 stars 228 forks source link

Compilation dependency issues #84

Open mtfurlan opened 4 years ago

mtfurlan commented 4 years ago

I had some issues getting autorally to build, here is how I got around those issues.

I'm runniung ubuntu 16.04 and using ros kinetic as the README instructs.

apt dependencies

Dependencies outside of apt:

rosdep dependency issues

Pointgrey got bought by flir and some links broke, so a few dependencies stopped being able to be built: https://github.com/ros-drivers/pointgrey_camera_driver/issues/187 I got around that by installing old snapshot builds for ros-kinetic-flir-camera-driver, ros-kinetic-pointgrey-camera-driver, and ros-kinetic-spinnaker-camera-driver.

GTSAM

While compiling GTSAM I had to add -DGTSAM_USE_SYSTEM_EIGEN=ON to the cmake command as GTSAM packages it's own version of the Eigen lib.

Library issues

autorally_core/src/StateEstimator/CMakeLists.txt asks for /usr/local/lib/libgtsam.so, while gtsam provided /usr/local/lib/libgtsam.so.4.0.2 and /usr/local/lib/libgtsam.so.4 I changed the CMakeLists.txt to ask for libgtsam.so and ran sudo ln -s /usr/local/lib/libgtsam.so.4.0.2 /usr/local/lib/libgtsam.so

The StateEstimator CMakeLists.txt also asks for /usr/local/lib/libGeographic.so, and libgeographic-dev put it at /usr/lib/x86_64-linux-gnu/libGeographic.so, so I changed it to ask for libGeographic.so Diff:

diff --git a/autorally_core/src/StateEstimator/CMakeLists.txt b/autorally_core/src/StateEstimator/CMakeLists.txt
index 40b35ae..4249327 100644
--- a/autorally_core/src/StateEstimator/CMakeLists.txt
+++ b/autorally_core/src/StateEstimator/CMakeLists.txt
@@ -9,7 +9,7 @@ if(GTSAM_FOUND)
   include_directories(include ${catkin_INCLUDE_DIRS} "/usr/local/include")

   add_executable(StateEstimator StateEstimator.cpp)
-  target_link_libraries(StateEstimator ${catkin_LIBRARIES} ${ROS_LIBRARIES} /usr/local/lib/libgtsam.so /usr/local/lib/libGeographic.so ${TBB_LIBRARIES} ar_diagnostics)
+  target_link_libraries(StateEstimator ${catkin_LIBRARIES} ${ROS_LIBRARIES} libgtsam.so libGeographic.so ${TBB_LIBRARIES} ar_diagnostics)
   add_dependencies(StateEstimator autorally_msgs_gencpp)

   install(TARGETS StateEstimator

catkin workspaces

This was just an issue with me not knowing how catkin workspaces work, but I think at least some parts of the following would make the Clone or Fork Repositories section of the README more clear:

mkdir -p $HOME/catkin_ws/src
cd $HOME/catkin_ws/src
catkin_init_workspace
cd $HOME/catkin_ws
catkin_make
cd $HOME/catkin_ws/src
git clone https://github.com/AutoRally/imu_3dm_gx4.git
git clone https://github.com/AutoRally/autorally.git

At this point it builds, but I can't test much as gazbebo is has libGL errors and then segfaults.