0
$\begingroup$

Rosanswers logo

Hi to all,

I'm kind of new to ROS and I'm having a problem while compiling the catkin workspace on my laptop. I'm using ROS Indigo on Ubuntu 14.04, and I'm trying to compile the irobotcreate2ros package (https://github.com/MirkoFerrati/irobotcreate2ros).

It requires the packages serial and joy to be installed. The problem is that when I compile the workspace, I received the following error:

CMakeFiles/basic_commands.dir/src/irobotcreate2/OpenInterface.cpp.o: In function irobot::OpenInterface::getSensorPackets(int):

OpenInterface.cpp:(.text+0xf3c): undefined reference to serial::Serial::waitReadable()

CMakeFiles/basic_commands.dir/src/irobotcreate2/OpenInterface.cpp.o: In function irobot::OpenInterface::streamSensorPackets():

OpenInterface.cpp:(.text+0x12a5): undefined reference to serial::Serial::waitReadable()

collect2: error: ld returned 1 exit status

make[2]: [/home/myhome/Projects/ros/indigo/catkin_ws/devel/lib/irobotcreate2/basic_commands] Error 1

make[1]: [irobotcreate2ros/CMakeFiles/basic_commands.dir/all] Error 2

make[1]: Waiting for unfinished jobs....

CMakeFiles/irobotcreate2_lightweight.dir/src/irobotcreate2/OpenInterface.cpp.o: In function irobot::OpenInterface::getSensorPackets(int):

OpenInterface.cpp:(.text+0xf3c): undefined reference to serial::Serial::waitReadable()

CMakeFiles/irobotcreate2_lightweight.dir/src/irobotcreate2/OpenInterface.cpp.o: In function irobot::OpenInterface::streamSensorPackets():

OpenInterface.cpp:(.text+0x12a5): undefined reference to serial::Serial::waitReadable()

collect2: error: ld returned 1 exit status

make[2]: [/home/myhome/Projects/ros/indigo/catkin_ws/devel/lib/irobotcreate2/irobotcreate2_lightweight] Error 1

make[1]: [irobotcreate2ros/CMakeFiles/irobotcreate2_lightweight.dir/all] Error 2

CMakeFiles/irobotcreate2.dir/src/irobotcreate2/OpenInterface.cpp.o: In function irobot::OpenInterface::getSensorPackets(int):

OpenInterface.cpp:(.text+0xf3c): undefined reference to serial::Serial::waitReadable()

CMakeFiles/irobotcreate2.dir/src/irobotcreate2/OpenInterface.cpp.o: In function irobot::OpenInterface::streamSensorPackets():

OpenInterface.cpp:(.text+0x12a5): undefined reference to serial::Serial::waitReadable()

collect2: error: ld returned 1 exit status

make[2]: [/home/myhome/Projects/ros/indigo/catkin_ws/devel/lib/irobotcreate2/irobotcreate2] Error 1

make[1]: [irobotcreate2ros/CMakeFiles/irobotcreate2.dir/all] Error 2

make: [all] Error 2

Invoking "make" failed

This makes me think that probably the compiler is not able to find the serial package. Now:

  1. The problem with serial is only related to the waitReadable() function, as if I comment it from the code, the rest of serial references do not rise any compilation error, and the process ends without problem (I've the right configuration of CMake. I know also because I'm using the same CMakeFile I used on other machines, that is the one provided within the package).
  2. I compiled this package (irobotcreate2ros) on other machines without problem, so maybe there's a wrong version of serial installed on my laptop. I went digging around on the internet, and I found that previous version of serial (http://rosindex.github.io/p/serial/), e.g. until v1.1.7, didn't have any waitReadable() method. I then checked which version was installed, and it says 1.2.1.
  3. To be completely sure, I also went through the code of serial.h in /opt/ros/indigo/include/serial/ to see if there was the waitReadable() method, and it's there (although there's just the function signature, of course).
  4. Lastly, I thought it might depend on the libserial library, that I have installed (v0.6.0~rc1-0ubuntu4), but it doesn't seem to be related.

Now, I really don't know why the compiler is not able to solve that reference. I tried unistalling and reinstalling serial, but nothing changed. Any suggestion?

--- edit ---

The CMakeLists.txt file I'm using is exactly the same reported in this git repository https://github.com/MirkoFerrati/irobotcreate2ros/blob/master/CMakeLists.txt

Thanks


Originally posted by McKracken82 on ROS Answers with karma: 73 on 2016-03-18

Post score: 0


Original comments

Comment by joq on 2016-03-18:
Would you edit your question adding the relevant parts of your CMakeLists.txt?

Comment by William on 2016-03-18:
I usually see this kind of problem when you have an older version of the library hanging around on your system somewhere but you've compiled your code against the newer headers. For example: https://github.com/wjwwood/serial/issues/126

Comment by McKracken82 on 2016-03-21:
I've added the CMakeList file. William, I think that's the problem. I realized I've different version of libserial.so around the system, but I'm not getting where catkin is getting the serial package when compiling, nor the libserial.so to link with. I've moved them around, but nothing changed.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I found the problem. There was a version of serial inside one of the package in my workspace (it's a shared workspace), so that the proper version of serial was overridden by this one. I created a new workspace, and the irobotcreate2ros package compiled perfectly.


Originally posted by McKracken82 with karma: 73 on 2016-03-22

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.