Error while trying to compile USB example
eeroniemi opened this issue · comments
I got error while trying to compile Guidance SDK USB example for Linux.
I followed this guide: https://developer.dji.com/guidance-sdk/documentation/quick-start/run-examples.html
System information:
> uname -srvmpio
Linux 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Steps to reproduce:
> git clone https://github.com/dji-sdk/Guidance-SDK.git
Cloning into 'Guidance-SDK'...
remote: Counting objects: 1228, done.
remote: Total 1228 (delta 0), reused 0 (delta 0), pack-reused 1228
Receiving objects: 100% (1228/1228), 11.78 MiB | 1.47 MiB/s, done.
Resolving deltas: 100% (537/537), done.
Checking connectivity... done.
> cd Guidance-SDK/examples/usb_example/DJI_guidance_example
> mkdir build
> cd build
> cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /opt/ros/kinetic (found version "3.2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eero/temp/test/Guidance-SDK/examples/usb_example/DJI_guidance_example/build
> make
Scanning dependencies of target dji_guidance_usb
[ 33%] Building CXX object CMakeFiles/dji_guidance_usb.dir/main.cpp.o
[ 66%] Building CXX object CMakeFiles/dji_guidance_usb.dir/DJI_utility.cpp.o
[100%] Linking CXX executable dji_guidance_usb
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_device_descriptor'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_init'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_detach_kernel_driver'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_open'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_device_list'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_exit'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_device'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_active_config_descriptor'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_bulk_transfer'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_free_device_list'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_claim_interface'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_free_config_descriptor'
collect2: error: ld returned 1 exit status
CMakeFiles/dji_guidance_usb.dir/build.make:163: recipe for target 'dji_guidance_usb' failed
make[2]: *** [dji_guidance_usb] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dji_guidance_usb.dir/all' failed
make[1]: *** [CMakeFiles/dji_guidance_usb.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I meet the same problem with you now.Did you solve it?
@xtxper didn't solve it, still not working.
I find two methods to deal with this error.
i> i have insert the "usb-1.0" in three target_link_libraries, modify the CMakeList.txt like this
`cmake_minimum_required(VERSION 2.8)
project( dji_guidance_usb )
CMAKE_POLICY( SET CMP0015 NEW )
find_package( OpenCV )
if(OpenCV_FOUND)
add_definitions(-DHAVE_OPENCV)
endif()
add_executable( dji_guidance_usb main.cpp DJI_utility.cpp )
include_directories($(SOURCE_DIR)/../../../include)
if(WIN32)
find_library(Guidance_Lib DJI_guidance.lib HINTS $(SOURCE_DIR)/../../../../lib/2013/x86)
else()
find_library(Guidance_Lib DJI_guidance HINTS $(SOURCE_DIR)/../../../../so/x64)
target_link_libraries( dji_guidance_usb pthread usb-1.0)
endif()
#dji_guidance_usb
if(OpenCV_FOUND)
target_link_libraries(dji_guidance_usb ${OpenCV_LIBS} ${Guidance_Lib} usb-1.0)
else()
target_link_libraries( dji_guidance_usb ${Guidance_Lib} usb-1.0)
endif()`
ii> use the Makefile to build this project which needs move "libDJI_guidance.so" to this directory.
good lucky!!
It is actually easier to run the Guidance SDK on Ubuntu than it is in Windows (MS Visual Studio) because setting up the shared libraries and environment variables is just movement of necessary files (e.g .so) into the specified folders (e.g /usr/local/bin). Plus the use of the Makefile really simplifies the entire process of pointing to dependencies. If you guys are still facing the problem, please let me know so that I can prepare a lengthy explanation of what I did. I have so far managed to run sample code that uses the Guidance SDK on several machines...x64, x86 and now running on the DJI Manifold TK1 (ARM) processor. I don't know if I will see the responses to this but you can also contact me through jasperhatilima@gmail.com
All the best!
sudo apt-get install libusb-1.0-dev
add "usb-1.0" to target_link_libraries in CMakeLists.txt files
target_link_libraries( dji_guidance_usb ${OpenCV_LIBS} ${Guidance_Lib} usb-1.0)
It is actually easier to run the Guidance SDK on Ubuntu than it is in Windows (MS Visual Studio) because setting up the shared libraries and environment variables is just movement of necessary files (e.g .so) into the specified folders (e.g /usr/local/bin). Plus the use of the Makefile really simplifies the entire process of pointing to dependencies. If you guys are still facing the problem, please let me know so that I can prepare a lengthy explanation of what I did. I have so far managed to run sample code that uses the Guidance SDK on several machines...x64, x86 and now running on the DJI Manifold TK1 (ARM) processor. I don't know if I will see the responses to this but you can also contact me through jasperhatilima@gmail.com
All the best!
I am trying to run Guidance SDK on DJI Manifold, but uart example not works: it doesn't read anything from serial connection. I followed the DJI guide, enabled uart by Guidance Assistant software and connect with uart cable the uart port of Guidance and uart3 port of Manifold (/dev/ttyTHS2 in Manifold kernel) but no data arrives from Guidance.
Any ideas?
Were you able to run uart example on DJI Manifold?