ROS Raspberry Pi and Wiring Pi [closed]

asked 2014-12-31 08:48:26 -0600

altella gravatar image

Hello all; I have installed ROS Groovy on the Raspberry Pi, and I am trying to compile a simple node to test the Wiring Pi library from inside ROS. Both Wiring Pi and ROS are working correctly on the Pi. I am having errors when linking. Attached you can find all the information of the process. Could anyone give a hint? Thank you very much.

when doing "catkin_make" I have the following error:

 Linking CXX executable /home/pi/at_robot_ws/devel/lib/at_robot/motor_driver
/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../arm-linux-gnueabihf/crt1.o: In function `_start':
(.text+0x34): undefined reference to `main'
collect2: ld returned 1 exit status
at_robot/CMakeFiles/motor_driver.dir/build.make:103: recipe for target '/home/pi/at_robot_ws/devel/lib/at_robot/motor_driver' failed
make[2]: *** [/home/pi/at_robot_ws/devel/lib/at_robot/motor_driver] Error 1
CMakeFiles/Makefile2:280: recipe for target 'at_robot/CMakeFiles/motor_driver.dir/all' failed
make[1]: *** [at_robot/CMakeFiles/motor_driver.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make" failed

My CMakeLists. txt is:

cmake_minimum_required(VERSION 2.8.3)
project(at_robot)

find_package(catkin REQUIRED COMPONENTS
            roscpp
            std_msgs)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need

catkin_package(
  INCLUDE_DIRS include
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations

include_directories(include)
include_directories(${catkin_INCLUDE_DIRS}
            /usr/local/include)

link_directories(${catkin_LIBRARY_DIRS}
            /usr/local/lib)

## Declare a cpp executable
add_executable(motor_driver src/MotorDriver.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(motor_driver
            ${catkin_LIBRARIES}
            /usr/local/lib/libwiringPi.so)

And my package.xml:

 <?xml version="1.0"?>
<package>
  <name>at_robot</name>
  <version>0.0.0</version>
  <description>The at_robot package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag --> 
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="pi@todo.todo">pi</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>


  <!-- Url tags are optional, but mutiple are allowed, one per tag -->
  <!-- Optional attribute type can be: website, bugtracker, or repository -->
  <!-- Example: -->
  <!-- <url type="website">http://wiki.ros.org/at_robot</url> -->


  <!-- Author tags are optional, mutiple are allowed, one per tag -->
  <!-- Authors do not have to be maintianers, but could be -->
  <!-- Example: -->
  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->


  <!-- The *_depend tags are used to specify dependencies -->
  <!-- Dependencies can be catkin packages or system dependencies -->
  <!-- Examples: -->
  <!-- Use build_depend for packages you need at compile time: -->
  <!--   <build_depend>message_generation</build_depend> -->
  <!-- Use buildtool_depend for build tool packages: -->
  <!--   <buildtool_depend>catkin</buildtool_depend> -->
  <!-- Use run_depend for packages you need at runtime: -->
  <!--   <run_depend>message_runtime</run_depend> -->
  <!-- Use test_depend for packages you need only for testing: -->
  <!--   <test_depend ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-03-16 13:30:48.306326

Comments

do you deal this problem?

BJ1 gravatar image BJ1  ( 2015-02-28 20:27:44 -0600 )edit

yes I already did... I am trying to figure out how... I do not remember :-)

altella gravatar image altella  ( 2015-03-01 15:05:47 -0600 )edit

i _think_ it's just that target_link_libraries should include just

wiringpi
not
/usr/local/lib/libwiringPi.so

matpalm gravatar image matpalm  ( 2016-03-28 00:34:11 -0600 )edit