Saturday, May 5, 2012

Ubuntu Cmake issue with mysql c++ connector

I have encountered an error while i try to follow the installation instructions on this page for compiling mysql c++ client. One of the errors was the misleading info in download link of the page . It direct you to linux generic code page and if you download the linux generic code you are dhoomed (you will get bunch of libraries and nothing to compile).

So first you have to download the source code for the connector ( not the linux generic code ).

Then i encountered this weird problem when i try to compile things.


-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/cc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- ENV{MYSQL_DIR} = 
CMake Error at FindMySQL.cm:165 (MESSAGE):
  mysql_config wasn't found, -DMYSQL_CONFIG_EXECUTABLE=...
Call Stack (most recent call first):
  CMakeLists.txt:55 (INCLUDE)


CMake Error at FindMySQL.cm:167 (MESSAGE):
  Cannot find MySQL.  Include dir: MYSQL_INCLUDE_DIR-NOTFOUND library dir:
  cxxflags:
Call Stack (most recent call first):
  CMakeLists.txt:55 (INCLUDE)


-- Configuring incomplete, errors occurred!

Here I can see more than one problems, in tutorial you have no instruction to declare a variable named MYSQL_DIR. But here you need a one so type 

Which mysql

and export it as

export MYSQL_DIR=/usr/bin/mysql

Then for the configuration file missing error you have to install libmysqlclient16-dev library to have mysql_configure file in your system. So type,


sudo apt-get install libmysqlclient16-dev

2 comments: