Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 43 articles
Browse latest View live

cannot specify link libraries for target

$
0
0
Hello everyone. I dont normally run to the forums for healp, but I have been dealing with an issue for two days and I am getting really frustrated. I am trying to interface with a LabJack from within a ROS node. The developers have published a .c file full of functions for native TCP operation. I have compiled it into a shared object library but I am unable to link to it (Upon linking, I get undefined reference errors on the lines where I call functions from the library). I found a post on this site that says after adding the /lib directory (where my shared object library lives) to the link directories in CMakeLists, given my lib as libfoo, I add to the CMakeLists file "target_link_libraries(myNode,foo)" When I do this, I get the following error CMake Error at CMakeLists.txt:36 (target_link_libraries): Cannot specify link libraries for target "myNode" which is not built by this project. I am completely stumped. I am pasting my CMakeLists.txt. file just incase it helps. My node is for a diesel generator, called 'dieselGenerator' and my library (for the LabJack) is called libue9.so. It looks like comments get put in bold here, I dont mean to yell. I really appreciate your help. Cheers
cmake_minimum_required (VERSION 2.4.6)
include ($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set (ROS_BUILD_TYPE RelWithDebInfo)

# Initialize the ROS build system.
rosbuild_init ()

# Set the default path for built executables to the "bin" directory.
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)


# Set the name to use for the executable.
set (BINNAME dieselGenerator)

# Set the source files to use with the executable.
#set (SRCS ${SRCS} src/ue9.c)
set (SRCS ${SRCS} src/dieselGenerator.cpp)

# Have ROS autogenerate code used in messages.
rosbuild_genmsg ()

# Set the directories where include files can be found.
include_directories (${PROJECT_SOURCE_DIR}/include)
# Make sure the compiler can find the libraries.
link_directories (${PROJECT_SOURCE_DIR}/lib)
target_link_libraries (dieselGenerator ue9)

# Build the executable that will be used to run this node.
rosbuild_add_executable (${BINNAME} ${SRCS})

# List the libraries here.
set (LIBS ${LIBS} ue9)


adding switch to final link

$
0
0
I am trying to use and external library foo.a and I was told by the manufacturer to add -lnetpbm as a switch to your final link. as I am getting Linking CXX executable bin/fr_cam /home/scott/focusrobotics/release_20120111/lib/libfrdev.a(FrImage.o): In function `FrImage': /home/scott/focusrobotics/release_20120111/src/libfrdev/FrImage.cpp:226: undefined reference to `pm_openr' how do I do what he suggests?

Compile with rosunrelated library

$
0
0
Hello, I want to use a math libary that performs some calculatios, lib.a for example, in a ros package. I use the include statement in myNode.cpp but how do I link it to the executasble? Where do I have to pu the -lfoo -L. flags? Thanks very much in advance.

Compile with a static ross-unrelated library

$
0
0
Hello, I want to use a math libary that performs some calculatios, lib.a for example, in a ros package. I use the include statement in myNode.cpp but how do I link it to the executasble? Where do I have to pu the -lfoo -L. flags? Thanks very much in advance.

Error while loading shared libraries: cannot open shared object file: No such file or directory

$
0
0
It happens when I try to launch stageros (on Ubuntu Oneiric, Ros electric desktop full): `rosrun stage stageros` ex.: /opt/ros/electric/stacks/stage/bin/stageros: error while loading shared libraries: librostime.so: cannot open shared object file: No such file or directory I try adding files to environmental variable: export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/ros/electric/stacks/stage/lib:/opt/ros/electric/stacks/perception_pcl/ros_comm/clients/cpp/roscpp/lib:/opt/ros/electric/stacks/perception_pcl/ros_comm/clients/cpp/roscpp_serialization/lib:/opt/ros/electric/stacks/perception_pcl/ros_comm/tools/rosconsole/lib one after another... but got bored and frustrated (don't know how many I would have to add) It seems to me ROS doesn't know where his library files are. How to fix it?

how to include custom libraries

$
0
0
Hi everyone, I have a library(in C++) and I can compile and use it without ROS. It's a TCP/IP communication library. I want to listen those msgs and publish/use them in ROS. I know how to modify the cpp file to publish those msgs. But I don't know how to compile all together in ROS. So far, I found that I need to include target_link_libraries in CMakeList.txt file, but could not get it working. Let's say, my library sitting in home/ros_workspace/my_lib how should I modify the CMakeList.txt file? Thanks

How to include my own libraries in cmake to compile with rosmake?

$
0
0
Hi there, I am working in a thesis where I have to use ROS within a system (and the other way round). So far, what I have changed in the CMakeLists.txt is including the following lines: rosbuild_add_executable(ROSPublisher2MaCIClient ROSPublisher2MaCIClient.cpp) include_directories(../../../../include/utils) target_link_libraries(${GIMUtils} ../../../../lib/libGIMutils.a) include_directories(../../../../include/MaCI) target_link_libraries(${MaCI} ../../../../lib/libMaCI.a) include_directories(../../../../include/GIMI) include_directories(../../../../include/GIMnetAP) include_directories(../../../../include) target_link_libraries(${GIMI} ../../../../lib/libGIMI.a) include_directories(/usr/include/libxml2) TARGET_LINK_LIBRARIES(xml2) add_definitions(-DLINUX_OS) But there's no way it's working. I get a lot of "undefined reference" errors and I don't have an idea of how to fix it. That's why I was wondering: Is this the way to do it? (at least, so far the lines I have included in the CMakeLists.txt or is there something I'm missing (or some other file I have to update to make it all work with rosmake). Cheers,

rosrun behavior different depending on directory

$
0
0
I am using rosrun to run my program that successfully compiles. The program links to another shared object library. 1) If I run it inside the bin/ directory where my executable is using rosrun, it works fine. I use the command: rosrun MYPROGRAM myprogram 2) If I manually run my ROS node without rosrun ( ./myprogram) it also works fine. 3) If I navigate to any other directory on the system (for example, my ROS workspace) and run rosrun MYPROGRAM myprogram I get an error that the shared object library cant be found. Also, running ldd myprogram does show the correct linkage on the shared object library. Can anyone enlighten me on the reason why this happens? Thanks! update: The shared object library is linked to in the CMakeLists file by a relative directory using link_directories(../../otherlibrary) and this library is not located in any kind of system link path. Update2: It seems the reason is that executables are run from your current directory, and since I linked relative and I try to rosrun from somewhere else, it cant find the relative library. This behavior is apparently different on other systems, and with some compilers it defaults to getting the absolute path when a relative path is given. To make it a little more portable, I used the following cmake directive: GET_FILENAME_COMPONENT(LIBBASEDIR ../../otherlibrary/ ABSOLUTE) and then made sure to use ${LIBBASEDIR} in my link_directories. I would still appreciate any comments anyone may have on this...

Using Armadillo C++ library with ROS

$
0
0
Hello all! So I am trying to use the armadillo library for my project with ROS. I installed armadillo on my computer (Ubuntu 12.04) using the commands > sudo apt-get install libarmadillo2>> sudo apt-get install libarmadillo-dev More about the armadillo library and related downloads can be found here: [http://arma.sourceforge.net/docs.html#svd](http://arma.sourceforge.net/docs.html#svd) I then downloaded the armadillo package, and navigated to the "**examples**" folder. There, I typed "**make**" in the commandline to build the executables from the example files. I then ran an example which required LAPACK and BLAS (which I have installed a long time ago) to complete. This example ran perfectly. (Actually, the example calculated the inverse and determinant of a sample matrix A, which require LAPACK and BLAS to be installed). So far, so good. Now I have a ROS package, which requires armadillo. I copied the file called "**armadillo**" and the folder called "**armadillo bits**" into the "**include**" folder of my ROS package. I then went into /include/armadillo_bits/config.hpp and configured LAPACK and BLAS by doing > #define ARMA_USE_LAPACK>> #define ARMA_USE_BLAS I then went back into the main package folder, and did "rosmake". Everything compiled fine. I then did > rosrun mypackage mypackage and I get the following error: error: svd(): use of LAPACK needs to be enabled terminate called after throwing an instance of 'std::logic_error' what(): Aborted (core dumped) Apparently, the svd() function (which also needs LAPACK and BLAS like the inverse and determinant functions) cannot detect LAPACK. This is weird, because it worked with the example file in the armadillo "examples" folder. I have a feeling that I am not linking to the right libraries, and there is something fishy going on. How do I get Armadillo to work inside a ROS package, the same way I got it to work inside the "examples" folder in the armadillo folder? All help is greatly appreciated. Thanks! Nishant

ld searches in wrong folder for libraries when cross-compiling

$
0
0
Hi guys, I'm trying to cross-compile my own packages for armv7, so far I've been able to specify the correct toolchain by using the rostoolchain.cmake file. I also fixed a lot of other things I've had trouble with, but the only thing I'm having trouble with right now is specifying the correct folder for ld to search for libraries. I have stored all the ARM-compiled .so files I need in /opt/armv7/usr/lib, but ld still tries to look for libraries in /opt/ros/groovy/lib and /usr/lib. Since the files in those directories are compiled for Intel, that doesn't work of course. This is the error I get when I try to compile: /opt/armv7/bin/../lib/gcc/arm-v7a8-linux-gnueabi/4.4.1/../../../../arm-v7a8-linux- gnueabi/bin/ld: skipping incompatible /opt/ros/groovy/lib/libroscpp.so when searching for -lroscpp /opt/armv7/bin/../lib/gcc/arm-v7a8-linux-gnueabi/4.4.1/../../../../arm-v7a8-linux-gnueabi/bin/ld: cannot find -lroscpp How do I specify the correct folder for ld to look into? So far, I've tried the following "solutions" with no success: - Adding /opt/armv7/usr/lib to LD_LIBRARY_PATH, which didn't work. Seems like the directories I added were ignored completely. - Adding lines like set(CMAKE_SYSTEM_LIBRARY_PATH ...) or set(CMAKE_LIBRARY_PATH) to rostoolchain.cmake with the same result as with the LD_LIBRARY_PATH solution. - Setting the LD_PRELOAD variable, which gave me: ERROR: ld.so: object '/opt/armv7/usr/lib/libroscpp.so' from LD_PRELOAD cannot be preloaded: ignored. - Using the /etc/ld.so.conf.d and /etc/ld.so.conf files, which gave the same results as the first and second solutions (in other words, no results..) - Linking manually using target_link_libraries, which helped for direct dependencies of my project, but not for the second level dependencies. For example, if I manually link /opt/armv7/usr/lib/libroscpp.so then it is able to find libroscpp.so, but not /usr/lib/libboost_date_time-mt.so. - Replacing the whole lib folder in /opt/ros/groovy by my own lib folder, except for rospack.so because ROS needs that in order to make use of the Makefile. This didn't work since ld still looks for libraries in /usr/lib. I prefer not to replace my /usr/lib folder for the arm libraries.. - Only replacing specific Intel library files I need by their ARM counterparts, which worked for those libraries, but not for the rest of course. This solution is actually the same as the one above, except that I'm not replacing everything altogether. I do not prefer to replace all the libraries one by one.. I think I tried even more, but I forgot.. At least these are the most important things I tried. I'm stuck for weeks now so I'd really appreciate it if someone is able to help me. My rostoolchain.cmake file looks like this by the way: set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_C_COMPILER /opt/armv7/bin/arm-v7a8-linux-gnueabi-gcc) set(CMAKE_CXX_COMPILER /opt/armv7/bin/arm-v7a8-linux-gnueabi-g++) set(CMAKE_FIND_ROOT_PATH /opt/armv7/usr) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) find_file(TOOLCHAINCONFIG rostoolchain.cmake PATHS ENV ROS_ROOT NO_DEFAULT_PATH) if(TOOLCHAINCONFIG) include(${TOOLCHAINCONFIG}) endif(TOOLCHAINCONFIG) Thanks in advance and please tell me if you need more information. I'm aware that I might have left out some details for some of the solutions I tried, but I tried so many of them that I already forgot the exact details except that it didn't work.. But if it's needed I can go and try to reproduce the results again.

Fovis: fatal error: linux/compiler.h: No such file or directory

$
0
0
Hi guys, I have downloaded the visual odometry package Fovis (which is not a ros package) and I am trying to compile it using rosbuild on Fuerte and ubuntu 12.04. When I `$rosmake ros_fovis` which is the ROS package I created, I get the following error: `In file included from /usr/include/stdio.h:34:0, from /home/samme/fuerte_workspace/ros_fovis/libfovis/frame.cpp:1: /usr/src/linux-headers-3.2.0-35-generic/include/linux/stddef.h:4:28: fatal error: linux/compiler.h: No such file or directory compilation terminated.` I tried adding this line to the CMakeList.txt : `include_directories(/usr/src/linux-headers-3.2.0-35-generic/include/linux)` but I still get the same error. Am I doing something wrong? Is there a specific library I need to add? Thanks for your help, Khalid

Compiling External Libraries (Bullet 2.81) with ROS package

$
0
0
Apologies in advance for the long winded explanation. I want to make sure I explain clearly. I have written some code that works with the Bullet Physics Engine to simulate some models for a bayesian filter. I can compile this code using g++ with this command line statement: g++ main.cpp BasicDemo.cpp -lGL -lGLU -I ~/Documents/cppCode/bullet-2.81-rev2613/src/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletDynamics/libBulletDynamics.a ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletCollision/libBulletCollision.a ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/LinearMath/libLinearMath.a -o main where those paths lead to the proper files on my particular system. I am using a PR2 to generate observations for my bayesian filter. Up to this point, I simply used another bullet simulation to do this but now want to use the PR2 instead. So I have written the necessary code on the PR2 side and the communication code to send a command to the PR2 to execute an action and return an observation. My plan was to add the other side of this communication code to my bullet and filter code and thus have the connection I'm looking for. As a first step, I placed the bullet and filter code into a ros package. I needed to modify my CMakelists to link to the compiled bullet code that exists on my machine. After much arguing and experimenting, I produced the CMakeLists.txt file that I have copied and pasted at the bottom of this post. This compiled the code with no errors. The reason that the CMakeLists is written the way it is is because ROS Fuerte has a version of bullet physics in it. However, the version is older than the version that I need for parts of my code. I am using bullet 2.81. So I had to force cmake to find my libraries before it found the ones in my regular ROS search paths. This caused the manually adding flags section. Before I did this, it would tell me that certain classes did not have certain members which was true for the older bullet physics in ROS but is not true for the newer version I have been using. After these changes, the errors went away. However, when I run the code, it throws a segmentation fault. This code is an exact copy (besides changing the header files to the regular way that a ros package would have them [for example instead of "BasicDemo.h" in my old files, it would be where basicBayesV2wRobot is the name of the package]) of the code that compiles and runs properly when compiled with the g++ command above. I have very little experience with cmake and especially with compiling external libraries in a ROS package and making sure ROS finds my libraries which are a newer version of libraries it has. Does anyone have any experience with this. The line that seg faults (according to gdb) is a line that gives no errors with my original compilation using g++. Thanks. CMakeLists.txt: cmake_minimum_required(VERSION 2.4.6) include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) # Set the build type. Options are: # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage # Debug : w/ debug symbols, w/o optimization # Release : w/o debug symbols, w/ optimization # RelWithDebInfo : w/ debug symbols, w/ optimization # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries #set(ROS_BUILD_TYPE RelWithDebInfo) rosbuild_init() #set the default path for built executables to the "bin" directory set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #set the default path for built libraries to the "lib" directory set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) #o my goodness SET(GCC_COVERAGE_LINK_FLAGS "-lGL -lGLU -I /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/src/ /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletDynamics/libBulletDynamics.a /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletCollision/libBulletCollision.a /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/LinearMath/libLinearMath.a") #SET(GCC_COVERAGE_LINK_FLAGS "-lGL -lGLU -I/mit/barragan/Documents/cppCode/bullet-2.81-rev2613/src/") SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}" ) #SET( CMAKE_EXE_LINKER_FLAGS "${GCC_COVERAGE_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" ) #uncomment if you have defined messages #rosbuild_genmsg() #uncomment if you have defined services #rosbuild_gensrv() #common commands for building c++ executables and libraries #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) #target_link_libraries(${PROJECT_NAME} another_library) #rosbuild_add_boost_directories() #rosbuild_link_boost(${PROJECT_NAME} thread) #rosbuild_add_executable(example examples/example.cpp) #target_link_libraries(example ${PROJECT_NAME}) #include_directories(~/Documents/cppCode/bullet-2.81-rev2613/src/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletDynamics/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletCollision/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/LinearMath/) #link_directories(~/Documents/cppCode/bullet-2.81-rev2613/src/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletDynamics/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletCollision/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/LinearMath/) rosbuild_add_executable(basicBayesV2wRobot src/basicBayesV2wRobot.cpp src/BasicDemo.cpp) target_link_libraries(basicBayesV2wRobot /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/src/ /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletDynamics/libBulletDynamics.a /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletCollision/libBulletCollision.a /mit/barragan/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/LinearMath/libLinearMath.a) #target_link_libraries(basicBayesV2wRobot GL GLU BulletDynamics BulletCollision LinearMath)

error while loading shared libraries ardrone

$
0
0
Hello everyone. I needed to pass to Ubuntu 64 bit in order not to have problems with the package ar_track_alvar. I was working with the ardrone_autonomy package, which did work fine until i was on 32 bit. Now, when i launch the node, i get the following error: fuerte_workspace/ardrone_autonomy/bin/ardrone_driver: error while loading shared libraries: libimage_transport.so: wrong ELF class: ELFCLASS64 and the process dies. Any idea to how to fix this? Thanks in advance!

How can I create my own ROS C++ library?

$
0
0
Hello All, This might be a repeat question (although I checked out some of the recommendations that ROS Answers asked me to look at while typing the title of this question, but they didn't seem relevant). Here goes. So I have a C++ header file called "force_torque.h" (I had issues with this, but thanks to @jbohren I was able to fix those) and I want to convert it into a ROS library. So basically, I want it to be a valid ROS package, yet I also want other ROS packages to be able to depend on this package. So far, I have just been able to create a new package using 'roscreate-pkg'. Now I have a feeling that I need to modify "CMakeLists.txt" somehow, but I don't know how. Is there any good ROS tutorial on how to do this? Or if it could be described here on this question below, I would be very grateful. Thanks, and all help is greatly appreciated! Nishant

rosseria_arduino ros_lib permission denied

$
0
0
Hello, I'm new in ROS and I'm trying to setup rosserial arduino following the steps of the tutorial: cd /src git clone https://github[dot]com/ros-drivers/rosserial.git `cd ` catkin_make catkin_make install source /install/setup.bash cd /libraries rm -rf ros_lib rosrun rosserial_arduino make_libraries.py . but when I enter the last command I get this error message: OSError: [Errno 13] Permission denied: '/home/jaime/sketchbook/libraries/ros_lib' I need to know what to do in this case. Thank you very much! Apparently is about a permission to make a folder into the ~/sketchbook/libraries folderbecause I can run the same last code outside that folder and it works. Thanks

Is it possible to create a catkin package to provide precompiled libraries?

$
0
0
Is there a way to create a catkin package that only provides precompiled libraries instead of building them, so that other catkin packages can depend on them and the libraries are present in the devel folder when the other packages are build? Greetings, Thiemo

libbondcpp.so rpi file for nodelets

$
0
0
Hi while launching openni_launch I get this error `/opt/ros/groovy/lib/nodelet/nodelet error while loading shared libraries: libbondcpp.so not found.` I am wondering if anyone can link me to this file for arm architecture for raspberry pis. (Hopefully with this it will be fixed?) Thanks.

with rosserial, changes to arduino library .h files have no effect

$
0
0
I successfully setup and am using rosserial, but want to make some changes to the .h files located in the arduino library, for example ...sketchbook/libraries/ros_lib/ros.h or ...sketchbook/libraries/ros_lib/ros/nodehandle.h but for some reason, changes to those files do not get incorporated into the build made with the arduino IDE. I have tried closing the IDE, rebooting, etc. It seems as if the library files are coming from some other location. I have a lot of experience with arduino and custom libraries and this one has me completely baffled.

how to tell roslaunch to use the shared libraries from my catkin work space lib directory before the default ros libraries.

$
0
0
I'm debugging my node written in cpp. My code calls ControllerManager::update from controller_manager package. But the gdb doesn't step into the function. I cloned https://github.com/ros-controls/ros_control.git and rebuilt it. My node is linked against libcontroller_manager.so built with the controller_manager package. Probably roslaunch loads the version of the libcontroller_manager.so from /opt/ros/hydro/lib instead of the one which was built with the controller_manager package. So the question is how to tell roslaunch to use the shared libraries from my catkin work space lib directory before the default ros libraries.

Issues linking LabJack Libraries

$
0
0
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!
Viewing all 43 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>