mysql connection
Hello,
I am trying to establish a mysql database connection within a ROS package. I have found the following two questions;
- answers.ros.org/questions/32520/add-mysql-to-a-ros-project
- answers.ros.org/questions/34308/mysql-and-ros
In regards to the first question, I have done everything as said. libmysqlclient15-dev is installed, but still getting the error below. What have I done wrong?
======Error
mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=/opt/ros/hydro/share/ros/core/rosbuild/rostoolchain.cmake ..
[rosbuild] Building package zuros_sequencer
-- Using CATKIN_DEVEL_PREFIX: /home/robot/git/zuros/zuros_sequencer/build/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/hydro
-- This workspace overlays: /opt/ros/hydro
-- Using Debian Python package layout
-- Using CATKIN_ENABLE_TESTING: ON
-- Skip enable_testing() for dry packages
-- Using CATKIN_TEST_RESULTS_DIR: /home/robot/git/zuros/zuros_sequencer/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- catkin 0.5.77
[rosbuild] Including /opt/ros/hydro/share/roslisp/rosbuild/roslisp.cmake
[rosbuild] Including /opt/ros/hydro/share/roscpp/rosbuild/roscpp.cmake
[rosbuild] Including /opt/ros/hydro/share/rospy/rosbuild/rospy.cmake
CMake Error at CMakeLists.txt:23 (find_package):
Could not find module FindMySql.cmake or a configuration file for package
MySql.
Adjust CMAKE_MODULE_PATH to find FindMySql.cmake or set MySql_DIR to the
directory containing a CMake configuration file for MySql. The file will
have one of the following names:
MySqlConfig.cmake
mysql-config.cmake
-- Configuring incomplete, errors occurred!
make: *** [all] Error 1
======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()
# add include search paths
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/ros/include
${PROJECT_SOURCE_DIR}/common/include)
#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)
find_package(MySql REQUIRED)
include_directories(${MYSQL_INCLUDE_DIRS})
add_definitions(${MYSQL_DEFINITIONS})
#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})
# add build commands
rosbuild_add_executable(sequence ros/src/sequence.cpp
ros/src/zwaveSubscriber.cpp
ros/src/databaseConnector.cpp)
======manifest.xml
<package>
<description brief="zuros_sequencer">
zuros_sequencer
</description>
<author>robot</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>XXX</url>
<depend package="std_msgs"/>
<depend package="rospy"/>
<depend package="roscpp"/>
<depend package="zuros_sensors"/>
<rosdep name="libmysqlclient-dev"/>
<export>
<cpp lflags="-lmysqlclient"/>
</export>
</package>