http://www.perlmonks.org?node_id=1028217


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

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