Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: "referenced symbol not found" testing DBD::ODBC against unixODBC

by arielCo (Sexton)
on Apr 11, 2013 at 20:25 UTC ( #1028229=note: print w/replies, xml ) Need Help??

in reply to Re: "referenced symbol not found" testing DBD::ODBC against unixODBC
in thread "referenced symbol not found" testing DBD::ODBC against unixODBC

Update: I edited the RPATH of and tested it again:
$ /usr/ccs/bin/elfdump -d .cpan/build/DBD-ODBC-1.43-KXVrET/blib/arch/a +uto/DBD/ODBC/ | grep RPATH [4] RPATH 0x110f /usr/ccs/lib:/lib:/u +sr/lib:/usr/sfw/lib:/export/home/filtro/unixODBC/lib
Same result:
t/01base.t ................... 1/6 # install_driver(ODBC) failed: Can' +t load '/export/home/filtro/.cpan/build/DBD-ODBC-1.43-KXVrET/blib/arc +h/auto/DBD/ODBC/' for module DBD::ODBC: perl: fatal: +relocation error: file /export/home/filtro/.cpan/build/DBD-ODBC-1.43- +KXVrET/blib/arch/auto/DBD/ODBC/ symbol SQLGetDiagRec: referen +ced symbol not found at /usr/perl5/5.8.4/lib/sun4-solaris-64int/DynaL line 230.

Replies are listed 'Best First'.
Re^3: "referenced symbol not found" testing DBD::ODBC against unixODBC
by arielCo (Sexton) on Apr 17, 2013 at 00:07 UTC

    GOT IT. For anyone interested:

    1. In Solaris, run the shell with perlgcc and configure CPAN for GCC:
      o conf make /usr/sfw/bin/gmake o conf make_arg '' o conf make_install_arg '' o conf make_install_make_command '/usr/sfw/bin/gmake' o conf mbuild_arg '' o conf mbuild_install_arg '' o conf tar /usr/sfw/bin/gtar
      (Maybe some of these options are irrelevant - feel free to correct me)
    2. In makepl_arg:
      • Don't add 'LIBS=-L /your_unixodbc_home/lib'; use '-o /your_unixODBC_home', or just export UNIXODBC=/your_unixODBC_home before running the CPAN shell - Makefile.PL will set -L and -l for you.
      • To avoid using the dreaded LD_LIBRARY_PATH, add 'LDDLFLAGS="-Wl,-rpath,your_unixODBC_home/lib -G"' to makepl_arg. This will tell GCC to tell ld to add the location of your ODBC libraries to the runtime path (RPATH). Because you're overriding the LDDLFLAGS, you need to add "-G" so that GCC produces a shared object.
      • So, this incantation should work:

         o conf makepl_arg 'LDDLFLAGS="-G -Wl,-rpath,/your_unixodbc_home/lib" -o /your_unixodbc_home'

    Note: in my setup, I had to issue o conf commit, exit the shell and run it again for these changes to work. Don't ask.

    Note 2: Turns out that the relocation error happened because was loading the *wrong* library from /my_unixodbc_home/lib. I got the clue from 'Enabling ODBC support in Perl with Perl DBI and DBD::ODBC' by Easysoft:

    The undefined symbol SQLParamData is reported by the dynamic linker as the first symbol it looked for but could not find.

    This happens when building DBD::ODBC with unixODBC because the Makefile.PL is now incompatible with newer unixODBC releases. The Makefile.PL searches ODBCHOME/lib for *odbc*.* and finds AND It then goes on to choose which is the incorrect shared object.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1028229]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-03-20 05:16 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (247 votes). Check out past polls.