Sunday, May 6, 2012

Mysql Connector/C++ build and install from source

1. Install Cmake build tool


sudo apt-get install cmake


2. Install libmysqlclient16-dev library



sudo apt-get install libmysqlclient16-dev



3. Install squeeze (stable) Build platform



sudo apt-get install squeeze




4. Go to the Mysql download page and download the source for c++ connector, extract it and go into the folder using terminal.

5. Set the following  environment variables


export CC=gcc
export CFLAGS=-O1-g
export CPPFLAGS=-DNDEBUG
export CXX=g++
export CXXFLAGS=-O1-gexport CC=gcc
export CFLAGS=-O1-g
export CPPFLAGS=-DNDEBUG
export CXX=g++
export CXXFLAGS=-O1-g
export LDFLAGS=-static-libgcc
export PICOPT=-fPIC
export LDFLAGS=-static-libgcc
export PICOPT=-fPIC


6. Edit file in following locations and add missing includes.

   i.  Add #include <cstdio>  to driver/mysql_art_resultset.cpp 
   ii. Add #include <stdio.h>  to driver/mysql_resultbind.cpp 
   iii. Add #include <stdio.h>  to test/unit/classes/resultsetmetadata.cpp

7.  Run


cmake .
make 
make install






No comments:

Post a Comment