roadnarrows-robotics / pan_tilt

RoadNarrows Two Degree of Freedom Pan-Tilt Mount ROS Package
MIT License
0 stars 2 forks source link

Compilation Error pan_tilt_control ros package libdynamixel #2

Closed miguelriemoliveira closed 8 years ago

miguelriemoliveira commented 8 years ago

System and Environment Description

Ubuntu 14.04

Expected Behavior

Successfull compilation when

cd ~/catkin_rnr/indigo
catkin_make

Actual Behavior

Compilation error, output

Linking CXX executable /home/mike/catkin_ws/devel/lib/pan_tilt_control/pan_tilt_control
[ 92%] Built target visp_camera_calibration_image_processing
[ 93%] [ 93%] [ 94%] Built target visp_hand2eye_calibration_client
Built target visp_hand2eye_calibration_calibrator
Built target visp_camera_calibration_camera
[ 95%] Built target visp_tracker
[ 96%] Built target trackerNodelet
[ 96%] Built target visp_auto_tracker_cmd_line
[ 97%] Built target auto_tracker
[ 98%] Built target visp_auto_tracker
/usr/local/lib/libDynamixel.so: undefined reference to `SerDevAssertRTS'
/usr/local/lib/libdxl.so: undefined reference to `SerDevWrite'
/usr/local/lib/libDynamixel.so: undefined reference to `SerDevAssertCTS'
/usr/local/lib/libdxl.so: undefined reference to `SerDevRead'
/usr/local/lib/libDynamixel.so: undefined reference to `SerDevSetHwFlowControl'
/usr/local/lib/libDynamixel.so: undefined reference to `SerDevDeassertRTS'
/usr/local/lib/libdxl.so: undefined reference to `SerDevOpen'
/usr/local/lib/libDynamixel.so: undefined reference to `SerDevFIFOOutputDrain'
/usr/local/lib/libDynamixel.so: undefined reference to `SerDevDeassertCTS'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/mike/catkin_ws/devel/lib/pan_tilt_control/pan_tilt_control] Error 1
make[1]: *** [pan_tilt/pan_tilt_control/CMakeFiles/pan_tilt_control.dir/all] Error 2
make: *** [all] Error 2

Steps to Reproduce the Behavior

I just followed the installation instructions in the wiki

https://github.com/roadnarrows-robotics/pan_tilt/wiki/sw_install_host

Any help would be appreciated

miguelriemoliveira commented 8 years ago

I think I found out what was the problem. I occurs when we have these two packages also installed

ros-indigo-serial
ros-indigo-serial-utils

they create a libserial.so in

/opt/ros/indigo/lib

which when compiling the pan_tilt_control package is found before the rnr libserial.so, which is located at

/usr/local/lib/rnr

That way, the linker will use the ros libserial.so for linking which does not contain the functions SerDevAssertRTS, etc and voila, the linking error appears.

I am not sure how to solve the problem though ... do you have any idea?

Thanks,

Miguel

rdknight commented 8 years ago

Hi Miguel,

Try setting the exported variable LD_LIBRARY_PATH to point to /usr/local/lib/rnr. This should work in the interim. I'll need to rename RNR's libserial to another name for future releases.

$ export LD_LIBRARY_PATH=/usr/local/lib/rnr:${LD_LIBRARY_PATH} $ catkin_make

Thanks for the catch.

Robin

On Wed, Jun 8, 2016 at 10:48 AM, Miguel Riem de Oliveira < notifications@github.com> wrote:

I think I found out what was the problem. I occurs when we have these two packages also installed

ros-indigo-serial

ros-indigo-serial-utils

they create a libserial.so in

/opt/ros/indigo/lib

which when compiling the pan_tilt_control package is found before the rnr libserial.so, which is located at

/usr/local/lib/rnr

That way, the linker will use the ros libserial.so for linking which does not contain the functions SerDevAssertRTS, etc and voila, the linking error appears.

I am not sure how to solve the problem though ... do you have any idea?

Thanks,

Miguel

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/roadnarrows-robotics/pan_tilt/issues/2#issuecomment-224653485, or mute the thread https://github.com/notifications/unsubscribe/AESHq7ycQjiSGgcleP86u-4n-vuWwqCWks5qJvJMgaJpZM4Iw6Nd .

Robin D. Knight CXO

RoadNarrows Robotics A Robot Boutique www.roadnarrows.com

miguelriemoliveira commented 8 years ago

Hi Robin,

Thanks for the help.

I have tried it and this solution does not work. I get the same linking error. Even if it would work for the rnr packages, I think I would get a similar linking error for the other packages which actually need the ros serial library I have installed.

I think (not sure) its because it is catkin (and cmake) the ones who define the order in which library paths are given (it does not come directly from the LDPATH, I think) and therefore which is the first libserial to be found (and linked against).

I think renaming is the best think to do ... libserial is just too generic and chances of conflict are high (as we've seen).

If you have any other solution I would be happy to try it out.

Thanks,

Miguel

rdknight commented 8 years ago

Hi Miguel,

I'll rename this library (and others generic named RNR libs also). Even though these names are generic, they are installed in the lib sub-directory rnr. Typical make files use the -L option to point to the correct libs. I did not anticipate catkin and cmake hidden magic. This will have some impact on our repo and potentially upset some of our customers. The renaming needs to be done, but I must to precede cautiously.

In the meanwhile, in /usr/local/lib/cmake/rnr you'll find the cmake config file rnr-pantilt-config.cmake.

Try fiddling with this text file. The relevant cmake macros in the file are _findlibrary(LIBSERIAL...) and the _set(rnr-pantiltLIBRARIES...) . Commenting out the first macro and hard coding the path in the second might work. Perhaps with the right combo we can force catkin/cmake to find the correct library.

-Robin

On Wed, Jun 8, 2016 at 1:08 PM, Miguel Riem de Oliveira < notifications@github.com> wrote:

Hi Robin,

Thanks for the help.

I have tried it and this solution does not work. I get the same linking error. Even if it would work for the rnr packages, I think I would get a similar linking error for the other packages which actually need the ros serial library I have installed.

I think (not sure) its because it is catkin (and cmake) the ones who define the order in which library paths are given (it does not come directly from the LDPATH, I think) and therefore which is the first libserial to be found (and linked against).

I think renaming is the best think to do ... libserial is just too generic and chances of conflict are high (as we've seen).

If you have any other solution I would be happy to try it out.

Thanks,

Miguel

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/roadnarrows-robotics/pan_tilt/issues/2#issuecomment-224695857, or mute the thread https://github.com/notifications/unsubscribe/AESHq0pD_QjJeY1asUKQ6NJWUgWT79NYks5qJxMUgaJpZM4Iw6Nd .

Robin D. Knight CXO

RoadNarrows Robotics A Robot Boutique www.roadnarrows.com

miguelriemoliveira commented 8 years ago

Hi Robin,

I am not a cmake expert but I have tried a bit (I don't have much time available) and found no other solution by tuning cmake.

The libraries I tipically use actually have the two or three letter code included in their name, e.g.,

opencv libraries are named

libopencv_aruco.so libopencv_core.so libopencv_features2d.so libopencv_imgproc.so libopencv_photo.so libopencv_sfm.so libopencv_superres.so libopencv_video.so

and pcl libraries are named

libpcl_2d.so libpcl_features.so.1.8.0 libpcl_io.so.1.8 libpcl_ml.so libpcl_outofcore.so.1.8.0 libpcl_registration.so.1.8 libpcl_segmentation.so libpcl_surface.so.1.8.0 libpcl_2d.so.1.8 libpcl_filters.so libpcl_io.so.1.8.0 libpcl_ml.so.1.8 libpcl_people.so libpcl_registration.so.1.8.0 libpcl_segmentation.so.1.8 libpcl_visualization.so

But again, I am no cmake expert so perhaps a solution could also be found using cmake.

That said, I do understand that you are not keen on changing the names of the libraries. Please let me now when / if you will change the names.

Best regards,

Miguel

daniel-packard commented 8 years ago

Hey Miguel -- just a thought that you might check what the rnr-pantilt_LIBRARIES variable is set to in CMakeLists.txt.

There is already a log message in the right spot, although it's currently commented out: https://github.com/roadnarrows-robotics/pan_tilt/blob/master/pan_tilt_control/CMakeLists.txt#L19-L24

Using the current value, you might be able to redefine rnr-pantilt_LIBRARIES with fully qualified paths to the RNR libs??

miguelriemoliveira commented 8 years ago

Hi Daniel,

I tried it but it seems they are alreay defined with fully qualified paths.

Here is the output for the cmake (after uncommenting message(STATUS, "${rnr-pantilt_LIBRARIES}"))

STATUS,/usr/local/lib/libDynamixel.so;/usr/local/lib/libdxl.so;/usr/local/lib/rnr/librnr_appkit.so;/usr/local/lib/rnr/libhid.so;/usr/local/lib/libbotsense.so;/usr/local/lib/libnetmsgs.so;/opt/ros/indigo/lib/libserial.so;/usr/local/lib/rnr/libgpio.so;/usr/local/lib/rnr/librnr.so

I think the problem is the "magic" that occurs at lines 96-100

target_link_libraries(pan_tilt_control 
  pan_tilt
  ${rnr-pantilt_LIBRARIES}
  ${catkin_LIBRARIES}
)

So the absolute paths are there, but I think the problem is that the

/opt/ros/indigo/lib/libserial.so

appears before your libserial.so. See the full link instruction bellow(output of catkin_make VERBOSE=1)

Linking CXX executable /home/mike/catkin_ws/devel/lib/pan_tilt_control/pan_tilt_control cd /home/mike/catkin_ws/build/pan_tilt/pan_tilt_control && /usr/bin/cmake -E cmake_link_script CMakeFiles/pan_tilt_control.dir/link.txt --verbose=1 /usr/bin/c++ CMakeFiles/pan_tilt_control.dir/src/pan_tilt_as_calib.cpp.o CMakeFiles/pan_tilt_control.dir/src/pan_tilt_as_follow_traj.cpp.o CMakeFiles/pan_tilt_control.dir/src/pan_tilt_control.cpp.o CMakeFiles/pan_tilt_control.dir/src/pan_tilt_control_main.cpp.o -o /home/mike/catkin_ws/devel/lib/pan_tilt_control/pan_tilt_control -L/usr/local/lib -L/usr/local/lib/rnr -rdynamic /home/mike/catkin_ws/devel/lib/libpan_tilt.so -lDynamixel -ldxl -lrnr_appkit -lhid -lbotsense -lnetmsgs /opt/ros/indigo/lib/libserial.so -lgpio -lrnr /opt/ros/indigo/lib/libactionlib.so /opt/ros/indigo/lib/libroscpp.so -lboost_signals -lboost_filesystem /opt/ros/indigo/lib/librosconsole.so /opt/ros/indigo/lib/librosconsole_log4cxx.so /opt/ros/indigo/lib/librosconsole_backend_interface.so -llog4cxx -lboost_regex /opt/ros/indigo/lib/libroscpp_serialization.so /opt/ros/indigo/lib/librostime.so -lboost_date_time /opt/ros/indigo/lib/libxmlrpcpp.so /opt/ros/indigo/lib/libcpp_common.so -lboost_system -lboost_thread -lpthread -lconsole_bridge -Wl,-rpath,/home/mike/catkin_ws/devel/lib

daniel-packard commented 8 years ago

Hey Miguel -- the rnr-pantilt_LIBRARIES variable is incorrect.. see that it contains /opt/ros/indigo/lib/libserial.so

I'd try updating lines 96-100 like this:

target_link_libraries(pan_tilt_control 
  pan_tilt
  /usr/local/lib/rnr/librnr.so
  ${rnr-pantilt_LIBRARIES}
  ${catkin_LIBRARIES}
)

This would put the correct lib "in front of" the ROS libserial.so..

If you don't have any luck with that, you might look into the .cmake config file that sets the rnr variables. Should be located somewhere near /usr/local/lib/cmake/rnr.

Good luck!

miguelriemoliveira commented 8 years ago

Hi Daniel,

I tried it and it did not work. But it guided in the right direction.

Since the problem was with the libserial and since the pan_tilt library could itself contain the ros libserial, I tried this and it works

target_link_libraries(pan_tilt_control /usr/local/lib/rnr/libserial.so pan_tilt ${rnr-pantilt_LIBRARIES} ${catkin_LIBRARIES} )

Thanks for your support. I will close the issue now.

Miguel

rdknight commented 8 years ago

Thanks Daniel for you help. I'm glad a work-around has been found Miguel. I'm am in the process of moving core RNR packages to their own "namespace" librnr_x. It should be done and tested by end of this week. Once that is done, your fix Miguel will have to be undone. But with unique names, hopefully problems like this won't arise again.

Robin

rdknight commented 8 years ago

All,

The base RNR SDK library components have been renamed to place them into a more unique namespace. The base library are now named librnr_x.a and librnr_x.so . Please sudo apt-get update and sudo apt-get upgrade to grab the latest.

Thanks,

Robin

miguelriemoliveira commented 8 years ago

Hi Robin,

I tested it and it works (1)(2).

Thanks for your (great) assistance.

Best regards,

Miguel

(1) I had to remove my devel and build folders to completely initialize the catkin workspace. (2) I had to git pull the newest version of the repository.