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.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM