Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status #29

Closed
japzi opened this issue Oct 30, 2014 · 8 comments

Comments

@japzi
Copy link

japzi commented Oct 30, 2014

During compilation lsd_slam(ROS indigo + ubuntu 14.04), I get following error.

Linking CXX executable ../bin/live_slam
/usr/bin/ld: CMakeFiles/live_slam.dir/src/main_live_odometry.cpp.o: undefined reference to symbol 'XInitThreads'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[3]: *** [../bin/live_slam] Error 1
make[3]: Leaving directory /home/user/ros_workspace/lsd_slam/lsd_slam_core/build' make[2]: *** [CMakeFiles/live_slam.dir/all] Error 2 make[2]: Leaving directory/home/user/ros_workspace/lsd_slam/lsd_slam_core/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/user/ros_workspace/lsd_slam/lsd_slam_core/build'

@MartinMeliss
Copy link

I have the same problem...

@gpdaniels
Copy link

https://www.google.co.uk/search?q=undefined+reference+to+symbol+%27XInitThreads%27

Leads to:
http://stackoverflow.com/questions/23585435/cannot-call-xinitthreads

"undefined reference to symbol" is a linker error, not a compiler error. If you get this message, the compiler has already finished compiled the file into an object file, but is unable to find the shared library which contains the function to link the object file into an executable.

Using gcc, it generally means you have to add some -l flags, like so:

gcc prog.c -lX11

You can try adding it in the CMakesList.txt that references live_slam:
https://github.com/tum-vision/lsd_slam/blob/master/lsd_slam_core/CMakeLists.txt

@MartinMeliss
Copy link

Please explain in detail, where add libx11, but rather correct, please build rules because lsd-slam is not going on any configuration (ROS + Ubuntu)

@MartinMeliss
Copy link

on Ubuntu 14.04 helped reinstall libx11*

@JakobEngel
Copy link
Member

Hi,
could you try to compile commit
116c6c9
(just use 'git checkout 116c6c9')
and see if that works?
Jakob

@JakobEngel
Copy link
Member

another solution should be to add X11 to the library list:

target_link_libraries(lsdslam ${FABMAP_LIB} g2o_core g2o_stuff csparse cxsparse g2o_solver_csparse g2o_csparse_extension g2o_types_sim3 g2o_types_sba X11)

in line 89 of lsd_slam_core/CMakeLists.txt.
possibly you also have to install the respective ubuntu package, but I suppose it's already depended on somewhere. Just in case, run
sudo apt-get install libx11-dev

Please let me know if / what helped :)

@japzi
Copy link
Author

japzi commented Oct 30, 2014

Thanks Jakob. Your second solution worked.
i.e. Adding X11 to the line 89 of lsd_slam_core/CMakeLists.txt.

Thanks others for their replies as well.

Sorry for the late reply. I tried to uninstall X11 and reinstall, in the process I broke my Ubuntu installation :-). Hence reinstalled Ubuntu and everything else, got the above error again. Compilation was success after applying the fix by Jakob!

We could close the issue now!

@japzi japzi closed this as completed Oct 30, 2014
@japzi japzi reopened this Oct 30, 2014
romangrothausmann added a commit to romangrothausmann/VTK-CLIs that referenced this issue Oct 22, 2019
to avoid: undefined reference to symbol 'XMapWindow' libX11.so error adding symbols: DSO missing from command line

https://stackoverflow.com/questions/46028923/dso-missing-from-command-line-in-libx11
tum-vision/lsd_slam#29
@NEMS1996
Copy link

another solution should be to add X11 to the library list:

target_link_libraries(lsdslam ${FABMAP_LIB} g2o_core g2o_stuff csparse cxsparse g2o_solver_csparse g2o_csparse_extension g2o_types_sim3 g2o_types_sba X11)

in line 89 of lsd_slam_core/CMakeLists.txt.
possibly you also have to install the respective ubuntu package, but I suppose it's already depended on somewhere. Just in case, run
sudo apt-get install libx11-dev

Please let me know if / what helped :)

Hi,

I have added X11 but still I am facing the same error.
I also want to know is there any difference between the following linking methods

  1. -lX11
  2. -L/usr/lib/X11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants