Robotics StackExchange | Archived questions

External Library Link Error

I'm trying to use external library file "libdssprs232drive_module.so".

I met following error message.

Linking CXX executable ../dssp

CMakeFiles/dssp.dir/src/dssp.o: In function `main':

/home/hass/my_robot/dssp/src/dssp.cpp:9: undefined reference to `dssp_rs232_drv_module_create(char const*, int)'

collect2: ld returned 1 exit status

------------------------------------------------------------------------------
My setup files are followings

CMakeLists.txt

cmake_minimum_required(VERSION 2.4.6)

include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

rosbuild_init()

rosbuild_add_executable(dssp src/dssp.cpp)

target_link_libraries(dssp dssp_rs232_drive_module)

manifest.xml

<package>

...

<export>

  <cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -Wl,-rpath,${prefix}/lib -ldssp_rs232_drive_module"/>

</export>

</package>

How can I solve this problem?

PS. I tried to make execution file of microstrain3dmgx2imu Package, which is the officially published package in ROS DIAMONDBACK. sudo make clean sudo make But I met the same error massage. Why does the officially published package have the same link error?

Asked by Dongjun on 2011-08-11 18:25:18 UTC

Comments

you can try running "nm libdssp_rs232_drive_module.so |grep dssp_rs232_drv_module_create" to see if that symbol is available in your library

Asked by Markus Achtelik on 2011-09-02 12:05:33 UTC

BTW: You don't need the export in the manifest. That is for other packages using libraries that you build.

Asked by dornhege on 2011-08-12 02:06:17 UTC

It seems that the library doesn't provide the call, which shouldn't be. What system are you using? To verify its linked, you can VERBOSE=1 make, to show compiler lines.

Asked by dornhege on 2011-08-12 02:04:43 UTC

Answers

change the following line

from target_link_libraries(dssp dssp_rs232_drive_module)

to target_link_libraries(dssp /pathto/libdssp_rs232_drive_module.so)

where pathto is the path to ur libdssp_rs232_drive_module.so file

Asked by Zack on 2011-08-13 05:21:31 UTC

Comments

Can you post your edited CMakeLists.txt? And perhaps you might want to consider posing your comments as comments

Asked by Zack on 2011-08-22 15:27:11 UTC

The answer doesn't solve the problem. And, the error message is same to the previous one.

Asked by Dongjun on 2011-08-21 16:35:12 UTC

Comments