Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by roboticus (Chancellor)
on Apr 11, 2013 at 17:46 UTC ( [id://1028199]=note: print w/replies, xml ) Need Help??


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

arielCo:

Please consider using code tags instead of formatting the code yourself.

That aside, it looks like it might be a compiler mismatch problem. Earlier in your make output, it mentions:

Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: PerlGcc Config says: sun4-solaris-64int This may or may not cause problems. Please check your installation of +perl if you have problems building this extension.

Then, later, when trying to run, you get "fatal relocation errors". I'm guessing that the API differences in the two different compilers may be giving you your problems.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: "referenced symbol not found" testing DBD::ODBC against unixODBC
  • Download Code

Replies are listed 'Best First'.
Re^2: "referenced symbol not found" testing DBD::ODBC against unixODBC
by arielCo (Sexton) on Apr 11, 2013 at 20:25 UTC
    Update: I edited the RPATH of ODBC.so and tested it again:
    $ /usr/ccs/bin/elfdump -d .cpan/build/DBD-ODBC-1.43-KXVrET/blib/arch/a +uto/DBD/ODBC/ODBC.so | 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/ODBC.so' for module DBD::ODBC: ld.so.1: perl: fatal: +relocation error: file /export/home/filtro/.cpan/build/DBD-ODBC-1.43- +KXVrET/blib/arch/auto/DBD/ODBC/ODBC.so: symbol SQLGetDiagRec: referen +ced symbol not found at /usr/perl5/5.8.4/lib/sun4-solaris-64int/DynaL +oader.pm line 230.

      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 ld.so.1 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 libodbc.so AND libodbcinst.so. It then goes on to choose libodbcinst.so which is the incorrect shared object.

Re^2: "referenced symbol not found" testing DBD::ODBC against unixODBC
by arielCo (Sexton) on Apr 11, 2013 at 19:36 UTC
    Hi roboticus,

    The 'PerlGcc' architecture in perlgcc has not given me trouble before, even building DBD::Oracle.

    Both (the CPAN modules and unixODBC) were compiled with GCC, but unixODBC had been linked with the Forte 'ld', so I built it again:

    ./configure  --prefix=$HOME/unixODBC LD=gcc MAKE=gmake AR=/usr/ccs/bin/ar

    Same result. I learned of 'nm', and the "missing" symbols are indeed defined in unixODBC's libodbc.so, e.g.:

    $ /usr/ccs/bin/nm -r .cpan/build/DBD-ODBC-1.43-fQI1op/blib/arch/auto/D +BD/ODBC/ODBC.so unixODBC/lib/libodbc.so perl5/lib/perl5/sun4-solaris- +64int/auto/DBI/DBI.so | grep SQLGetDiagRec [892] | 0| 0|NOTY |GLOB |0 |UNDEF |.cpan/build/D +BD-ODBC-1.43-fQI1op/blib/arch/auto/DBD/ODBC/ODBC.so:SQLGetDiagRec [2820] | 127256| 1776|FUNC |GLOB |0 |13 |unixODBC/lib/ +libodbc.so:SQLGetDiagRec [859] | 0| 0|FILE |LOCL |0 |ABS |unixODBC/lib/ +libodbc.so:SQLGetDiagRec.c [2699] | 129032| 72|FUNC |GLOB |0 |13 |unixODBC/lib/ +libodbc.so:SQLGetDiagRecA [2792] | 216212| 2076|FUNC |GLOB |0 |13 |unixODBC/lib/ +libodbc.so:SQLGetDiagRecW [1383] | 0| 0|FILE |LOCL |0 |ABS |unixODBC/lib/ +libodbc.so:SQLGetDiagRecW.c

    Since it fails when testing, and the path to libodbc.so isn't mentioned in any of the GCC commands, maybe it's not being included in the RPATH?

    $ /usr/ccs/bin/elfdump -d .cpan/build/DBD-ODBC-1.43-fQI1op/blib/arch/ +auto/DBD/ODBC/ODBC.so | grep PATH [3] RUNPATH 0x104e /usr/ccs/lib:/lib:/u +sr/lib:/usr/sfw/lib [4] RPATH 0x104e /usr/ccs/lib:/lib:/u +sr/lib:/usr/sfw/lib

    Currently makepl_arg is '[LIBS=-L/export/home/filtro/unixODBC/lib]'. If my beginner's guess is correct, how do fix it? Providing it to perl -MCPAN through LD_LIBRARY_PATH makes no difference.

    Thanks in advance,
    --ariel

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1028199]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found