ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the purpose of the Makefile? Are you trying to do a hybrid package that can be compiled using both CMak/catkin & make? Catkin pkgs don't use/have a Makefile.

Also:

[..] With $ make grampc in - catkin/src i get: [..]

Unless you are really doing some hybrid thing, I wouldn't do that. This doesn't look like a normal cmake / catkin workflow to me.

From what I can gather from your OP:

  1. remove grampc/Makefile
  2. remove any other 'left overs' from your previous build attempts in the src dir
  3. cd /path/to/catkin/
  4. catkin_make -j1

Now see whether you get any more errors, and try to solve them.

The -j1 is just for debugging your build infrastructure, it disables parallel building, which can get confusing when trying to fix things.

What is the purpose of the Makefile? Are you trying to do a hybrid package that can be compiled using both CMak/catkin & make? Catkin pkgs don't use/have a Makefile.

Also:

[..] With $ make grampc in - catkin/src i get: [..]

Unless you are really doing some hybrid thing, I wouldn't do that. This doesn't look like a normal cmake / catkin workflow to me.

From what I can gather from your OP:

  1. remove grampc/Makefile
  2. remove any other 'left overs' from your previous build attempts in the src dir
  3. cd /path/to/catkin/
  4. catkin_make -j1

Now see whether you get any more errors, and try to solve them.

The -j1 is just for debugging your build infrastructure, it disables parallel building, which can get confusing when trying to fix things.


Edit:

Try something like this. I've assumed there is something called grampc_node.cpp, as it seems like you are trying to create a ROS node, that uses libgrampc to do something. If not (and this is a library-only pkg), just remove the add_executable(..) (and associated target_link_libraries(..)) statement.

In general, you'll want to link against ${catkin_LIBRARIES}, which will contain all libraries exported by the packages that you specify in your find_package(catkin REQUIRED COMPONENTS ..) statement. You were only linking roscpp, hence the linker errors about rosbag fi.

cmake_minimum_required(VERSION 2.8)
project(grampc)

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg message_runtime)

add_service_files(FILES grampc_IO.srv)
generate_messages(DEPENDENCIES std_msgs)

catkin_package(
  CATKIN_DEPENDS roscpp rospy std_msgs genmsg message_runtime message_generation
)

include_directories(
  include ${catkin_INCLUDE_DIRS}
)

# define libgrampc sources
set(
  grampc_SRCS

  src/euler1.c
  src/eulermod2.c
  src/grampc_init.c
  src/grampc_mess.c
  src/grampc_run.c
  src/grampc_setopt.c
  src/grampc_setparam.c
  src/heun2.c
  src/probfct.c
  src/ruku45.c
)

# define a libgrampc target
add_library(grampc ${grampc_SRCS})

# define a grampc_node target
add_executable(grampc_node src/grampc_node.cpp)

# now link our node to the library, and all the libraries from the other pkgs
target_link_libraries(grampc_node grampc ${catkin_LIBRARIES})

add_dependencies(grampc_node grampc_gencpp)

What is the purpose of the Makefile? Are you trying to do a hybrid package that can be compiled using both CMak/catkin & make? Catkin pkgs don't use/have a Makefile.

Also:

[..] With $ make grampc in - catkin/src i get: [..]

Unless you are really doing some hybrid thing, I wouldn't do that. This doesn't look like a normal cmake / catkin workflow to me.

From what I can gather from your OP:

  1. remove grampc/Makefile
  2. remove any other 'left overs' from your previous build attempts in the src dir
  3. cd /path/to/catkin/
  4. catkin_make -j1

Now see whether you get any more errors, and try to solve them.

The -j1 is just for debugging your build infrastructure, it disables parallel building, which can get confusing when trying to fix things.


Edit:

Try something like this. I've assumed there is something called grampc_node.cpp, as it seems like you are trying to create a ROS node, that uses libgrampc to do something. If not (and this is a library-only pkg), just remove the add_executable(..) (and associated target_link_libraries(..)) statement.

In general, you'll want to link against ${catkin_LIBRARIES}, which will contain all libraries exported by the packages that you specify in your find_package(catkin REQUIRED COMPONENTS ..) statement. You were only linking roscpp, hence the linker errors about rosbag fi.

cmake_minimum_required(VERSION 2.8)
project(grampc)

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg message_runtime)
message_runtime rosbag)

add_service_files(FILES grampc_IO.srv)
generate_messages(DEPENDENCIES std_msgs)

catkin_package(
  CATKIN_DEPENDS roscpp rospy std_msgs genmsg message_runtime message_generation
message_generation rosbag
)

include_directories(
  include ${catkin_INCLUDE_DIRS}
)

# define libgrampc sources
set(
  grampc_SRCS

  src/euler1.c
  src/eulermod2.c
  src/grampc_init.c
  src/grampc_mess.c
  src/grampc_run.c
  src/grampc_setopt.c
  src/grampc_setparam.c
  src/heun2.c
  src/probfct.c
  src/ruku45.c
)

# define a libgrampc target
add_library(grampc ${grampc_SRCS})

# define a grampc_node target
add_executable(grampc_node src/grampc_node.cpp)

# now link our node to the library, and all the libraries from the other pkgs
target_link_libraries(grampc_node grampc ${catkin_LIBRARIES})

add_dependencies(grampc_node grampc_gencpp)

This is untested, so this could still fail, but at least it should be closer to what you need.

Also: make sure to check your (catkin) dependency lists, I don't know which packages you really need.