~jan-kneschke/mysql-proxy/packet-tracking-assertions

« back to all changes in this revision

Viewing changes to trunk/INSTALL

  • Committer: Kay Roepke
  • Author(s): Jan Kneschke
  • Date: 2008-01-23 22:00:28 UTC
  • Revision ID: kay@mysql.com-20080123220028-hq2xqb69apa75fnx
first round on mysql-shell based on the proxy code

this is mostly a verification if the proxy-code is flexible enough to handle 
all three scenarios of: client, server and forwarding (proxy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Installation Instructions
2
2
*************************
3
3
 
4
 
 
5
 
 
6
 
Installing from Bazaar
7
 
======================
8
 
 
9
 
Get the latest source from:
10
 
 
11
 
  $ bzr branch lp:mysql-proxy
 
4
Copyright (C) 2007 MySQL AB
 
5
 
 
6
Installing from SVN
 
7
===================
 
8
 
 
9
Get the SVN source from:
 
10
 
 
11
  $ svn co http://svn.mysql.com/svnpublic/mysql-proxy/ mysql-proxy
12
12
 
13
13
Later you can update the tree by running
14
14
 
15
15
  $ cd mysql-proxy/
16
 
  $ bzr pull
 
16
  $ svn up
17
17
 
18
 
As you built from BZR none of the configure scripts is prepared. You need:
 
18
As you built from SVN none of the configure scripts is prepared. You need:
19
19
 
20
20
- autoconf 2.56 or higher
21
21
- automake 1.9 or higher
22
 
- libtool 1.5.x (not higher)
23
22
- flex 
24
23
 
25
24
to generate the configure script. Use the provided autogen.sh to rebuild 
38
37
/usr/local/share/aclocal. Setting ACLOCAL_FLAGS to get a include directory makes aclocal
39
38
aware of the new location.
40
39
 
41
 
  $ ACLOCAL_FLAGS="-I /opt/local/share/aclocal"
 
40
  $ ACLOCAL_FLAGS="-I /sw/share/aclocal/"
42
41
  $ export ACLOCAL_FLAGS
43
42
  $ sh ./autogen.sh
44
43
 
45
 
if using fink probably: ACLOCAL_FLAGS="-I /sw/share/aclocal"
46
 
 
47
 
 
48
44
Installing from Source 
49
45
======================
50
46
 
57
53
As you have the source in the right place and the configure script exists, you have 
58
54
to make sure that the dependencies are in place;
59
55
 
60
 
- libevent 1.4 or higher
 
56
- libevent 1.x or higher (1.3b or later is prefered)
61
57
- lua 5.1.x or higher
62
 
- glib2 2.16.0 or higher
 
58
- glib2 2.6.0 or higher
63
59
- pkg-config 
64
60
- mysql 5.0.x or higher developer files
65
61
- Ensure $MYSQL_HOME/bin is in the PATH  (mysql_config required)
132
128
If you are using darwin-ports pkg-config might not be able to see the glib-2.0.pc in 
133
129
/opt/local/lib/pkgconfig.
134
130
 
135
 
  $ ./configure PKG_CONFIG_PATH=/opt/local/lib/pkgconfig \
136
 
                LDFLAGS=-L/opt/local/lib \
137
 
                CPPFLAGS=-I/opt/local/include
 
131
  $ PKG_CONFIG_PATH="/opt/local/lib/pkgconfig" \
 
132
      ./configure
138
133
 
139
134
openSUSE
140
135
--------
155
150
The binary will be installed in /usr/sbin/mysql-proxy, the example lua scripts
156
151
are placed into /usr/share/doc/packages/mysql-proxy
157
152
 
158
 
Windows
159
 
-------
160
 
Prerequisites:
161
 
Visual C++ 2008 Express  -  http://www.microsoft.com/express/vc/ (free download, but needs free registration to use for more than 30 days)
162
 
bzr (if using Launchpad) -  http://bazaar-vcs.org/Download
163
 
MySQL Server (>5.0)      -  http://dev.mysql.com/downloads/ (5.1 recommended)
164
 
7-Zip                    -  http://www.7-zip.org/ (to open tar.gz files)
165
 
CMake (2.6)              -  http://www.cmake.org/files/v2.6/cmake-2.6.4-win32-x86.exe
166
 
GLib2 (>=2.16)           -  http://www.gtk.org/download-windows.html you need both the "bin" and "dev" binary packages
167
 
libevent (1.4.11)        -  source only: http://monkey.org/~provos/libevent/ (you need the exact version!)
168
 
Lua (>=5.1.4)            -  source only: http://www.lua.org/download.html
169
 
Flex                     -  binary only: http://gnuwin32.sourceforge.net/packages/flex.htm
170
 
 
171
 
Compiling MySQL Proxy on Windows is a bit more involved, mostly because it has some dependencies that are unusual for
172
 
native Windows and unlike on Linux, Windows does not have a package manager like rpm or apt.
173
 
We do not use cygwin to avoid forcing users to install a complete Cygwin environment, even though Cygwin would make
174
 
most of this straightforward.
175
 
However, for all dependencies we need, with the exception of libevent, there are binary packages with DLLs available.
176
 
Libevent must be compiled as a DLL, but MySQL Proxy comes with the patches and CMake files to transparently do so.
177
 
 
178
 
After downloading all the packages from above install both Visual C++ 2008 Express, bzr, 7-Zip, CMake and MySQL Server
179
 
as any other Windows application that comes with an installer.
180
 
Attention: For the MySQL Server be sure to also install the "Developer Components".
181
 
You only need to install the "C Include Files/Lib Files".
182
 
It helps if you make sure to let the installers add their respective programs to the PATH variable, this makes dealing
183
 
with them on the command line easier.
184
 
 
185
 
Next, choose a directory where you will build MySQL Proxy and extract the dependencies to. A short path without spaces
186
 
is preferred because it makes it easier to enter the paths when running CMake (this example will use c:\work).
187
 
 
188
 
If you have downloaded the source package of MySQL Proxy, extract it to c:\work. If you are using the latest sources from
189
 
Launchpad, you can use the Windows Explorer with the TortoiseBzr plugin to branch the sources to c:\work.
190
 
This example will assume the MySQL Proxy sources are in c:\work\mysql-proxy.
191
 
 
192
 
Extract Flex, the two GLib2 packages and Lua to c:\work.
193
 
Note: Some files in the "dev" and "bin" GLib2 packages are identical, simply let 7-Zip overwrite them. The two packages are
194
 
necessary because one contains the .lib files and the other contains the DLLs we need at runtime (they get copied into the
195
 
installer package).
196
 
 
197
 
At this point your folder structure in c:\work should look like this (omitting the subdirectories for brevity):
198
 
c:\work\
199
 
    flex\
200
 
    glib\
201
 
    lua-5.1.14\
202
 
    mysql-proxy\
203
 
 
204
 
Since the Windows binaries available for Lua 5.1 are using a different version of Microsoft's C runtime dlls, we need to compile
205
 
it ourselves. In order to make it work for MySQL Proxy, we need to add two compiler flags to the .bat file Lua provides for
206
 
compiling with Visual Studio.
207
 
In the file etc\luavs.bat, edit this line:
208
 
@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
209
 
to:
210
 
@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE /D_BIND_TO_CURRENT_MFC_VERSION=1 /D_BIND_TO_CURRENT_CRT_VERSION=1
211
 
 
212
 
Then go to the Lua source directory and run the .bat file:
213
 
cd c:\work\lua-5.1.4
214
 
etc\luavs.bat
215
 
 
216
 
The resulting src\lua51.dll is now linked to the correct runtime DLL and can be used with MySQL Proxy.
217
 
 
218
 
Note that we have not extracted libevent yet. Since we will be building libevent from source with our DLL patches applied,
219
 
we extract libevent into a subdirectory of the MySQL Proxy sources. Using 7-Zip extract the folder libevent-1.4.11-stable into:
220
 
    c:\work\mysql-proxy\deps\
221
 
Attention: When extracting libevent be sure to extract the folder, not the .tar file inside the .tar.gz archive (when opening
222
 
libevent-1.4.11-stable.tar.gz 7-Zip will only follow the .gz part, double click on the libevent-1.4.11-stable.tar inside 7-Zip
223
 
to be able to extract the folder, not the .tar archive!)
224
 
At this point c:\work\mysql-proxy\deps\libevent-1.4.11-stable should be a folder containing source files.
225
 
 
226
 
In a command line window, cd to c:\work\mysql-proxy.
227
 
We recommend performing an out-of-source build, i.e. executing CMake from a different directory than were the sources are,
228
 
because that makes it easy to throw away everything that was not part of the source archive - invaluable when fixing with build errors.
229
 
 
230
 
Create a directory called "build":
231
 
    mkdir build
232
 
    cd build
233
 
 
234
 
Inside the directory c:\work\mysql-proxy\build execute the following CMake command line (you may have to enable word wrapping in the program
235
 
you use to read this since it's all on one line to avoid problems with copy/pasting the command):
236
 
 
237
 
cmake -G "Visual Studio 9 2008" -DFLEX_EXECUTABLE=c:\work\flex\bin\flex -DMYSQL_INCLUDE_DIRS="c:\Program Files\MySQL\MySQL Server 5.1\include" -DGLIB_DEV_BASE_DIR=c:\work\glib -DLUA_INCLUDE_DIRS=c:\work\lua-5.1.4\src -DLUA_LIBRARY_DIRS=c:\work\lua-5.1.4\src -DCMAKE_INSTALL_PREFIX=c:\work\install -DCMAKE_BUILD_TYPE=Release ..
238
 
 
239
 
This command should end with a line like this:
240
 
 
241
 
Now we can actually compile MySQL Proxy:
242
 
You can either open the Visual C++ IDE and open the mysql-proxy.sln Solution file in c:\work\mysql-proxy\build and build the solution, or
243
 
use the vcbuild command from the command line. Both do the same thing.
244
 
If you want to use the binaries on a different machine than where you compiled them on, be sure to build using the "Release" configuration!
245
 
In the IDE there is a dropdown that let's you select it, or from the command line do:
246
 
cd c:\work\mysql-proxy\build
247
 
vcbuild mysql-proxy.sln "Release|Win32"
248
 
At this point, there will be lots of warnings during the compilation, but you can safely ignore them. However there should be no errors.
249
 
 
250
 
The build should end in a line like:
251
 
Build complete: 88 Projects succeeded, 0 Projects failed, 28 Projects skipped
252
 
 
253
 
You cannot easily run MySQL Proxy from its build directory, because it will not find the necessary DLLs. To produce a ZIP file you can use
254
 
to "install" MySQL Proxy use CPack (part of CMake):
255
 
 
256
 
    cpack -G ZIP
257
 
(Note: CPack also supports NSIS installers, so if you have NSIS installed you can use cpack -G NSIS)
258
 
It will produce a ZIP file named like "mysql-proxy-0.7.2-win32.zip" in the directory c:\work\mysql-proxy\build.
259
 
Simply extract this ZIP file to whereever you want to install MySQL Proxy. Inside the new directory there will be the familiar
260
 
bin\mysql-proxy.exe command.
261
 
Verify that it works by running:
262
 
bin\mysql-proxy --help-all
263
 
 
264
 
Whew that's it, we are done :)
265
153
 
266
154
All other Platforms
267
155
-------------------
285
172
    LDFLAGS="-L/directory/of/libevent.so -levent" \
286
173
    CPPFLAGS="-I/directory/of/event.h"
287
174
 
288
 
In case the detected MySQL is not the correct one:
289
 
 
290
 
export DEFAULT_MYSQL=/path/to/mysql-5.1
291
 
export MYSQL_LIBS="-L${DEFAULT_MYSQL} -lmysqlclient -lz -lm"
292
 
export MYSQL_CFLAGS="-I${DEFAULT_MYSQL}/include"
293
 
export MYSQL_CONFIG="${DEFAULT_MYSQL}/bin/mysql_config"
294
 
export MYSQL_TEST_BIN="${DEFAULT_MYSQL}/bin/mysqltest"
295
 
 
296
 
 
297
175
Building
298
176
========
299
177
 
302
180
 
303
181
You should have a /usr/local/sbin/mysql-proxy now.
304
182
 
305
 
Documentation
306
 
=============
307
 
 
308
 
MySQL Proxy uses doxygen for its documentation. In order to make the best use out of the documentation, you
309
 
need to have these packages installed (and in your path):
310
 
 
311
 
 - Doxygen: http://doxygen.org
312
 
 - Graphviz: http://graphviz.org
313
 
 - MSCGen: http://www.mcternan.me.uk/mscgen/
314
 
 
315
 
All of these programs are available for various popular platforms.
316
 
 
317
 
After installing these programs, generating the documentation is as simple as:
318
 
 
319
 
  $ make docs
320
 
or
321
 
  $ make docs-bzr
322
 
 
323
 
The latter command produces the same documentation as the first one, the only difference is that it will include more detailed
324
 
information about the version the documentation was generated from, which is useful if you work with the source from Launchpad
325
 
directly: The documentation's version number will include the revision number and the date of the last commit in your tree.
326
 
 
327
 
MySQL Proxy's documentation is generated as HTML output in the doxygen/html/ directory.
 
183