Ask Your Question

Undefind reference at the time of linking

asked 2014-01-20 23:24:52 -0500

Jamil gravatar image

updated 2014-01-21 01:08:25 -0500

gvdhoorn gravatar image

Hi I am using Ubutu 12.4 and working on a catkin project. I had a package which was running successfully then I had to remove the dependency of this package from another package named sba. I did this by making some changes in CMakeList.txt and package.xml then I also copied that part of code from sba which was being used by my main package but unfortunately at the time of linking i am getting some undefined reference to "cs_di_spfree", cs_di_cholsol' andcs_di_spalloc' which do not exist in any of the file in my project. If any one can give me hint about this error that will be great... thanks..

the terminal message is copied here....

[  0%] [  0%] [  0%] Built target std_msgs_generate_messages_lisp
Built target std_msgs_generate_messages_cpp
Built target std_msgs_generate_messages_py
[  0%] Built target geometry_msgs_generate_messages_cpp
[  6%] Built target sba_vis
[  8%] Built target OpenKarto
[  8%] Built target geometry_msgs_generate_messages_lisp
[ 11%] Built target geometry_msgs_generate_messages_py
[ 24%] [ 22%] Built target karto_srv_generate_messages_lisp
Built target karto_srv_generate_messages_py
[ 27%] Built target sba
[ 30%] Built target karto_srv_generate_messages_cpp
[ 37%] Built target karto_scan_matcher
[ 40%] Built target sba_generate_messages_lisp
[ 48%] Built target sba_generate_messages_cpp
Linking CXX executable /home/mig-mj/git/catkin_ws/devel/lib/karto/slam_karto
[ 59%] Built target sba_generate_messages_py
[ 61%] Built target sba_node_test
[ 62%] Built target sba_node
[ 64%] Built target single_plane_vis
[ 67%] Built target vis-2d
[ 69%] Built target vis-bundler
[ 72%] [ 72%] Built target vis-mono
Built target karto_srv_generate_messages
Linking CXX executable test_scan_matcher
[ 75%] [ 75%] Built target point_plane2_vis
Built target cholmod_timing
[ 77%] Built target point_plane_vis
[ 79%] Built target run_sba_bundler_file
[ 80%] Built target run_sba_graph_file
[ 83%] Built target run_sba_sphere
[ 87%] Built target run_sba_spiral
[ 90%] Built target run_spa
[ 93%] Built target run_spa2d
[ 95%] Built target run_spa_graph_file
/home/mig-mj/git/catkin_ws/devel/lib/ undefined reference to `cs_di_spfree'
/home/mig-mj/git/catkin_ws/devel/lib/ undefined reference to `cs_di_cholsol'
/home/mig-mj/git/catkin_ws/devel/lib/ undefined reference to `cs_di_spalloc'
collect2: ld returned 1 exit status
make[2]: *** [cob_karto/karto_scan_matcher/test_scan_matcher] Error 1
make[1]: *** [cob_karto/karto_scan_matcher/CMakeFiles/test_scan_matcher.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 95%] Built target sba_generate_messages
/home/mig-mj/git/catkin_ws/devel/lib/ undefined reference to `cs_di_spfree'
/home/mig-mj/git/catkin_ws/devel/lib/ undefined reference to `cs_di_cholsol'
/home/mig-mj/git/catkin_ws/devel/lib/ undefined reference to `cs_di_spalloc'
collect2: ld returned 1 exit status
make[2]: *** [/home/mig-mj/git/catkin_ws/devel/lib/karto/slam_karto] Error 1
make[1]: *** [cob_karto/karto/CMakeFiles/slam_karto.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-01-21 01:07:19 -0500

Kamiccolo gravatar image

Apparently, You're not linking libOpenKarto to CXSparse library.

It would be really helpful if You'd indent CMake output log properly and provide CMakeList.txt content.

I guess, You've just forgotten to add target_link_libraries(run_spa_graph cxsparse) somewhere in Your CMakeList.txt :)

edit flag offensive delete link more


Dear Kamiccolo, Thank you very much for your answer. I checked it again and did some changes according to your suggestion in CMakeList.txt and now it is working all right. Thanks :) (y)

Jamil gravatar image Jamil  ( 2014-01-21 03:26:52 -0500 )edit

If this answer resolves your question, please click the check mark to the left indicating that it is accepted.

joq gravatar image joq  ( 2014-01-21 03:47:41 -0500 )edit

@Jamil, also exact solution would really help for those people who might get stuck with similar problem :) Sharing is good :)

Kamiccolo gravatar image Kamiccolo  ( 2014-01-21 04:50:14 -0500 )edit

Yes I checked the mark on left.... Thanks :)

Jamil gravatar image Jamil  ( 2014-01-21 05:16:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-01-20 23:24:52 -0500

Seen: 395 times

Last updated: Jan 21 '14