Ask Your Question
0

undefined reference to `mysql_init' ... etc. [closed]

asked 2014-10-07 09:51:03 -0500

jay75 gravatar image

ros indigo

ubuntu 14.04 trusty

at 100% build i get :

CMakeFiles/command_action_server.dir/src/commandserver.cpp.o: In function `__static_initialization_and_destruction_0(int, int)':
commandserver.cpp:(.text+0x52b): undefined reference to `mysql_init'
commandserver.cpp:(.text+0x595): undefined reference to `mysql_real_connect'
CMakeFiles/command_action_server.dir/src/commandserver.cpp.o: In function `hal_command_server::commandServer::~commandServer()':
commandserver.cpp:(.text._ZN18hal_command_server13commandServerD2Ev[_ZN18hal_command_server13commandServerD5Ev]+0x1a): undefined reference to `mysql_close'
CMakeFiles/command_action_server.dir/src/commandserver.cpp.o: In function `hal_command_server::commandServer::executeCB(boost::shared_ptr<hal_main::sendcommandGoal_<std::allocator<void> > const> const&)':
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x28d): undefined reference to `mysql_query'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x2a9): undefined reference to `mysql_store_result'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x2e4): undefined reference to `mysql_fetch_row'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x59d): undefined reference to `mysql_free_result'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x657): undefined reference to `mysql_query'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x673): undefined reference to `mysql_store_result'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x697): undefined reference to `mysql_num_rows'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0xcd9): undefined reference to `mysql_free_result'
commandserver.cpp:(.text._ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE[_ZN18hal_command_server13commandServer9executeCBERKN5boost10shared_ptrIKN8hal_main16sendcommandGoal_ISaIvEEEEE]+0x1018): undefined reference to `mysql_fetch_row'
collect2: error: ld returned 1 exit status

cmakelists.txt :

cmake_minimum_required(VERSION 2.8.3)
project(hal_main)

find_package(cmake_modules REQUIRED)
find_package(Eigen REQUIRED)
find_package(Boost REQUIRED thread date_time system filesystem program_options python )

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  actionlib
  actionlib_msgs
  message_generation
  roscpp
  rospy
  std_msgs
  genmsg
  visualization_msgs 
  clam_controller 
  clam_msgs
  pcl_ros
  cv_bridge
  eigen_conversions
  moveit_msgs
  geometry_msgs
  moveit_ros_planning 
  moveit_ros_planning_interface
  tf
  tf_conversions
  moveit_simple_grasps
  cmake_modules
  moveit_core 
  # eigen_conversions
)



find_package(OpenCV REQUIRED)

include_directories(${EIGEN_INCLUDE_DIRS})

add_definitions(${EIGEN_DEFINITIONS})

#SET( CMAKE_MODULE_PATH "/usr/share/cmake-2.8/Modules/" )
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/share/cmake_modules/cmake/Modules/")

find_package(MySQL REQUIRED)
include_directories(${MYSQL_INCLUDE_DIRS})
add_definitions(${MYSQL_DEFINITIONS})
#link_directories(/usr/lib/mysql/plugin/${MYSQL_LIBRARY_DIRS})



#find_package(OpenCV2 REQUIRED)
#find_package(mysql REQUIRED)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
##   * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
##   * If MSG_DEP_SET isn't empty the following dependencies might have been
##     pulled in transitively but can be declared for certainty nonetheless:
##     * add a build_depend tag for "message_generation"
##     * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
##   * add "message_generation" and every package in MSG_DEP_SET to
     #find_package(catkin REQUIRED COMPONENTS actionlib_msgs geometry_msgs moveit_msgs )
##   * add "message_runtime" and every package in MSG_DEP_SET to
##     catkin_package(CATKIN_DEPENDS ...)
##   * uncomment the add_*_files sections below as needed
##     and list every .msg/.srv/.action file to be processed
##   * uncomment the generate_messages entry below
##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
 add_message_files(
   FILES
   instr_set_arm.msg ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by jay75
close date 2014-10-08 06:30:46.716470

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-10-07 10:09:04 -0500

gvdhoorn gravatar image

updated 2014-10-07 10:12:08 -0500

I don't see any target_link_libraries(your_target ${MySQL_LIBRARIES}) (or whatever variable contains the libraries for MySQL) in your CMakeLists.txt: how is the linker going to find those symbols if you don't supply it with the appropriate libraries?


Strictly speaking, this isn't even a ROS question, it's all CMake.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-07 09:51:03 -0500

Seen: 1,121 times

Last updated: Oct 07 '14