unixodbc driver manager cannot open specified libr

2019-03-27 12:51发布

问题:

I'm using ArchLinux and I am trying to install OpenEdge progress drivers so I can access it via PHP. I've installed the unixodbc package and the drivers, but when I test the connection via isql or PHP, I get the same error...

# isql -3 SUBS2A
[01000][unixODBC][Driver Manager]Can't open lib '/usr/dlc/odbc/lib/pgoe1023.so' : file not found
[ISQL]ERROR: Could not SQLConnect

The messed up thing is that "/usr/dlc/odbc/lib/pgoe1023.so" presently exists, I even symlinked it from "/usr/dlc".

The following are my .ini files...

odbc.ini

[SUBS2A]
Description = ODBC Driver for Progress
Driver = /usr/dlc/odbc/lib/pgoe1023.so
FileUsage = 1

odbcinst.ini (I removed some of the credentials as it is irrelevant)

[ODBC-test]
Description = SUBS2A
Driver = SUBS2A
Server = 192.168.1.2
Port = 4000
APILevel=1
ConnectFunctions=YYN
CPTimeout=60
DriverODBCVer=03.60
FileUsage=0
SQLLevel=0
UsageCount=1
ArraySize=50
DefaultLongDataBuffLen=2048
DefaultIsolationLevel= READ COMMITTED
StaticCursorLongColBuffLen=4096

EDIT Adding more info...

They appear to both be 32-bit, except I have no idea what I'm doing regarding that.

[root@Crux etc]# file /usr/bin/isql
/usr/bin/isql: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.27, BuildID[sha1]=0xd1bc16c119                          bb5cad6fea9e2a9abc1d06794a2775, stripped
[root@Crux etc]# file /usr/dlc/odbc/lib/pgoe1023.so
/usr/dlc/odbc/lib/pgoe1023.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

It does appear that it's missing some dependencies...

[root@Crux lib]# ldd pgoe1023.so
        linux-gate.so.1 =>  (0xb77c2000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7499000)
        librt.so.1 => /lib/librt.so.1 (0xb7490000)
        libpgicu23.so => not found
        libdl.so.2 => /lib/libdl.so.2 (0xb748b000)
        libstdc++-libc6.2-2.so.3 => not found
        libm.so.6 => /lib/libm.so.6 (0xb745e000)
        libc.so.6 => /lib/libc.so.6 (0xb72bc000)
        /lib/ld-linux.so.2 (0xb77c3000)

UPDATE

I copied "libpgicu23.so" to /usr/lib and it solved that problem, but I still need "libstdc++-libc6.2-2.so.3", but when I grabbed one from the internet it said "error while loading shared libraries: /usr/lib/libstdc++-libc6.2-2.so.3: ELF file OS ABI invalid"

I actually even made a symlink from "libstdc++-libc6.2-2.so.3" to "libstdc++.so", but even though it solved the problem via ldd, it caused this error when I queried isql..

isql: symbol lookup error: /usr/dlc/odbc/lib/pgoe1023.so: undefined symbol: __builtin_vec_new

I've never installed odbc on a *nix box, but we did the same thing on a windows box and it worked fine. Any input appreciated.

回答1:

Check unixODBC and your driver are the same architecture i.e., run:

which isql
file xxx (whatever came back from above)
file /usr/dlc/odbc/lib/pgoe1023.so

They should both be 32 bit or 64 bit. A 64 bit unixODBC cannot use 32 bit drivers and vice versa.

You should not need that symlink.

Run ldd on /usr/dlc/odbc/lib/pgoe1023.so to ensure all dependencies are found.

Check /usr/dlc/odbc/lib/pgoe1023.so is executable.

BTW, I presume you got your labels the wrong way around as your odbc.ini file contents should be the odbcinst.ini and vice versa.



回答2:

One thing to check is the minor version numbers of the unixODBC libs that the driver is linked against. Since unixODBC 2.3.1 I changed the minor lib number to 2 to reflect the change in the SQLLEN size on 64 bit platforms. However if the driver lib was linked against a earlier version it will be looking for a libodbc.so.1, and current sources provide libodbc.so.2. Simple solution is to provide a sym link from the *.so.1 to the *.so.2. The same is also true of libodbcinst.so, so check that as well.