Difference between revisions of "OpenDBX/Setup/Unix-like/Building from source"

From Linuxnetworks
Jump to: navigation, search
(.deb packages)
(installing packages)
Line 123: Line 123:
  
 
The files from the .deb and .rpm packages are installed to /usr/lib, /usr/lib/opendbx and /usr/include by using the package manager tools.
 
The files from the .deb and .rpm packages are installed to /usr/lib, /usr/lib/opendbx and /usr/include by using the package manager tools.
 +
You have to install the main library and at least one backend at once because there's a circular dependency: The main library depends on a backend and the backends depend on main library. To get around this, specify both packages in the list of packages to be installed, e.g.
 +
 +
dpkg -i libopendbx1_x.y.z*.deb libopendbx1-mysql_x.y.z*.deb
 +
 +
rpm -i libopendbx1_x.y.z*.rpm libopendbx1-pgsql_x.y.z*.rpm
  
  
 
----
 
----
 
Back to [[OpenDBX|Overview]]
 
Back to [[OpenDBX|Overview]]

Revision as of 10:14, 1 February 2008

Logo-opendbx.png

Compilation

Please get the latest version from the download page first.

The compilation itself is a rather easy task. All you need is a standard ANSI C compiler like gcc (tested with 2.95 and above), the make tool and a shell which can execute scripts generated by autoconf/automake.

Calling ./configure in the opendbx directory without arguments only generates Makefiles for the OpenDBX library itself, which isn't useful on its own. You have to tell the script to also create Makefiles for one or more backends. This is done by appending the --with-backends parameter and specifying the backends you want to build:

./configure --with-backends="mysql pgsql sqlite3"

would create Makefiles for the MySQL, PostgreSQL and SQLite3 backends. Possible database identifiers for the --with-backends option are:

  • firebird (Firebird/Interbase)
  • mssql (MS SQL Server)
  • mysql (MySQL server)
  • oracle (Oracle version 8 or higher)
  • pgsql (PostgreSQL)
  • sqlite (SQLite library version 2)
  • sqlite3 (SQLite library version 3)
  • sybase (Sybase ASE)

If the header files are not installed in /usr/include/, you have to give ./configure some hints where to find them:

CPPFLAGS="-I/usr/include/mysql" ./configure --with-backends="mysql"

will additionally look for the MySQL header files in /usr/include/mysql. The same (also in combination with CPPFLAGS) can be used for library paths. Some distributions install the MySQL libraries in /usr/lib/mysql for example:

LDFLAGS="-L/usr/lib/mysql" ./configure --with-backends="mysql"

Calling "./configure --help" tells you what parameters are allowed and how to use them. If something is missing, ./configure will tell you what it is. In the end you have to call "make" in the package directory to actually compile the source code:

tar xfvz opendbx-x.y-z.tar.gz
cd opendbx-x.y.z
./configure --with-backends="mysql"
make

A complete example compiling more than one backend with require both CPPFLAGS and LDFLAGS for non-standard file locations would be:

CPPFLAGS="-I/usr/include/postgresql -I/usr/include/mysql" \
LDFLAGS="-L/usr/lib/postgresql -L/usr/lib/mysql" \
./configure --with-backends="pgsql mysql"

The necessary files for certain backends might be available at different locations in some distributions. Below are the ./configure calls for the major distributions if they differ from the default.

Debian/Ubuntu

CPPFLAGS="-I/usr/include/mysql" \
LDFLAGS="-L/usr/lib/mysql" \
./configure --with-backends="mysql"
CPPFLAGS="-I/usr/include/postgresql" \
LDFLAGS="-L/usr/lib/postgresql" \
./configure --with-backends="pgsql"

Fedora/RHEL

CPPFLAGS="-I/usr/include/mysql" \
LDFLAGS="-L/usr/lib/mysql" \
./configure --with-backends="mysql"

Mandriva

CPPFLAGS="-I/usr/include/mysql" \
./configure --with-backends="mysql"
CPPFLAGS="-I/usr/include/pgsql" \
./configure --with-backends="pgsql"

SuSE

CPPFLAGS="-I/usr/include/mysql" \
LDFLAGS="-L/usr/lib/mysql" \
./configure --with-backends="mysql"
CPPFLAGS="-I/usr/include/pgsql" \
./configure --with-backends="pgsql"

Building packages

.deb packages

Compiling and building packages for Debian-like distributions is simple if you want to build all backends and it prevents messing up your system. Make sure you have a few required packages installed:

  • fakeroot
  • debhelper
  • docbook2x

Yo can do this by using the apt-get utility:

apt-get install fakeroot debhelper docbook2x

After these requriements are met, unpack the .tar.gz, change into this directory and build the .deb packages:

fakeroot debian/rules binary

If you want to build only one or a few backends you have to modify the debian/rules file inside the OpenDBX .tar.gz file. The line

backends := firebird mssql mysql pgsql sqlite sqlite3 sybase

contains the backends which should be build and for which the development packages must be available.

.rpm packages

It's similar for rpm based distributions. There is a spec file inside the .tar.gz, which build the complete package automatically (be sure, you have installed all necessary libraries and header files):

rpm -ta opendbx-x.y.z.tar.gz

or with the newer command:

rpmbuild -ta opendbx-x.y.z.tar.gz

By default only the mysql, pgsql and sqlite3 backend is included when building rpm packages. The defaults can be overwritten via command line by adding "--with <backend>" or "--without <backend>", e.g.

rpmbuild -ta opendbx-x.y.z.tar.gz --with sqlite --without pgsql

Installation

Installation from source is done by executing "make install" in the package directory. This will copy the libraries to /usr/local/lib and /usr/local/lib/opendbx and the header file to /usr/local/include. If you want to install them somewhere else, execute ./configure with --prefix or its related parameters. Please keep in mind that the files in /usr/local/lib/ are usually not found by the linker if the directory isn't listed in /etc/ld.so.conf.

The files from the .deb and .rpm packages are installed to /usr/lib, /usr/lib/opendbx and /usr/include by using the package manager tools. You have to install the main library and at least one backend at once because there's a circular dependency: The main library depends on a backend and the backends depend on main library. To get around this, specify both packages in the list of packages to be installed, e.g.

dpkg -i libopendbx1_x.y.z*.deb libopendbx1-mysql_x.y.z*.deb
rpm -i libopendbx1_x.y.z*.rpm libopendbx1-pgsql_x.y.z*.rpm



Back to Overview