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?
对依赖项(libodb .so.1)为什么只出现在linux上以及如何解决有什么深入的了解吗?
Thanks in advance,
提前谢谢,
2 个解决方案
#1
1
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?
对依赖项(libodb .so.1)为什么只出现在linux上以及如何解决有什么深入的了解吗?
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:
如果你想知道为什么会有依赖性,我建议你去找一些常见的符号。不幸的是,您必须安装libodbc库,因为无法从Testprintenv二进制文件中找到要与该库链接的符号。这样做:
# 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/
#2
0
Ok,
好吧,
First some explanation:
首先一些解释:
You are trying to use a software that REQUIRES UNIXODBC .
您正在尝试使用一个需要UNIXODBC的软件。
By your OWN result of ldd it says:
根据ldd的结果,它说:
**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. You may check rpmfind here.
所以你要运行的这个程序确实需要UNIXODBC提供的libodbc。您可以在这里查看rpmfind。
As Solaris is another platform it may or not use it. (as Solaris has others ways to handle what you are trying to do)
由于Solaris是另一个平台,它可能会使用它,也可能不会使用它。(正如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用户可以连接到任何数据库。
#1
1
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?
对依赖项(libodb .so.1)为什么只出现在linux上以及如何解决有什么深入的了解吗?
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:
如果你想知道为什么会有依赖性,我建议你去找一些常见的符号。不幸的是,您必须安装libodbc库,因为无法从Testprintenv二进制文件中找到要与该库链接的符号。这样做:
# 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/
#2
0
Ok,
好吧,
First some explanation:
首先一些解释:
You are trying to use a software that REQUIRES UNIXODBC .
您正在尝试使用一个需要UNIXODBC的软件。
By your OWN result of ldd it says:
根据ldd的结果,它说:
**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. You may check rpmfind here.
所以你要运行的这个程序确实需要UNIXODBC提供的libodbc。您可以在这里查看rpmfind。
As Solaris is another platform it may or not use it. (as Solaris has others ways to handle what you are trying to do)
由于Solaris是另一个平台,它可能会使用它,也可能不会使用它。(正如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用户可以连接到任何数据库。