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

Add mysql library to ROS package

asked 2015-02-16 05:36:13 -0600

Edmodi gravatar image

Hi, I would like connect ros node with a Mysql DB but I can't do it. I don't know how use mysql lib client in Ros node because when compiled it appears error as undefined reference to `mysql_get_client_info'. I'm try use cpp cflags export in package.xml but I can't found the correct way to do it.

Thanks in advanced.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-02-16 07:04:32 -0600

gvdhoorn gravatar image

If this is a catkin package, treat the CMakeLists.txt as you would any ordinary CMake package.

Use find_package(..) and friends to look for the MySQL headers, libraries and other files. Then add those to your include path (include_directories(..)). Make sure to link your node executable to the libraries (target_link_libraries(target_name ${mysql_LIBRARIES})). Make sure to check the names of those Find script variables for yourself, as I did not check them.

I'm try use cpp cflags export in package.xml but I can't found the correct way to do it.

cpp flags is something from rosbuild, which isn't used/supported anymore under catkin.

edit flag offensive delete link more
0

answered 2015-02-16 07:02:57 -0600

BennyRe gravatar image

The proper way to link against libraries is in the target_link_libraries function in the CMakeLists.txt file.

There also exists a rosdep entry for MySQL. It is called libmysqlclient-dev but I'm not 100% sure if it includes the libraries you need. (I just found this entry in the repo.) If this is suited for your use case add it to the build and run dependencies.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-02-16 05:36:13 -0600

Seen: 543 times

Last updated: Feb 16 '15