One of the things I always wanted to try since I was forced into DBA work was to connect Perl to Infomix with
DBD::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.091
+4 (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.U
+C3 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 doesn't 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.
So I'm now asking The Good Nuns/Monks for some help, advice, pointers, ideas or whatever helps me advance in the resolution of this. I now this is more of a linker question. But it doesn't seem too far fetched to think that some other Nun/Monk here has stumbled upon the same rock.
Best regards,
P.S: I did try anwering "yes" to the auto-install Test::Pod module and it gives me the exact same answer. The regexp I used for DBD_INFORMIX_ESQLLD_REPLACE_OPTIONS_REGEX was (basically) this:
s/^arch=v8$/-m64/
This is the output of perl -v:
$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
Platform:
osname=solaris, osvers=2.10, archname=sun4-solaris-64int
uname='sunos localhost 5.10 sun4u sparc SUNW,Ultra-2'
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultipl
+icity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xar
+ch=v8 -D_TS_ERRNO',
optimize='-xO3 -xspace -xildoff',
cppflags=''
ccversion='Sun WorkShop', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1
+6
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='of
+f_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R /usr/
+perl5/5.8.4/lib/sun4-solaris-64int/CORE'
cccdlflags='-KPIC', lddlflags='-G'
Characteristics of this binary (from libperl):
Compile-time options: USE_64_BIT_INT USE_LARGE_FILES
Locally applied patches:
22667 The optree builder was looping when constructing the ops
+ ...
22715 Upgrade to FileCache 1.04
22733 Missing copyright in the README.
22746 fix a coredump caused by rv2gv not fully converting a PV
+ ...
22755 Fix 29149 - another UTF8 cache bug hit by substr.
22774 [perl #28938] split could leave an array without ...
22775 [perl #29127] scalar delete of empty slice returned garb
+age
22776 [perl #28986] perl -e "open m" crashes Perl
22777 add test for change #22776 ("open m" crashes Perl)
22778 add test for change #22746 ([perl #29102] Crash on assig
+n ...
22781 [perl #29340] Bizarre copy of ARRAY make sure a pad op's
+ ...
22796 [perl #29346] Double warning for int(undef) and abs(unde
+f) ...
22818 BOM-marked and (BOMless) UTF-16 scripts not working
22823 [perl #29581] glob() misses a lot of matches
22827 Smoke [5.9.2] 22818 FAIL(F) MSWin32 WinXP/.Net SP1 (x86/
+1 cpu)
22830 [perl #29637] Thread creation time is hypersensitive
22831 improve hashing algorithm for ptr tables in perl_clone:
+...
22839 [perl #29790] Optimization busted: '@a = "b", sort @a' .
+..
22850 [PATCH] 'perl -v' fails if local_patches contains code s
+nippets
22852 TEST needs to ignore SCM files
22886 Pod::Find should ignore SCM files and dirs
22888 Remove redundant %SIG assignments from FileCache
23006 [perl #30509] use encoding and "eq" cause memory leak
23074 Segfault using HTML::Entities
23106 Numeric comparison operators mustn't compare addresses o
+f ...
23320 [perl #30066] Memory leak in nested shared data structur
+es ...
23321 [perl #31459] Bug in read()
SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962
Built under solaris
Compiled at Feb 13 2006 05:12:02
@INC:
/usr/perl5/5.8.4/lib/sun4-solaris-64int
/usr/perl5/5.8.4/lib
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int
/usr/perl5/site_perl/5.8.4
/usr/perl5/site_perl
/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int
/usr/perl5/vendor_perl/5.8.4
/usr/perl5/vendor_perl
.
I have IBM Informix Dynamic Server Version 10.00.FC3 running on Solaris 10/SPARC.
$ /usr/sfw/bin/gcc --version
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There i
+s NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR
+POSE.
Thanks in advance,