简体   繁体   English

Testprintenv:加载共享库时出错:libodbc.so.1:无法打开共享对象文件

[英]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 我正在尝试调用C程序,该程序从配置文件返回给定关键字的值

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). 我们之前已经安装了EasySoft,然后又卸载了(删除了所有目录)。

Below dependencies are showing up on Linux machine ** 以下依赖项显示在Linux机器上**

-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: 当我们在Solaris计算机上尝试相同的程序时,依存关系将以不同的方式显示并执行而没有任何错误:

[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? 为什么依赖项(libodbc.so.1)仅在Linux上显示以及如何解决?

Thanks in advance, 提前致谢,

Is there anyway to check the relationships between c executable and libraries other than ldd? 无论如何,有没有检查c可执行文件和ldd以外的库之间的关系?

Any insight why the dependency (libodbc.so.1) is only showing up on linux and how to resolve? 为什么依赖项(libodbc.so.1)仅在Linux上显示以及如何解决?

1) If you want to know why there is a dependency, I suggest to try finding common symbols. 1)如果您想知道为什么存在依赖性,建议您尝试查找常见符号。 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. 不幸的是,您必须安装libodbc库,因为无法从Testprintenv二进制文件中找出要与该库链接的符号。 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. 最后一个命令将列出Testprintenv所需并由libodbc提供的符号。

2) How to resolve the issue? 2) 如何解决问题?

  • first, install the library (libodbc), does it work now? 首先,安装库(libodbc),现在可以使用吗?
  • 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/ 如果不是,则将libodbc所在的目录添加到LD_PRELOAD环境变量,例如: LD_PRELOAD=/home/ivan/my_lib/

Ok, 好,

First some explanation: 首先来一些解释:

You are trying to use a software that REQUIRES UNIXODBC . 您正在尝试使用需要UNIXODBC的软件。

By your OWN result of ldd it says: 根据您的Ldd OWN结果,它表示:

**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的手册页说:

ldd - print shared library dependencies ldd-打印共享库依赖项

So this program you are trying to run DOES NEED the libodbc provided BY UNIXODBC . 因此,您尝试运行此程序是否需要 UNIXODBC提供的libodbc You may check rpmfind here . 您可以在此处检查rpmfind。

As Solaris is another platform it may or not use it. 由于Solaris是另一个平台,因此它可能会使用也可能不会使用它。 (as Solaris has others ways to handle what you are trying to do) (因为Solaris还有其他方式可以处理您要尝试执行的操作)

So please check the link and read the install section. 因此,请检查链接并阅读安装部分。

The reason your software is shared linked to UNIXODBC instead of static is 您的软件被共享链接到UNIXODBC而不是静态链接的原因是

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. 通过使用非静态依赖关系,easysoft用户可以连接到任何数据库。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 加载共享库时出错:libcudart.so.4:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libcudart.so.4: cannot open shared object file: No such file or directory 加载共享库时出错:libclntsh.so.11.1:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory sh:加载共享库时出错:libc.so.6:无法打开共享对象文件:错误24 - sh: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 24 ./a.out:加载共享库时出错:libgsl.so.23:无法打开共享对象文件:没有这样的文件或目录 - ./a.out: error while loading shared libraries: libgsl.so.23: cannot open shared object file: No such file or directory 加载共享库时出错,无法打开共享对象文件:没有这样的文件或目录 (hiredis) - Error while loading shared libraries, cannot open shared object file: No such file or directory (hiredis) 检查 gdb 版本时出错:加载共享库时出错:libpython3.10.dll:无法打开共享 object 文件:没有这样的文件或目录 - error while checking gdb version: error while loading shared libraries: libpython3.10.dll: cannot open shared object file: No such file or directory 加载共享库时出错:libcmocka.so.0:没有这样的文件或目录 - Error while loading shared libraries: libcmocka.so.0: No such file or directory 无法打开共享对象文件:存在文件时,没有此类文件或目录错误 - cannot open shared object file: No such file or directory error while there is file 加载共享库时出错 - error while loading shared libraries libarb.so:无法打开共享对象文件:没有这样的文件或目录 - libarb.so: cannot open shared object file: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM