mp3guy / Logger1

Tool for logging RGB-D data from the Microsoft Kinect and ASUS Xtion Pro Live
BSD 2-Clause "Simplified" License
11 stars 13 forks source link

Fails to build on 15.04: DSO Missing from CLI #1

Open mankoff opened 8 years ago

mankoff commented 8 years ago

Since I can't run ElasticFusion with my XTION Pro (non-Live), I was trying to us Logger1 with a Kinect, but cannot build it.

[100%] Building CXX object CMakeFiles/Logger.dir/OpenNI/openni_depth_image.cpp.o
Linking CXX executable Logger
/usr/bin/ld: CMakeFiles/Logger.dir/OpenNI/openni_driver.cpp.o: undefined reference to symbol 'libusb_get_device_descriptor'
/lib/x86_64-linux-gnu/libusb-1.0.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/Logger.dir/build.make:474: recipe for target 'Logger' failed
make[2]: *** [Logger] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/Logger.dir/all' failed
make[1]: *** [CMakeFiles/Logger.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
mp3guy commented 8 years ago

For this you need to add libusb-1.0 to target_link_libraries in CMakeLists.txt. Also make sure libusb-1.0-dev is installed.

bugnix commented 8 years ago

I had the same issue as mankoff, and your solution resolved the libusb linker errors. But now there seems to be some problem with boost, although boost is installed on my system. The error occurs on a fresh Ubuntu 15.04 with Kintinuous built only.

Linking CXX executable Logger CMakeFiles/Logger.dir/main.cpp.o: In function MainWindow::getNextFilename()': main.cpp:(.text+0x5c5): undefined reference toboost::filesystem::detail::status(boost::filesystem::path const&, boost::system::errorcode)' CMakeFiles/Logger.dir/main.cpp.o: In function MainWindow::MainWindow(Logger_)': main.cpp:(.text+0x2f91): undefined reference toboost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code)' CMakeFiles/Logger.dir/main.cpp.o: In functionboost::thread_exception::thread_exception(int, char const_)': main.cpp:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x24): undefined reference toboost::system::system_category()' CMakeFiles/Logger.dir/main.cpp.o: In function_GLOBAL__sub_I_main': main.cpp:(.text.startup+0x23): undefined reference toboost::system::generic_category()' main.cpp:(.text.startup+0x2f): undefined reference toboost::system::generic_category()' main.cpp:(.text.startup+0x3b): undefined reference toboost::system::system_category()' CMakeFiles/Logger.dir/moc_main.cxx.o: In function_GLOBAL__sub_I__ZN10MainWindow18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv': [...] openni_device_oni.cpp:(.text.startup+0x3b): undefined reference toboost::system::system_category()' CMakeFiles/Logger.dir/OpenNI/openni_device_oni.cpp.o:(.rodata._ZTIN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf0IvN14openni_wrapper9DeviceONIEEENS2_5list1INS2_5valueIPS7_EEEEEEEE[_ZTIN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf0IvN14openni_wrapper9DeviceONIEEENS2_5list1INS2_5valueIPS7_EEEEEEEE]+0x10): undefined reference to`typeinfo for boost::detail::thread_data_base' collect2: error: ld returned 1 exit status CMakeFiles/Logger.dir/build.make:472: recipe for target 'Logger' failed make[2]: _* [Logger] Error 1 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/Logger.dir/all' failed make[1]: * [CMakeFiles/Logger.dir/all] Error 2 Makefile:76: recipe for target 'all' failed make: * [all] Error 2

mp3guy commented 8 years ago

No idea why this is happening...

mankoff commented 8 years ago

I followed the advice about libusb-1.0 but the error did not change at all.

mp3guy commented 8 years ago

That is surprising, considering the error literally states I found those symbols in this library, try linking to it;

/lib/x86_64-linux-gnu/libusb-1.0.so.0: error adding symbols: DSO missing from command line

Have you definitely got libusb-1.0-dev installed?

mankoff commented 8 years ago

Yes I was suprised too. Probably a stupid user error. I'm at a different computer and will report back in more detail later today or tomorrow.

bugnix commented 8 years ago

Ok, after a lot of trial and error I've got both errors fixed now. Here is my changed CMakeLists.txt file, maybe it helps to resolve the issue.

cmake_minimum_required(VERSION 2.6.0)

find_package(ZLIB REQUIRED) find_package(Qt4 REQUIRED) find_package(OpenCV REQUIRED) find_package(Boost COMPONENTS thread REQUIRED) find_package(Boost COMPONENTS filesystem REQUIRED) find_package(Boost COMPONENTS system REQUIRED) find_package(Boost COMPONENTS date_time REQUIRED) find_package(PkgConfig REQUIRED) pkg_search_module(LIBUSB1 REQUIRED libusb-1.0)

include(FindOpenNI.cmake)

include(${QT_USE_FILE})

qt4_wrap_cpp(main_moc_SRCS main.h)

IF (UNIX) set(CMAKE_CXX_FLAGS "-O3 -msse2 -msse3") ENDIF (UNIX)

include_directories(. ../OpenNI)

INCLUDE_DIRECTORIES(${LIBUSB1_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})

set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) set(BOOST_ALL_DYN_LINK ON) # force dynamic linking for all libraries

add_executable(Logger main.cpp ${main_moc_SRCS} Logger.cpp OpenNI/openni_driver.cpp OpenNI/openni_device.cpp OpenNI/openni_exception.cpp OpenNI/openni_device_primesense.cpp OpenNI/openni_device_kinect.cpp OpenNI/openni_device_xtion.cpp OpenNI/openni_device_oni.cpp OpenNI/openni_image_yuv_422.cpp OpenNI/openni_image_bayer_grbg.cpp OpenNI/openni_image_rgb24.cpp OpenNI/openni_ir_image.cpp OpenNI/openni_depth_image.cpp )

target_link_libraries(Logger ${ZLIB_LIBRARY} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${OPENNI_LIBRARY} ${OpenCV_LIBS} ${LIBUSB1_LIBRARIES} ${QT_LIBRARIES})