简体   繁体   中英

Testprintenv:error while loading shared libraries:libodbc.so.1: cannot open shared object file

I am trying to invoke a C-Program which returns the value for a given keyword from a configuration file

While trying to invoke program it's displaying below error:

**Testprintenv: error while loading shared libraries: libodbc.so.1: cannot open shared object file: No such file or directory**

We have installed EasySoft previously and uninstalled back (Removed all directories).

Below dependencies are showing up on Linux machine **

-bash-4.1$ ldd Testprintenv
        linux-vdso.so.1 =>  (0x00007fffc0bdb000)
        libodbc.so.1 => not found
        libodbcinst.so.1 => not found
        libc.so.6 => /lib64/libc.so.6 (0x000000397b200000)
        /lib64/ld-linux-x86-64.so.2 (0x000000397ae00000)

**

When we try the same program on Solaris machine dependencies are showing up differently and executing without any error:

[Testuser]$ ldd Testprintenv
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libmp.so.2 =>    /lib/libmp.so.2
        libmd.so.1 =>    /lib/libmd.so.1
        libscf.so.1 =>   /lib/libscf.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1
        libm.so.2 =>     /lib/libm.so.2
        /platform/SUNW,SPARC-Enterprise/lib/libc_psr.so.1

Any insight why the dependency (libodbc.so.1) is only showing up on linux and how to resolve?

Thanks in advance,

Is there anyway to check the relationships between c executable and libraries other than ldd?

Any insight why the dependency (libodbc.so.1) is only showing up on linux and how to resolve?

1) If you want to know why there is a dependency, I suggest to try finding common symbols. Unfortunatelly, you must have the libodbc library installed, because there is no way to find out from the Testprintenv binary which symbols are meant to be linked with this library. So, do it like this:

# symbols needed by the Testprintenv binary:
nm -uD Testprintenv | tr -s " " | cut -f 3 -d" " > /tmp/symbols_needed

# symbols provided by the libodbc
nm --defined-only -D /lib/PATH_TO_YOUR_LIBRARY/libodbc.so.1 | cut -f 3 -d " " > /tmp/symbols_lib

# intersection of the two sets:
grep -w -F -f /tmp/symbols_needed /tmp/symbols_lib

The last command will list the symbols needed by Testprintenv and provided by libodbc.

2) How to resolve the issue?

  • first, install the library (libodbc), does it work now?
  • if not, make sure it is in the standard directories .
  • if not, add the directory where libodbc resides to the LD_PRELOAD environment variable, like: LD_PRELOAD=/home/ivan/my_lib/

Ok,

First some explanation:

You are trying to use a software that REQUIRES UNIXODBC .

By your OWN result of ldd it says:

**Testprintenv: error while loading shared libraries: libodbc.so.1: cannot open shared object file: No such file or directory**

Now about LDD the man page says:

ldd - print shared library dependencies

So this program you are trying to run DOES NEED the libodbc provided BY UNIXODBC . You may check rpmfind here .

As Solaris is another platform it may or not use it. (as Solaris has others ways to handle what you are trying to do)

So please check the link and read the install section.

The reason your software is shared linked to UNIXODBC instead of static is

Dynamic Data Binding

This allows the user or the system administrator to easily configure an application to use any ODBC compliant data source. This is perhaps the single biggest advantage of coding an application to the ODBC API and to purchase these applications. Dyamic binding allows the end-user to pick a data source, ie an SQL Server, and use it for all data applications without having to worry about recompiling the application.

By using a non-static dependence easysoft user is able to connect to any database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM