One of the things I always wanted to try since I was forced into DBA work was to connect Perl with Informix and use my currently favorite language to monitor and automate tedious tasks.

But up until now I’ve had the worst luck when attempting to install either DBI or DBD::Informix. For a long time, it was mostly due to the fact that I wasn’t allowed to connect our production servers to the net to automatically download and install the necessary modules. This because “security” reasons. My bosses distrusted anything coming from the net, so my solaris/sparc boxes couldn’t connect to CPAN.

Therefore, I had to manually download tarballs from the aforementioned site and use the “manual” installation method:

perl Makefile.PL
make
make test
make install

This would work, as long as the installation of the module didnt involve any compiling (XS). That has always given me lots of troubles (which I find embarrassing, since I used to consider myself a good C programmer).

Anyway, i’m giving the whole thing Yet Another Try, and I’ll describe my progress and any blocks I found in the way.

The installation of DBI doesn’t cause me too much trouble. The box has gcc installed and when the make complains about flags the linker doesn’t understand I just remove them and run make again (ildoff, KPIC, arch=v8…if I remember correctly). It works (at least the perl -e “use DBI” test doesn’t complain).

So now I try to install DBD::Informix and this is what I get:

$ perl Makefile.PL
*** ExtUtils::AutoInstall version 0.63
*** Checking for dependencies…
[Core Features]
– DBI …loaded. (1.601 >= 1.38)
[High Resolution Timing]
– Time::HiRes …loaded. (1.59)
[POD Format Testing]
– Test::Pod …missing.
==> Auto-install the 1 optional module(s) from CPAN? [y] n
*** ExtUtils::AutoInstall configuration finished.

Configuring IBM Informix Database Driver for Perl DBI Version 2007.0914 (2007-09-14) (aka DBD::Informix)
You are using DBI version 1.601 and Perl version 5.008004
Remember to actually read the README file!

Perl: perl v5.008004 sun4-solaris-64int dl_dlopen.xs
System: sunos localhost 5.10 sun4u sparc SUNW,Ultra-2
*** Ideally, you should upgrade to Perl version 5.008008 or later.

Using INFORMIXDIR=/informix_10 and ESQL/C compiler esql
Using IBM Informix CSDK Version 2.90, IBM Informix-ESQL Version 2.90.UC3 from /informix_10
Note that bug RT#13708 (IBM CQ bug idsdb00139040) may affect you.
In particular, if test t/t93lvarchar.t detects problems, consider an
upgrade to CSDK 3.00 or later – it seems to be fixed there. All
other parts of DBD::Informix will probably work.

Beware: DBD::Informix is not yet aware of all the new IUS data types.

Assert macro will be disabled!

lib/DBD/Informix/Defaults.pm written OK
esqlinfo.h written OK

Testing whether your Informix test environment will work…
gcc: language arch=v8 not recognized
gcc: esqltest.c: linker input file unused because linking not done
gcc: language arch=v8 not recognized
gcc: esqlc_v6.c: linker input file unused because linking not done
gcc: esqltest.o: No such file or directory
gcc: esqlc_v6.o: No such file or directory
Failed to link test program esqltest

When you execute the perl Makefile.PL instruction, its seems to skip the part when the script stops after creating the Makefile. This normally gives me a chance to edit said file and change flags that the gcc compiler (or linker) wouldnt understand. But this scipt appears to go directly to trying to compile the C files. So NOW I go and peruse the README file. It says you’re not supposed to edit the Makefile, but the Makefile.PL instead. Geeeeez!! I’ve been avoiding Makefiles altogether whenever possible and now I have to understand Perl code that generates ’em.

So I call my friend Google and together find some bits and pieces of information. It seems that to remove complains from the compiler when finding unsuitable flags, you have to setup different environment variables that the esqlld script (which is one of the files that came in the DBD::Informix tarball) will use. You define the DBD_INFORMIX_ESQLLD_REPLACE_OPTIONS_REGEX environment variable with a regex that removes the -arch=v8 that gets generated by default when you run the Makefile.PL script.

I now try several combinations of the regex posted as sample value for the environment variable in the koders.com page, but nothing seems to work. It seems strange that it doesnt even give me an error message so I modify the the esqlld code so it spits something out to the standard output when a substitution is made but I get nothing. Same messages as above.