ROS编译、运行出错汇总(持更)

1 .[FATAL] [1501048201.951595472]: You must call ros::init() before creating the first NodeHandle

2terminate called after throwing an instance of 'ros::InvalidNameException'

    what(): Character [-] at element [2] is not valid in Graph Resource Name [re-planning]. Valid characters are a-z, A-Z, 0-9, / and _.

3. fatal error: pathwithflag_msgs/PathWithFlag.h: 没有那个文件或目录
   #include <pathwithflag_msgs/PathWithFlag.h>

 4. symbol lookup error: ../../lib/libhogweed.so.2: undefined symbol: __gmpn_cnd_add_n

 


 

1.[FATAL] [1501048201.951595472]: You must call ros::init() before creating the first NodeHandle

  原因:可能有些全局变量的声明中用到了NodeHandle,例如,如果在ros::init()之前执行:

1 tf2_ros::Buffer tfBuffer;
2 tf2_ros::TransformListener tfListener(tfBuffer);

  就会提示上面的错误,因为在创建tf监听器时会用到NodeHandle,这可以在tf2_ros::TransformListener的定义文件中看到:

TransformListener(tf2::BufferCore& buffer, const ros::NodeHandle& nh, bool spin_thread = true);

2.terminate called after throwing an instance of 'ros::InvalidNameException'

what(): Character [-] at element [2] is not valid in Graph Resource Name [re-planning]. Valid characters are a-z, A-Z, 0-9, / and _.

原因,.cpp文件命名有问题,将re-planning改成re_planning就好了,我也不晓得为啥。

3.fatal error: pathwithflag_msgs/PathWithFlag.h: 没有那个文件或目录
   #include <pathwithflag_msgs/PathWithFlag.h>

  原因:当自定义msg文件之后,然后又在其他文件中使用了该自定义msg类型。因为catkin_make在编译的时候并不会指定pkg的编译顺序,

        所以在使用该msg的文件编译的时候新建的msg类型还没有编译,导致找不到头文件。

  解决:先编译包含新建msg的pkg,再编译其他pkg:

$ catkin_make -DCATKIN_WHITELIST_PACKAGES= "包名"
$ catkin_make -DCATKIN_WHITELIST_PACKAGES= "" //重新编译所有pkg

 4. symbol lookup error: ../../lib/libhogweed.so.2: undefined symbol: __gmpn_cnd_add_n

  Debugging this issue is quite simple. We know that the apt software can’t find the function __gmpn_cnd_add_n in the library libhogweed.so.2. This kind of errors almost always means that the library where the error occurs (libhogweed.so.2) expects a diffent version of a library it depends on (libgmp). Using ldd we can check which version is actually used:

$ ldd /usr/lib/x86_64-linux-gnu/libhogweed.so.2
[...]
libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f5ca1b59000)
[...]

We can clearly see that libgmp.so.10 from /usr/local/lib is used. This indicates that at some point someone installed a custom version of libgmp on the system that is different to the version installed by the package manager.

Usually we can simply remove /usr/local/lib/libgmp.so.10 which usually solves the problem because libhogweed starts to use the correct version as installed by the package manager. Beware, however, that other software using libgmp might stop to work because the library version changed. If removing the local library did not work, try re-checking using the method listed above.

 

posted on 2017-07-26 16:12  zhch_pan  阅读(10266)  评论(0编辑  收藏  举报

导航