Guideline of developing Drizzle

Source: Internet
Author: User
Tags automake

After reading Jay pipes "getting a working C/C ++ development environment for developing drizzle", I follow his guide and success getting a development workspace for myself. I think this experience is important for us setting our open source project in the futrue:

 

This article is as an example in Drizzle server project, but the vast majority of the content applies equally well to developers wishing to contribute to the MySQL server or any other open source project written in C/C ++. and I run these CMD in unbuntu.

 

1. Installing bazaar and some bzr goodies

So, what is this bazaar thing and why do you need it? Good question! Bazaar is the revision control system that the drizzle Development Team (as well as the MySQL engineering team) uses for source code control. the good folks over at Canonical maintain and enhance the excellent bazaar-ng system and have an online platform called launchpad.net which is tightly integrated with bazaar. launchpad.net is kind of like sourceforge.net, only focused around bazaar as the revision control system, and between des a number of nifty little features that make it easier to manage and maintain teams of developers working on the code base. the drizzle server project is hosted on launchpad.net at http://launchpad.net/drizzle.

To install bazaar, issue the following:

 

sudo apt-get install bzr

 

Once installed, you might want to install a few more things that will make yourBzrLife easier.BzrtoolsPackage is a collection of command-line and graphical utilitiesBzr.MeldIs a graphical merge conflict resolution utility that I have found invaluable at times.PoeditIs an easy way to work with the gettext translation utilities. to install these tools, do:

 

sudo apt-get install bzrtools meld poedit

 

OK, that's it for bazaar for now. Let's move on to getting your development toolchain installed.

 

2. The required toolchain packages and library Dependencies

In order to compile the drizzle server, you will need a working GNU toolchain with the following development tools. I 've noted recommended minimum versions for each.

  • Binutils (includesLDAndAs)
  • Gcc/G ++ (4.2 +)
  • Autoconf(2.59 +)
  • Automake(1.10 +)
  • Libtool(1.5.24 +)
  • M4(1.4.8 +)
  • Bison/YACC (2.3)
  • PKG-config(0.22 +)

To install the above toolchain, do the following:

 

sudo apt-get install libc-dev gcc g++ bison binutils automake autoconf m4 pkg-config libtool

 

Once apt-Get finishes installing the above, you'll have a system capable of compiling C/C ++ programs, for the most part. the drizzle server needs some additional libraries and header files in order to compile. I list them here along with a brief description of the library or file.

  • Libpcre3-A standard PCRE Regular Expression Library
  • Libpam0g-A Pluggable Authentication Modules Library (Horrible package name, no ?...)
  • Libncurses-A library for displays of terminal applications (used by the drizzle client)
  • Libprotobuf-Google proto buffers library, used by the server in message communication
  • Gettext-I10n and l10n services
  • Libevent-Socket event handling
  • Libz-Compression
  • Libreadline-Command-line editing utilities
  • UUID-Dev-UUID Headers

The following command shocould install the required libraries with the exception of Google proto buffers, which is described in the following section.

 

sudo apt-get install libpcre3-dev libpam0g libncurses5-dev libpam0g-dev gettext libevent-dev libz-dev libreadline-dev uuid-dev

PS: Some of these tools may be changed or updated, so please take care of the infomation while install them.

 

3. Installing Google proto Buffers

After installing the libraries and toolchain, you'll need to install the Google proto buffers library. unfortunately, there are not currently distribution packages for this library, so we'll install it manually. here are the steps to do this.

Grab the tarball from the following location: http://code.google.com/p/protobuf/downloads/list. Once downloaded, untar the package. You can do all of it like so:

 

wget http://protobuf.googlecode.com/files/protobuf-2.1.0.tar.gz</p><p>tar -xzf protobuf-2.1.0.tar.gz<br />

 

Next, let's go ahead and compile the sources:

 

CD protobuf-2.1.0 </P> <p>./configure & make <br/> sudo make install <br/>

 

Once this is done, Google proto buffers Library (libprotobuf. so.0) will be installed, likely in/usr/local/lib unless you specified a different default directory. In addition, the programProtoc, Which is the. proto file compiler, will be installed.

Important: As developers on a Linux distribution, we tend to forget that when installing a new shared library object, we need to runLdconfigAfter installation. Why do we forget this? Well, generally, our package manager runsLdconfigAutomatically after installing a package, so we tend to forget about it. to reconfigure the linker's configuration, run this now:

sudo ldconfig

OK, the proto buffers library andProtocShocould be installed correctly at this point. To verify, run the following:

sudo updatedb<br />locate libprotobuf.so

It shoshould produce something like the following:

 /Home/Cuda/desktop/jasework/gsoc/source/protobuf-2.1.0/src /. libs/libprotobuf. so <br/>/home/Cuda/desktop/jasework/gsoc/source/protobuf-2.1.0/src /. libs/libprotobuf. so.4 <br/>/home/Cuda/desktop/jasework/gsoc/source/protobuf-2.1.0/src /. libs/libprotobuf. so.4.0.0 <br/>/usr/local/lib/libprotobuf. so <br/>/usr/local/lib/libprotobuf. so.3 <br/>/usr/local/lib/libprotobuf. so.3.0.0 <br/>/usr/local/lib/libprotobuf. so.4 <br/>/usr/local/lib/libprotobuf. so.4.0.0

 

4. Setting up a local bazaar repository for drizzle and libdrizzle

Now that you 've installed all the required toolchain and dependencies, it's time to use bazaar to pull the Development Branch of drizzle and compile the drizzle server. the first step to do is to set up that local bzr repository. myself, I have all my bzr repositories in a directory called~ /Repos, And that is what the below examples show, but you are of course welcome to put your repos wherever you prefer. to set up a directory and a drizzle repo under your home directory, do the following:

 

cd ~<br />mkdir repos<br />cd repos<br />bzr init-repo libdrizzle<br />bzr init-repo drizzle<br />cd drizzle

 

At this point, you have a local bzr repository. Let's now create a local branch of the development source code trunk that we can play with. To do so, we useBzr BranchCommand to get libdrizzle and drizzle, like so:

 

1. Get libdrizzle and install it (I install libdrizzle and drizzle in my user Dir, not root DIR)

Bzr branch LP: libdrizzle </P> <p> Cd libdrizzle </P> <p>. /cofig/Autorun. sh </P> <p>. /configure -- prefix =/home/Cuda/drizzle/libdrizzle </P> <p> make install <br/>

 

2. Get Drizzle

 

bzr branch lp:drizzle trunk

 

This tells bzr to go grab the main development branch of the "drizzle" project that resides on the launchpad.net servers (thus, the LP: prefix ), and create a local branch called "trunk ". the branch operation may take a little while to complete when you do it for the first time. subsequent branch and merge operations are much, much quicker than the first branch into a repository. when the branch succeeds, go ahead and look at the files that have been downloaded into your "trunk" branch:

 

cd trunk<br />ls -la

 

You shoshould see something like the following:

 

Cuda @ cuda-desktop :~ /Repos/drizzle/trunk $ LS-La <br/> total 3576 <br/> drwxr-XR-x 16 Cuda 4096. <br/> drwxr-XR-x 4 Cuda 4096 .. <br/>-RW-r -- 1 Cuda 76502 ABOUT-NLS <br/>-RW-r -- 1 Cuda 34554 aclocal. m4 <br/>-RW-r -- 1 Cuda 377 authors <br/> drwxr-XR-x 2 Cuda 4096 autom4te. cache <br/> drwxr-XR-x 5 Cuda 4096. bzr <br/>-RW-r -- 1 Cuda 5266. bzrignore <br/>-RW-r -- 1 Cuda 77494 changelog <br/> drwxr-XR-x 4 Cuda 4096 client on <br/> drwxr -XR-x 2 Cuda 4096 config <br/>-RW-r -- 1 Cuda 26324 config. h <br/>-RW-r -- 1 Cuda 24311 config. h. in <br/>-RW-r -- 1 Cuda 412208 config. log <br/>-rwxr-XR-x 1 Cuda 98897 config. status <br/>-rwxr-XR-x 1 Cuda 1480434 configure <br/>-RW-r -- 1 Cuda 46418 configure. AC <br/>-RW-r -- 1 Cuda 19071 copying <br/>-RW-r -- 1 Cuda 56574 doxyfile <br/> drwxr-XR-x 12 Cuda 12288 drizzled <br/>-RW-r -- 1 Cuda 5962 drizzle. FAQ <br/>-RW-r -- 1 Cuda 5139 exceptions-client <br/> drwxr-XR-x 4 Cuda 4096 extra <br/> drwxr-XR-x 4 Cuda 4096 gnulib <br/>-RW-r -- 1 Cuda 9512 install <br/>-rwxr-XR- X 1 Cuda 245523 libtool <br/> drwxr-XR-x 2 Cuda 4096 M4 <br/>-RW-r -- 1 Cuda 408917 makefile <br/>-RW-r -- 1 Cuda 8834 makefile. am <br/>-RW-r -- 1 Cuda 449878 makefile. in <br/> drwxr-XR-x 4 Cuda 4096 mystrings <br/> drwxr-XR-x 4 Cuda 12288 mysys <br/>-RW- r -- 1 Cuda 41 news <br/> drwxr-XR-x 25 Cuda 4096 plugin <br/> drwxr-XR-x 2 Cuda 4096 po <br/>-RW-r -- 1 Cuda 821 readme <br/>-RW-r -- 1 Cuda 23 stamp-h1 <br/> drwxr-XR-x 3 Cuda 4096 support-files <br/> drwxr-XR-x 13 Cuda 4096 tests <br/>

 

5. Compiling Drizzle

OK, you are now ready to compile the server and client tools contained in your branch. The way to do so is the following:

./config/autorun.sh # This will set up the autoconf and make environment for drizzle<br />./configure --prefix=/home/cuda/Drizzle/dir/ --with-libdrizzle-prefix=/home/cuda/Drizzle/libdrizzle/ --with-debug</p><p>make -j2<br />make install<br />make test #this one is optional

If all goes well, drizzle will compile and build, get installed, and output the (hopefully !) Passing test results. The output at the end shoshould be similar to the following:

MySQL Version 7.0.0Using dynamic switching of binlog formatUsing MTR_BUILD_THREAD      = 0Using MASTER_MYPORT         = 9306Using MASTER_MYPORT1        = 9307Using SLAVE_MYPORT          = 9308Using SLAVE_MYPORT1         = 9309Using SLAVE_MYPORT2         = 9310Killing Possible Leftover ProcessesRemoving Stale FilesCreating DirectoriesSaving snapshot of installed databases=======================================================TEST                           RESULT         TIME (ms)-------------------------------------------------------main.lock_tables_lost_commit   [ pass ]             15main.information_schema        [ pass ]           2132main.alter_table               [ pass ]           1066main.delete                    [ pass ]            253main.distinct                  [ pass ]            345main.insert                    [ pass ]           1246main.join                      [ pass ]            491main.join_crash                [ pass ]             25main.join_nested               [ pass ]            396main.join_outer                [ pass ]            635main.join_outer_innodb         [ pass ]             16main.lock                      [ pass ]             93main.mysqlslap                 [ pass ]          19564main.select                    [ pass ]           7198main.subselect                 [ pass ]          12230main.subselect3                [ pass ]            379main.subselect_innodb          [ pass ]            174main.type_newdecimal           [ pass ]            413main.update                    [ pass ]            536-------------------------------------------------------Stopping All ServersAll 19 tests were successful.The servers were restarted 3 timesSpent 47.207 of 62 seconds executing testcases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.