An issue when unixodbc dynamically linked with ltdl library?

all:

I am testing unixODBC in Solaris 10 environments, and find if libodbc and MyODBC driver are dynamically linked with libltdl.so:

    ldd /usr/lib/libodbc.so.2
    libltdl.so.7 =>  /usr/local/lib/libltdl.so.7
    libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
    libthread.so.1 =>        /usr/lib/libthread.so.1
    libc.so.1 =>     /usr/lib/libc.so.1
    libgcc_s.so.1 =>         /usr/lib/libgcc_s.so.1
    libm.so.2 =>     /usr/lib/libm.so.2
    /platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1

    ldd /data/nan/mysql-connector-odbc-5.2.4-src/lib/libmyodbc5a.so
    libodbc.so.2 =>  /usr/lib/libodbc.so.2
    libthread.so.1 =>        /usr/lib/libthread.so.1
    libm.so.2 =>     /usr/lib/libm.so.2
    libodbcinst.so.2 =>      /usr/lib/libodbcinst.so.2
    libgcc_s.so.1 =>         /usr/lib/libgcc_s.so.1
    libltdl.so.7 =>  /usr/local/lib/libltdl.so.7
    libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
    libc.so.1 =>     /usr/lib/libc.so.1
    /platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1

sometimes it will connect MySQL server failed when starting up application. The log likes this:

[ODBC][6738][1361325895.588941][SQLConnect.c][1111]Can't open lib '/data/nan/mysql-connector-odbc-5.2.4-src/lib/libmyodbc5a.so' : file not found
[ODBC][6738][1361325895.588979][SQLConnect.c][1111]Can't open lib '/data/nan/mysql-connector-odbc-5.2.4-src/lib/libmyodbc5a.so' : file not found

After a while, the application runs OK.

    But if libodbc and MyODBC driver aren't dynamically linked with libltdl.so:
    ldd /usr/local/lib/libodbc.so.2
    libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
    libthread.so.1 =>        /usr/lib/libthread.so.1
    libc.so.1 =>     /usr/lib/libc.so.1
    libgcc_s.so.1 =>         /usr/local/lib/libgcc_s.so.1
    libm.so.2 =>     /usr/lib/libm.so.2
    /platform/SUNW,UltraAX-i2/lib/libc_psr.so.1

    ldd /data1/susie/mysql/tools/test_static_modify/mysql-connector-odbc-5.2.3-src/lib/libmyodbc5a.so
    libodbc.so.2 =>  /usr/local/lib/libodbc.so.2
    libthread.so.1 =>        /usr/lib/libthread.so.1
    libm.so.2 =>     /usr/lib/libm.so.2
    libodbcinst.so.2 =>      /usr/local/lib/libodbcinst.so.2
    libgcc_s.so.1 =>         /usr/local/lib/libgcc_s.so.1
    libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
    libc.so.1 =>     /usr/lib/libc.so.1
    /platform/SUNW,UltraAX-i2/lib/libc_psr.so.1

The application runs always OK..

So I think it may be a potential issue in unixODBC. Could anyone help to check it? Thanks very much in advance!

Best Regards
Nan Xiao

Answer

All unixODBC does is call dlopen and dlsym from libltdl, I wonder if there is some statics in the lib that is causing the problem. If you don’t build unixODBC to use a exernal libltdl it uses its own version (from libtool), so again, it may be a conflict with them both hitting the same lib. You say you are using Solaris. Is the libltdl you are linking with from Sun?

What might be interesting is if you can get it to fail under truss so we could see just what the “file not found” is caused by.

I also wonder just what the MySQL driver uses libltdl for?

Leave a Reply

Your email address will not be published. Required fields are marked *