Hey guys, just to start off with I just started learning ROS this summer so I am a total noob. I just got a LabJack U6-PRO and I am trying to integrate it into a ros project I have been working on but I have been struggling for days. I believe my issue is just getting the library to link correctly from the errors I am getting:
CMakeFiles/serial.dir/src/u6.c.o: In function `openUSBConnection':
u6.c:(.text+0x202): undefined reference to `LJUSB_GetDevCount'
u6.c:(.text+0x23f): undefined reference to `LJUSB_OpenDevice'
u6.c:(.text+0x2b5): undefined reference to `LJUSB_Write'
u6.c:(.text+0x2d7): undefined reference to `LJUSB_Read'
u6.c:(.text+0x3b4): undefined reference to `LJUSB_CloseDevice'
CMakeFiles/serial.dir/src/u6.c.o: In function `closeUSBConnection':
u6.c:(.text+0x42c): undefined reference to `LJUSB_CloseDevice'
CMakeFiles/serial.dir/src/u6.c.o: In function `getCalibrationInfo':
u6.c:(.text+0x5ad): undefined reference to `LJUSB_Write'
u6.c:(.text+0x5e9): undefined reference to `LJUSB_Read'
u6.c:(.text+0x6b2): undefined reference to `LJUSB_Write'
u6.c:(.text+0x6ee): undefined reference to `LJUSB_Read'
CMakeFiles/serial.dir/src/u6.c.o: In function `I2C':
u6.c:(.text+0x11f9): undefined reference to `LJUSB_Write'
u6.c:(.text+0x1245): undefined reference to `LJUSB_Read'
CMakeFiles/serial.dir/src/u6.c.o: In function `ehConfigIO':
u6.c:(.text+0x2429): undefined reference to `LJUSB_Write'
u6.c:(.text+0x2472): undefined reference to `LJUSB_Read'
CMakeFiles/serial.dir/src/u6.c.o: In function `ehConfigTimerClock':
u6.c:(.text+0x2647): undefined reference to `LJUSB_Write'
u6.c:(.text+0x2690): undefined reference to `LJUSB_Read'
CMakeFiles/serial.dir/src/u6.c.o: In function `ehFeedback':
u6.c:(.text+0x2940): undefined reference to `LJUSB_Write'
u6.c:(.text+0x2996): undefined reference to `LJUSB_Read'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/sam/catkin_ws/devel/lib/auto_grinder/serial] Error 1
make[1]: *** [auto_grinder/CMakeFiles/serial.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
[rosrun] Couldn't find executable named serial below /home/sam/catkin_ws/src/auto_grinder
Here is my CMakeList.txt file:
cmake_minimum_required(VERSION 2.8.3)
project(auto_grinder)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
rqt_gui
rqt_gui_cpp
)
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
SET(CMAKE_CXX_FLAGS "-lusb-1.0")
catkin_package()
include_directories(${customLibary_INCLUDE_DIRS})
include_directories(include ${catkin_INCLUDE_DIRS})
install(DIRECTORY include/${auto_grinder}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(DIRECTORY /usr/local/include/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(PROGRAMS scripts/auto_grinder
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
include_directories(/usr/local/lib)
include_directories(/usr/local/include)
add_library(mylabjack /usr/local/lib/liblabjackusb.so)
##add_library(libusb /usr/lib/x86_64-linux-gnu/libusb-1.0.so)
##add_executable(thislabjack /usr/include/liblabjackusb/labjackusb.c)
SET_TARGET_PROPERTIES(mylabjack PROPERTIES LINKER_LANGUAGE C)
#SET_TARGET_PROPERTIES(libusb PROPERTIES LINKER_LANGUAGE C)
add_executable(serial src/serial.cpp src/serialout.cpp src/motors.cpp src/keypad.cpp src/sensorinput.cpp src/u6.c)
target_link_libraries(serial ${catkin_LIBRARIES} mylabjack)
add_dependencies(serial auto_grinder_generate_messages_cpp)
catkin_python_setup()
I have been trying a lot of different things I have seen in other questions so it turned pretty messy. I know there is a similar question to this on the forums but they were using rosbuild rather than catkin so I was confused. I am using ubuntu 13.04 with ROS Hydro. The .so files for the labjack are under /usr/local/lib/ and the .h file is under /usr/local/include/ and it all works with example code outside of ROS. I'm not really sure if any other details are needed or not. The labjack driver and example code I am using are here: labjack (dot) com/support/u6
Anyone have any ideas? If not, thanks for looking anyways!
↧