swri-robotics / gps_umd

BSD 3-Clause "New" or "Revised" License
84 stars 94 forks source link

fail catkin_make compilation #37

Closed rafa-chao closed 2 months ago

rafa-chao commented 3 years ago

Hi, I am using: ubuntu 18.04 ros melodic 1.14.10

I download to my catkin_ws folder your github, i catkin_make, but compilation doesnt work. It fails when looking for gps_common/GPSFix.h. I attach the fail:

catkin_ws/src/gps_umd/gpsd_client/src/client.cpp:2:10: fatal error: gps_common/GPSFix.h: No such file or directory

include <gps_common/GPSFix.h>

      ^~~~~~~~~~~~~~~~~~~~~

compilation terminated. gps_umd/gpsd_client/CMakeFiles/gpsd_client.dir/build.make:62: recipe for target 'gps_umd/gpsd_client/CMakeFiles/gpsd_client.dir/src/client.cpp.o' failed make[2]: [gps_umd/gpsd_client/CMakeFiles/gpsd_client.dir/src/client.cpp.o] Error 1 CMakeFiles/Makefile2:2783: recipe for target 'gps_umd/gpsd_client/CMakeFiles/gpsd_client.dir/all' failed make[1]: [gps_umd/gpsd_client/CMakeFiles/gpsd_client.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 1%] Built target _ublox_msgs_generate_messages_check_deps_RxmSVSI Makefile:140: recipe for target 'all' failed make: [all] Error 2 Invoking "make -j2 -l2" failed


Any body knows where the problem is?

Thanks !!!!

pjreed commented 3 years ago

The GPSFix.h header is generated from the GPSFix message, defined in the gps_common package. Do you also have that in your workspace? Does it try to build that before gps_umd? Could you post your entire build log?

By the way, is there a reason you need to build it from source? If you're using Ubuntu 18.04, you should be able to install pre-built binary packages instead with sudo apt-get install ros-melodic-gps*.

rafa-chao commented 3 years ago

Hi pjreed, Yo are right, it was my fault. I clean catkin_ws, then I delete rubbish from build folder. Then I download a fresh git clone. Then I catkin_make, and finally run "rosrun gpsd_client gpsd_client" and it works.... It was my fault.

I left the software working during the night, and everything goes perfect. I just have a doubt, "status=0" doesn't change. My gps is connected to a ntrip caster service, and status should be 2. Status is working?

Thanks for your time,

ace-at-git commented 3 years ago

Well, I used the repository source in a fresh Kinetic workspace. My gpsd is compiled via source (3.22.1~dev). Since I dislike to take care of compile sequence manually I just tried catkin_make and run into the same problem...

The following patch makes the build more robust for me.

diff --git a/gpsd_client/CMakeLists.txt b/gpsd_client/CMakeLists.txt
index a6d3778..dff9cc8 100644
--- a/gpsd_client/CMakeLists.txt
+++ b/gpsd_client/CMakeLists.txt
@@ -6,6 +6,7 @@ project(gpsd_client CXX)
 ############

 find_package(catkin REQUIRED COMPONENTS
+  message_generation
   gps_common
   roscpp
   sensor_msgs
@@ -26,6 +27,7 @@ catkin_package()

 include_directories(${catkin_INCLUDE_DIRS} ${libgps_INCLUDE_DIRS})
 add_executable(${PROJECT_NAME} src/client.cpp)
+add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
 target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${libgps_LIBRARIES})

 #############

P.S.: The GPSD_API_MAJOR_VERSION version was changed to 11 with my used gpsd version and is incompatible to the gps_umd due to changes of gps status in gps.h - but that is another story...

antoniosap commented 3 years ago

the same happens here. a raspberry pi 3+ buster distribution with ros noetic desktop compiled from source. you have to delete build and devel otherwise it won't generate the GPSFix.h

danthony06 commented 3 years ago

I think I found the issue. There was a missing dependency on catkin_EXPORT_TARGETS that could cause that node to build before the messages were built. I have cleaned up the CMakeLists.txt and package.xml files in the repo, and have issued a PR here: https://github.com/swri-robotics/gps_umd/pull/38.