Subject Trying to compile the FreeAdhocUDF library.
Author plinehan
Hi all,


I'm trying to compile the FreeAdhoc library for Firebird 2.1.3
Classic embedded sever on Linux.

I have the database up and running and can access it using jdbc
and/or isql - create databases, tables, enter data - in short,
everything. I don't want a binary .so precompiled, because I
want to add bits and pieces to the udf library.


====================================
Libraries present on the machine

$ /lib/libc (+ TAB, TAB)

gives

libc-2.3.6.so* libc.so.6@

and gcc --version gives

gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
========================================

I cannot change these libraries or compiler for the moment.


I downloaded the code from http://freeadhocudf.org/ and
decided to start with something simple - only compiling and
using 3 of the "modules" - date/math/string stuff.

Issued the commands shown


=====================================
gcc date_functions.c -Wall -fpic -O -c -I$MY_FB/opt/firebird/include
-I$MY_FB/opt/include -o date_functions.o

compiles - no errors.

gcc math_functions.c -Wall -fpic -O -c -I$MY_FB/opt/firebird/include
-I$MY_FB/opt/include -o math_functions.o

compiles - no errors.

gcc string_functions.c -Wall -fpic -O -c -I$MY_FB/opt/firebird/include
-I$MY_FB/opt/include -o string_functions.o

compiles - no errors.

Note that I explicitly put in the directory - using the -L option.
========================================

All of these compiled with no error and produced .o files.

Then I issued the linking command

ld date_functions.o math_functions.o string_functions.o
-o FreeAdhocUDF_fb2.1.3.so -G -Bsymbolic -L$MY_FB/opt/firebird/lib
-lm -lc -L$MY_FB/opt/firebird/lib/libib_util
-L$MY_FB/opt/firebird/lib/libfbclient

Note that I use the -L flag to specify the directories.


Now, if I do

$ ls $MY_FB/opt/firebird/lib/


i.e. list the files in that directory - I get

====================================

libfbclient.so libfbclient.so.2.1.3 libfbembed.so.2.1 libib_util.so libicudata.so.30 libicui18n.so libicui18n.so.30.0 libicuuc.so.30
libfbclient.so.2 libfbembed.so libfbembed.so.2.1.3 libicudata.so libicudata.so.30.0 libicui18n.so.30 libicuuc.so libicuuc.so.30.0

====================================

and

ls $MY_FB/opt/firebird/include
ib_util.h ibase.h iberror.h perf.h

=====================================


So, I appear to have all the necessary files(?)

I then copy the created .so to the Firebird embedded
working directory as FreeAdhocUDF (no suffix).


In firebird.conf I put in

UdfAccess = Full in the relevant spot.


Then, I start isql and issue the commad

DECLARE EXTERNAL FUNCTION F_ROT13

CSTRING(254)

RETURNS CSTRING(254) FREE_IT

ENTRY_POINT 'rot13' MODULE_NAME 'FreeAdhocUDF';

This is fine.


SELECT F_ROT13(CountryName) FROM Country;

and this is what happens - it crashes out of my isql session
(and also Squirrel sessions) with the message

undefined symbol: ib_util_malloc


Can anybody help me with getting this udf up and running
on my system.


TIA and rgs.


Paul...