Subject instructions for building interbase on redhat 6.2
Author Mark O'Donohue
1. Introduction

This is how I put together the build for redhat linux 6.2.  It is not entirely complete, but the missing bits are not essential,

Some of this needs some feedback to work out the best way to do things, and obviously modification of the make file /configure system would be the best way to fix it.

So as a first cut at a compile document, here it is:...

Any mistakes, and there are likely to be many are all mine...
 

Regards

Mark
 

2. What you need

    InterBaseSS_LI-V6.0.tar       - you need one running to build a new one.
    ib60src.tar.gz                             - from Borland.
    codes.tgz                                     - from www.interbase.com.
 

    I think most of the source is now mirrored in CVS on:
                -d :pserver:anonymous@...:/repository

                UserName : anonymous
                Password : interbase

    You do NOT need the marion tool in ib_tools_src.tar.gz.

3.  Installing superserver interbase
 

Create an install directory and put download in it
    $mkdir /tmp/install
    $cp InterBaseSS_LI-V6.0.tar /tmp/install
    $cd /tmp/install
    $tar -xvf InterBaseSS_LI-V6.0.tar
This results in two files (InterBaseSS_LI-V6.0.tgz, install) in the current directory.  To do the install to /opt/interbase do the following.  I did this as root user
    $./install -s /tmp/install/InterBaseSS_LI-V6.0.tgz
The other options to install is -c which installs a classic interbase.  You need the full path to the .tgz file.  Also in the beta6.0 documentation it explains how to set it up as user 'interbase'.

I also tried to install it to /usr/local/interbase but that didn't work for two reasons 1. the error message db was stll expected from /opt/interbase/messages.gdb and 2. in was at nfs drive and when i ran the server it keep trying to connect to a server running on the machine that had the nfs drive.  Soo stay with /opt and make sure its a local drive.

Now to start the server

    $cd /opt/interbase/bin
    $./ibmgr -start -user SYSDBA -password masterkey
You should get some pleasant messages.  Then try it against one of the  test database.
    $/opt/interbase/bin
    $./isql  -user SYSDBA -password masterkey
    SQL>connect /opt/interbase/examples/employee.gdb;
    SQL>show tables;
    SQL>
 

3.  Extracting the source and setup

    $mkdir /tmp/build
    $cp ib60src.tar.gz  codes.tgz /tmp/build
     $cd /tmp/build

    $tar -xzvf  ib60src.tar.gz

This creates a subdirectory InterBase with most of the source code.
Now have a look through the file
"InterBase/builds/original/000_readme"
Some of this document will be a straight copy from there, also have a look at:
http://www.interbase2000.org/highlevelsource.htm
for an overview of the source directories.
     $mkdir codes
    $cd codes
     $tar -xzvf ../codes.tgz
This creates some of the build stuff that got missed, backup of msg.gdb and some .h files.  We'll move them into the appropriate spot into the source later.


    $cd InterBase

Some of the following scripts required that the current directory is in the path.  Mine wasn't so:
     $PATH=.:$PATH
     $export PATH

The file ./build_kit is the one that looks like it is supposed to run, but it has some problems.  Fortunatly it is only 5 lines of code.  So we do it manually.

     $cd builds/original
     $echo "DEV" > .version_flag      # or PROD if you feel lucky.
     $chmod ug+x platform
     $chmod ug+x edit_make

     $ln -s /tmp/build/InterBase source

     $./platform LINUX

Then build the directories and link corrent makefiles
      $cd ../..              # back to /tmp/build/InterBase
      $chmod ug+x setup_dirs
      $./setup_dirs LINUX DEV /tmp/build/InterBase
Make sure that the PROD or DEV matches what you typed in previously.

You get the following errors:
ln: cannot create symbolic link `register/source' to `..': No such file or directory
ln: builds/original/source/..: cannot overwrite directory

The register subdirectory looks like a subproject that has been removed, and the builds/original is the one we have already put in.

It looks a bit like the two scripts should be run in the reverse order, but running setup_dirs first had some other problems.
 

Now make the destination directories (in /tmp/build/InterBase).

    $mkdir -p interbase/bin
    $mkdir -p interbase/help
    $mkdir -p interbase/UDF
    $mkdir -p interbase/examples/v5
    $mkdir -p interbase/include
    $mkdir -p interbase/lib
 

Now populate the static interbase files (and ones needed to bootstrap the build) from the binary install version.

    $cd /tmp/build/InterBase
    $cp /opt/interbase/bin/gpre  interbase/bin/
    $cp /opt/interbase/messages.msg interbase/
    $cp /opt/interbase/isc4.gdb interbase/

(In the 000_readme file it mentions copying gds.a as well, The gds.a in linux has been installed in /usr/lib - but I found I didn't need to copy it

I also ignored the next step running refresh.all as that just makes sure the latest versions have been collected from the 'marion' source control system - so is not needed here).
 
 

4.  Install missing databases/header files
Somewhere the install script it has built recursive symbolic links for some of the databases.

Fix these by putting in real databases for isc.gdb, yachts.gdb and msg.gdb, help.gdb.  Please remember to do the remove (rm xxx.gdb) step otherwise you can get some errors in gpre as it tries to endlessly chase the recursrive link.

Copy isc.gdb from binary install.

      $cd /tmp/build/InterBase
      $cd jrd
      $rm isc.gdb
      $cp /opt/interbase/isc4.gdb isc.gdb
 
Copy help.gdb from binary install (This is in the binary dist. but Im not sure of the licence, I heard somewhere that this one was not "free").
      $cd /tmp/build/InterBase
      $cd qli
      $rm help.gdb
      $cp /opt/interbase/help/help.gdb help.gdb
 
Build yachts.gdb from metadata.sql  win32s build (the file wasn't in the unix build)
      $/opt/interbase/bin/isql -i ../builds_win32/original/metadata.sql
      $rm yachts.gdb
      $ln -s ../metadata.gdb yachts.gdb

        Expect the error:

Use CONNECT or CREATE DATABASE to specify a database
Statement failed, SQLCODE = -902
I/O error for file "/tmp/build/InterBase/metadata.gdb"
-Error while trying to open file
-No such file or directory
Is OK, it's just trying to delete the database before creating a new one.
 

Create the msg database from the backup in the extra "codes" package (see step 1).

    $cd /tmp/build/Interbase/
    $cd msgs
    $rm msg.gdb
    $/opt/interbase/bin/gbak -C /tmp/build/codes/msg.gbak msg.gdb
 

5.  Missing header files

The build originally build some header files, using a program in the isc/apps directory.  These have been provided in the codes.tgz file.  Here we edit the make file to replace the build with a copy from the new directory.

There are two places one for the classic server one for the super server.

    $vi make_kit
Change

# Run the codes program, thus generating codes.h, iberror.h, etc
# compare and copy the file only if the files are different
run_codes:      force $(CODES)
       $(SH) '$(CD) source/jrd; $(CODES)'
       $(SH) '$(CMP) source/jrd/iberror.h $(INCLUDE_ ........

To the following:

# Run the codes program, thus generating codes.h, iberror.h, etc
# compare and copy the file only if the files are different
run_codes:      force $(CODES)
        $(CP) ../codes/*.h jrd
#       $(SH) '$(CD) source/jrd; $(CODES)'
         $(SH) '$(CMP) source/jrd/iberror.h $(INCLUDE_ ........
 
 


        And similarly for the supersever (in the same make_kit file) Change:

# Run the codes program (for SUPERSERVER hierarchy),
# thus generating codes.h, iberror.h, etc
s_run_codes:    force $(CODES)
        $(QUIET_ECHO) "Running codes in super ..."
        $(SH) '$(CD) source/super/jrd; $(CODES)'

To the following:

# Run the codes program (for SUPERSERVER hierarchy),
# thus generating codes.h, iberror.h, etc
s_run_codes:    force $(CODES)
        $(QUIET_ECHO) "Running codes in super ..."
        $(CP) ../codes/*.h source/super/jrd
#        $(SH) '$(CD) source/super/jrd; $(CODES)'
6.  Remove PYXIS from make
The pyxis is a vt100 forms package, the compile gets pretty close, but fails to compile the edit.e file.  This broke somewhere between V5.4 and V6.0 in gpre (and seems to be about " verses ' .  If you are really keen then you can use 5.6 to compile it.
If you want to do this you also have to update the forms.gdb database to point to ../metadata.gdb as it is also a recusive linked file.

This subproject is also not used on the NT version.  I describe here how to simply comment the module out and stop it being compiled.

There are two files to edit the first  make_kit in the root directory.

$cd /tmp/build/InterBase
$vi make_kit

Remove all the dependancies by finding the following text:
#GDS_PYXIS=             gds_pyxis.a

And change it to:
GDS_PYXIS=
#GDS_PYXIS=             gds_pyxis.a
 

Also find the following:
PYXIS=                 pyxis
PYXIS_MISC_OBJS=       $(PYXIS_MISC)
PYXIS_P_MISC_OBJS=     $(PYXIS_P_MISC)
PYXIS_OBJECTS=         pyxis_objects
PYXIS_MISC_OBJECTS=    $(PYXDIR)cdm.o $(PYXDIR)vt100.o

And change it to:
PYXIS=
PYXIS_MISC_OBJS=
PYXIS_P_MISC_OBJS=
PYXIS_OBJECTS=
PYXIS_MISC_OBJECTS=
#PYXIS=                 pyxis
#PYXIS_MISC_OBJS=       $(PYXIS_MISC)
#PYXIS_P_MISC_OBJS=     $(PYXIS_P_MISC)
#PYXIS_OBJECTS=         pyxis_objects
#PYXIS_MISC_OBJECTS=    $(PYXDIR)cdm.o $(PYXDIR)vt100.o

Now remove the build of the module, Find the following:
executables:    alice burp dudley gpre install $(INTL) isql locks \
        $(SUPER_SERVER) pyxis qli remote spit utilities \
        $(SHARED_AM) $(LINKABLE_LIBS)

And change it to (note the pyxis text has been removed) :
executables:    alice burp dudley gpre install $(INTL) isql locks \
        $(SUPER_SERVER) qli remote spit utilities \
        $(SHARED_AM) $(LINKABLE_LIBS)
 

Now save the make_kit file and go to the second to edit.

The second file to edit is makefile in the root/jrd directory.

$cd /tmp/build/InterBase
$cd jrd
$vi makefile
 

The first two changes are identical to the one we did in the previous file, find the text:
#GDS_PYXIS=             gds_pyxis.a

And change it to:
GDS_PYXIS=
#GDS_PYXIS=             gds_pyxis.a
 

Also find the following:
PYXIS=                 pyxis
PYXIS_MISC_OBJS=       $(PYXIS_MISC)
PYXIS_P_MISC_OBJS=     $(PYXIS_P_MISC)
PYXIS_OBJECTS=         pyxis_objects
PYXIS_MISC_OBJECTS=    $(PYXDIR)cdm.o $(PYXDIR)vt100.o

And change it to:
PYXIS=
PYXIS_MISC_OBJS=
PYXIS_P_MISC_OBJS=
PYXIS_OBJECTS=
PYXIS_MISC_OBJECTS=
#PYXIS=                 pyxis
#PYXIS_MISC_OBJS=       $(PYXIS_MISC)
#PYXIS_P_MISC_OBJS=     $(PYXIS_P_MISC)
#PYXIS_OBJECTS=         pyxis_objects
#PYXIS_MISC_OBJECTS=    $(PYXDIR)cdm.o $(PYXDIR)vt100.o
 

In addition we need to make the following changes: Find the text:
PYXDIR=                source/pyxis/
PYXIS_MISC=    source/pyxis/allp.o source/pyxis/altp.o \
                source/pyxis/scr.o source/pyxis/debug.o \
                source/pyxis/edit.o source/pyxis/menu.o \
                source/pyxis/movp.o source/pyxis/phase2.o \
                source/pyxis/phase3.o source/pyxis/picstr.o \
                source/pyxis/pyxis.o source/pyxis/save.o \
                $(PYXIS_MISC_OBJECTS)

PYXIS_P_MISC=  source/pyxis/allp.bin source/pyxis/altp.bin \
                source/pyxis/cdm.bin source/pyxis/debug.bin \
                source/pyxis/edit.bin source/pyxis/menu.bin \
                source/pyxis/movp.bin source/pyxis/phase2.bin \
                source/pyxis/phase3.bin source/pyxis/picstr.bin \
                source/pyxis/pyxis.bin source/pyxis/save.bin \
                source/pyxis/scr.bin source/pyxis/vt100.bin

And change it to :
PYXDIR=
PYXIS_MISC=
PYXIS_P_MISC=
#PYXDIR=                source/pyxis/
#PYXIS_MISC=    source/pyxis/allp.o source/pyxis/altp.o \
                source/pyxis/scr.o source/pyxis/debug.o \
                source/pyxis/edit.o source/pyxis/menu.o \
                source/pyxis/movp.o source/pyxis/phase2.o \
                source/pyxis/phase3.o source/pyxis/picstr.o \
                source/pyxis/pyxis.o source/pyxis/save.o \
                $(PYXIS_MISC_OBJECTS)

#PYXIS_P_MISC=  source/pyxis/allp.bin source/pyxis/altp.bin \
                source/pyxis/cdm.bin source/pyxis/debug.bin \
                source/pyxis/edit.bin source/pyxis/menu.bin \
                source/pyxis/movp.bin source/pyxis/phase2.bin \
                source/pyxis/phase3.bin source/pyxis/picstr.bin \
                source/pyxis/pyxis.bin source/pyxis/save.bin \
                source/pyxis/scr.bin source/pyxis/vt100.bin
 

Now save the changes to the jrd/makefile file.
 
 

7.  Remove samples from make
 
The exampes do build after a bit of coercing, there is agains some recusive database linkages, and the SALARY inherent type (type 21) doesn't seem to be supported for the v3samples.  Then the v5samples use some of the v3sample code.  But for this document it is easier to leave them out.

Go back and manually have a go at them after the kit has been built.

Again we edit the make_kit file.

    $cd /tmp/build/InterBase
    $vi make_kit
 
And find the following line:
interbase:      run_codes gds.h includes executables examples help msgs msgs_intl extlib

The change it to (note the removed examples):
interbase:      run_codes gds.h includes executables help msgs msgs_intl extlib
#interbase:      run_codes gds.h includes executables examples help msgs msgs_intl extlib

    Now save the changes to the make_kit file.
 
 

8.  Finally doing some building.

We are now ready to start building the database engine.  Change to the root directory and start the build - (however you still have to do some typing yet).
    $cd /tmp/build/InterBase

    $build_kits builds SUPER
 

  - First error in compile

One error that comes out is the following (in the jrd subdirectory) :
cc -c -ggdb -DLINUX -w -fwritable-strings  -fPIC -DDEV_BUILD -o inf.bin inf.c
m4 ids.m > ids.h
relations.h:25: m4: Non-numeric argument to built-in `divert'
relations.h:26: m4: Non-numeric argument to built-in `divert'
relations.h:27: m4: Non-numeric argument to built-in `divert'
relations.h:28: m4: Non-numeric argument to built-in `divert'
relations.h:32: m4: Non-numeric argument to built-in `divert'
...
...
I had a quick look a the m4.ids.m file (its fairly simple - a 10 line m4 macro).  Hopefully someone will tell me this is ok (or how to fix it).  It didn't stop the build.
  - Second error in compile
This error comes up a few times. once in each of the modules gpre and alice and on the same file (met.e).

cc -c -ggdb -DLINUX -w -fwritable-strings  -DDEV_BUILD movg.c
source/interbase/bin/gpre -r -m -z -n met.e
gpre version LI-V6.0.0.624
lock manager error
-can't start lock manager
(E) met.e:45: Couldn't access database DB = 'yachts.lnk'
1 error, no warnings
make[1]: *** [met.c] Error 1
make[1]: Leaving directory `/tmp/build/InterBase/gpre'
make: *** [gpre] Error 2

To solve it I go to the dirctory  and manually type in the build command
     $cd /tmp/build/InterBase
     $cd gpre                                                 # or 'cd alice' or 'cd burp' as required
     $source/interbase/bin/gpre -r -m -z -n met.e  # (or  backup.e or restore.e )
 
Then restart the build again using:
     $cd /tmp/build/InterBase
     $build_kits builds SUPER
 
 

  - Possible permission problem

Depending upon when you created/who created some of your databases.  You might get the following:
sh -c 'cd source/msgs; make CFLAGS="-ggdb -DLINUX -w -fwritable-strings " SYSTEM="builds" check_messages'
make[1]: Entering directory `/tmp/build/InterBase/msgs'
source/interbase/bin/gpre -r -m -z -n check_msgs.e
gpre version LI-B6.0.0.627
lock manager: couldn't set uid to superuser
I/O error for file "msg.gdb"
-Error while trying to open file
-Permission denied
(E) check_msgs.e:56: Couldn't access database DB = 'msg.gdb'
1 error, no warnings
This is because databases seem to be created as root user if built from script (or where these ones  I copied).   Check the ownership of metadata.gdb and msg.gdb.  To solve this I just change the owner and group of the database.:  This happend to me in restoring msg.gdb using gbak and creating metadata.gdb from metadata.sql.
    $cd /tmp/build/Interbase
    $cd msgs
    $chown <yourname> msgs.gdb
    $chusr <yourgroup> msgs.gdb
 
Then restart the build again using:
     $cd /tmp/build/InterBase
     $build_kits builds SUPER
 
Also related to the above was the following message, but I haven't followed it up yet - It didn't stop the compile though.

make[1]: Leaving directory `/tmp/build/InterBase/msgs'
sh -c 'cd source/msgs; check_messages -d master_msg_db -l'
lock manager: couldn't set uid to superuser

  - Possible redundant code (or different library reqd)
The following error occurs in building the musql modules.  The build continues, and the isql one built fine.  Im not sure if this is still required, or if it is just an bad library name:
cc -c -ggdb -DLINUX -w -fwritable-strings  -DDEV_BUILD -DMU_ISQL muisql.c -o muisql.o
rm -f muisql
cc  extract.o muisql.o show.o -o muisql -Lsource/jrd -lgds -ldl -lgds_pyxis -lcrypt -lncurses -lm -L /usr/gds.`hostname | cut -d'.' -f1`/qa_tools/lib -lmu
/usr/bin/ld: cannot find -lmu
collect2: ld returned 1 exit status
make: [muisql] Error 1 (ignored)
chmod 777 muisql

However this does not stop the build - and I let it continue.

 
9.  Final stuff
 

Eventually after looking at the previous stuff and doing patches and restarting you should get through the build.

There was something about building the help database as well because I wasn't root or the interbase user.  Also I had to set the user/group on the following file:
inet_dbg.

Change the setUID program to root/interbase user (in fact should change all of them).

    $cd /tmp/build/InterBase
    $cd interbase/bin
    $su
    password:
     $chown root
 

So I would recommend building the database as either root/ or the interbase user.
 
 

9.  Testing the build
 

Some more on this will come - but it basically means shutting down the current database, and starting up the one in the

    /tmp/build/InterBase/interbase/bin

directory that has been created.
 

Then fiddling arround with some of the examples (which you will have to rescue from /tmp/build/Interbase/examples directory).
 

Good Luck....