Thursday, November 25, 2010

Compiling Firebird in Linux

Firebird is available as a precompiled binary for Linux, but it is compiled using very old software, probably to make sure that it can run in any distribution.
The software is compiled using libstdc++.so.5 while current compilers use libstdc++.so.6.

This is OK for normal use but it causes problems when my program links to the Firebird library. I just compiled a 64 bit version of a program and I had the same problems again. As usual the solution was building Firebird from source. This was not difficult but it took some time to figure out how to proceed, so this time I took notes for the future.

Here are the steps to build Firebird 2.0.x. I did not test other versions, but things should not be very different.

The following packages are required to build the software:


bison
automake1.4
libtool
libncurses5-dev


After installing the packages open a terminal window, move to the root folder of the downloaded code and enter the following commands:


./autogen.sh
./configure --prefix=/media/disco2/firebird-2.0.6-installed
make
make install


The "configure" line is needed only if you want to change the default install path, like in my example.
"make install" is needed to strip the files that otherwise would be very large.

Wednesday, November 24, 2010

Firebird embedded and KDevelop

In Linux I am using KDevelop as my development tool. Now that I set environment variables in code I had problems running the program from KDevelop. The release version can be copied to a folder with all the needed Firebird files before running it, so this is not a problem.
The problem is with the debug version, since I sometimes need to run it in the debugger to see what is going on. Now the program sets the environment variables so it cannot find Firebird and it does not work.
After some trial and error I decided that the simplest solution was to copy the Firebird embedded files to the folder where the executable is created, so that the program can find the needed files. Then, in KDevelop, I opened the Project/Project Options menu, I chose Run Options and selected Run from the directory where the executable is.

Now I can run the program in the debugger.

Monday, November 22, 2010

Firebird embedded - Linux (update)

This post contained information about creating a Linux program that uses Firebird embedded as described here.

It was a way to avoid using a shell script to set the needed environment variables before starting the program. Before posting I tested the solution in the same computer and it worked.
Unfortunately I discovered in a second time that the program does not work on other computers, so I have removed the previous content. I still need a shell script to correctly start the program.

I keep this post because it is linked from other web pages.

Sorry for posting incorrect information.