in reply to Problem Compiling under Solaris using DBI and DBD::DB2

I've had to install the modules i needed manually

Most likely, something went wrong in this step (i.e. during build and/or installation) — otherwise the symbol SQLAllocHandle could be resolved.

It's hard to tell what went wrong, though, without seeing what exactly you did...   (post the commands you ran, together with their output (in particular any first errors) )

  • Comment on Re: Problem Compiling under Solaris using DBI and DBD::DB2

Replies are listed 'Best First'.
Re^2: Problem Compiling under Solaris using DBI and DBD::DB2
by palaxos (Initiate) on Jan 13, 2012 at 20:55 UTC

    Thanks for your answer. I don't have all the commands i did right here, but i kept what i did for DBD::DB2.

    STEP 1: root@whms17368 > /usr/perl5/5.8.4/bin/perlgcc Makefile.PL Configuring DBD::DB2... Remember to actually read the README and CAVEATS files! Using DB2 in "/home/db2inst1" System: perl5.008004 DBI1.616 sunos localhost 5.10 sun4u sparc SUNW,Ul +tra-2 sun4-solaris-64int dl_dlopen.xs Compiler: gcc -O2 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFF +SET_BITS=64 -D_TS_ERRNO Includes: -I"/home/db2inst1/include" -I"/usr/perl5/site_perl/5.8.4/su +n4-solaris-64int/auto/DBI" -I"/usr/perl5/5.8.4/lib/sun4-solaris-64int +/auto/DBI" -I"/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DB +I" -I"/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBI" Libraries: -L/home/db2inst1/lib -ldb2 Note (probably harmless): No library found for -ldb2 Writing Makefile for DBD::DB2::Constants Writing Makefile for DBD::DB2 STEP2: root@whms17368 > make gcc -c -I"/home/db2inst1/include" -D_LARGEFILE_SOURCE -D_FILE_OFFSET +_BITS=64 -D_TS_ERRNO -O2 -fno-strict-aliasing -DVERSION=\"1.82\" +-DXS_VERSION=\"1.82\" -fPIC "-I/usr/perl5/5.8.4/lib/sun4-solaris-64in +t/CORE" Constants.c Running Mkbootstrap for DBD::DB2::Constants () chmod 644 Constants.bs rm -f ../blib/arch/auto/DBD/DB2/Constants/Constants.so LD_RUN_PATH="" gcc -G Constants.o -o ../blib/arch/auto/DBD/DB2/Const +ants/Constants.so chmod 755 ../blib/arch/auto/DBD/DB2/Constants/Constants.so cp Constants.bs ../blib/arch/auto/DBD/DB2/Constants/Constants.bs chmod 644 ../blib/arch/auto/DBD/DB2/Constants/Constants.bs gcc -c -I"/home/db2inst1/include" -I"/usr/perl5/site_perl/5.8.4/sun4- +solaris-64int/auto/DBI" -I"/usr/perl5/5.8.4/lib/sun4-solaris-64int/au +to/DBI" -I"/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DBI" +-I"/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBI" -D_LARGEF +ILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -O2 -fno-strict-aliasin +g -DVERSION=\"1.82\" -DXS_VERSION=\"1.82\" -fPIC "-I/usr/perl5/5. +8.4/lib/sun4-solaris-64int/CORE" -DDB2_CACHE_FIX DB2.c gcc -c -I"/home/db2inst1/include" -I"/usr/perl5/site_perl/5.8.4/sun4- +solaris-64int/auto/DBI" -I"/usr/perl5/5.8.4/lib/sun4-solaris-64int/au +to/DBI" -I"/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DBI" +-I"/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBI" -D_LARGEF +ILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -O2 -fno-strict-aliasin +g -DVERSION=\"1.82\" -DXS_VERSION=\"1.82\" -fPIC "-I/usr/perl5/5. +8.4/lib/sun4-solaris-64int/CORE" -DDB2_CACHE_FIX dbdimp.c dbdimp.c: In function `dbd_db_connect': dbdimp.c:314: warning: cast to pointer from integer of different size dbdimp.c:325: warning: cast to pointer from integer of different size dbdimp.c:336: warning: cast to pointer from integer of different size dbdimp.c: In function `db2_db_STORE_attrib': dbdimp.c:897: warning: cast to pointer from integer of different size dbdimp.c: In function `dbd_conn_opt': dbdimp.c:2482: warning: cast to pointer from integer of different size dbdimp.c: In function `db2_st_STORE_attrib': dbdimp.c:3209: warning: cast to pointer from integer of different size Running Mkbootstrap for DBD::DB2 () chmod 644 DB2.bs rm -f blib/arch/auto/DBD/DB2/DB2.so LD_RUN_PATH="" gcc -G DB2.o dbdimp.o -o blib/arch/auto/DBD/DB2/DB2. +so chmod 755 blib/arch/auto/DBD/DB2/DB2.so cp DB2.bs blib/arch/auto/DBD/DB2/DB2.bs chmod 644 blib/arch/auto/DBD/DB2/DB2.bs Manifying blib/man3/Bundle::DBD::DB2.3 Manifying blib/man3/DBD::DB2.3 root@whms17368 > STEP 3: root@whms17368 > make install Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Writing /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/DB2/.pa +cklist Appending installation info to /usr/perl5/5.8.4/lib/sun4-solaris-64int +/perllocal.pod STEP 4: root@whms17368 > cd /export/home/ccmadm/CCM root@whms17368 > perl CCM.pl 2012/01/13 11:56:09 start test! ld.so.1: perl: fatal: relocation error: file /usr/perl5/site_perl/5.8. +4/sun4-solaris-64int/auto/DBD/DB2/DB2.so: symbol SQLAllocHandle: refe +renced symbol not found Killed
      Note (probably harmless): No library found for -ldb2

      This is most likely the problem (note that although it says "probably harmless", it definitely isn't, as this is the essential library here).

      When you see this message, the respective link instruction is removed from the list, which means the Perl binding .../DBD/DB2/DB2.so won't be linked against the library — resulting in the "symbol not found" error later at dynamic link time.

      In case you're sure you do have the right library in the specified place (/home/db2inst1/lib), the pragmatic way to resolve the issue (instead of trying to figure out why the above MakeMaker check failed) would be to manually rerun the final link command with the appropriate link instruction added, i.e. (from within the build directory)

      gcc -G DB2.o dbdimp.o -o blib/arch/auto/DBD/DB2/DB2.so -L/home/db2 +inst1/lib -ldb2 ^^^^^^^^^^ +^^^^^^^^^^^^^^^

      (if you get an error, you don't have the right library)

      Then run make test && make install, as usual.

        Hi, Thanks again for your quick reply!

        I ran that gcc line and I indeed got an error.

        ld: fatal: file /home/db2inst1/sqllib/lib/libdb2.so: wrong ELF class: +ELFCLASS64

        After researching that a bit, i beleive i'm using the wrong version of the DB2 client (64 bits). I checked my perl version and it looks 32 bits, so i'll install DB2 (32 bits) and then i'll give you all some feedback on how it went.