ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse

Home Page:https://clickhouse.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnixODBC Connection - can't open lib '/lib64/libclickhouseodbc.so' : file not found

HardRock4Life opened this issue · comments

I'm trying to set up an ODBC driver for a Docker image of Clickhouse on a remote Debian server (9.12 stretch).

I've configured the connection like this:

  • odbcinst.ini
[ODBC Drivers]
myconnection = Installed

[myconnection]
Description = ODBC Driver (ANSI) for ClickHouse
Driver      = /lib64/libclickhouseodbc.so
Setup       = /lib64/libclickhouseodbc.so
UsageCount  = 1
  • odbc.ini:
[ODBC Data Sources]
myconnection = myconnection

[myconnection]
Driver = myconnection

The problem is, when I run the command isql -v "myconnection", the error appears:
[01000][unixODBC][Driver Manager]Can't open lib '/lib64/libclickhouseodbc.so' : file not found
[ISQL]ERROR: Could not SQLConnect

Physically, the file is there, but once I launch the command ldd, the output is the following:

        linux-vdso.so.1 (0x00007ffd4e3f0000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efe1e508000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007efe1e300000)
        libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007efe1e0eb000)
        libicuuc.so.50 => not found
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efe1dee7000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe1dbe3000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efe1d844000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efe1eed2000)
        libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007efe1d63a000)

So, libicuuc.so.50 => not found.
The libicu lib is not located, so I install libicu-dev, but unfortunately, it doesn't help.

I was recommended to install libicu-devel using yum, but then I ran into several packages conflicts (all started from python-libxml2 package). After I couldn't properly upgrade/downgrade packages to provide compatible dependencies, I've rolled back the server to the point before installing yum.

For a starting point, are *.ini files configured OK? Is there anything to fix there?
Thank you!

Note, that precompiled Linux binary of the driver depends on specific ABI version of ICU lib: libicuuc.so.50. The one that is installed by the system's packet manager (libicu) is probably of another incompatible version. See the notes on v1.1.7.20200414 release.

The solution for this would be building the driver from sources on that particular machine, so that it will be linked to the ICU version supplied by the system. Please follow this: https://github.com/ClickHouse/clickhouse-odbc#building-from-sources

Ok, I'll try tomorrow and report the results here.

@HardRock4Life any news on this?

commented

Get new driver Release 1.2.1.20220905 on ubuntu 22.04.
Same problem:

# ldd /usr/lib/x86_64-linux-gnu/odbc/libclickhouseodbc.so
	linux-vdso.so.1 (0x00007ffc79ee8000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f74557db000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f74557d6000)
	libodbcinst.so.2 => /lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f74557c1000)
	libicuuc.so.50 => not found
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f74557bc000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7454f19000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7454cf1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f74557e7000)
	libltdl.so.7 => /lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f74557af000)

You are not testing before release?!
Where you can get libicuuc.so.50?
Ubuntu 18.04 - libicuuc.so.60.2
Ubuntu 22.04 - libicuuc.so.70.1

this is expected behavior described in release notes

the pre-built Linux package is built on CentOS 7, and it depends on the default system version of ICU, which is ICU 50. If you plan to use it in any other Linux distribution, you have to make sure, that this exact version of ICU is available at run-time there. Otherwise, you will need to build the driver manually for your system so that it links with its ICU version. The process is trivial, follow the instructions at "Building from sources" section from README.md.

commented

Workaround with the existing package coming from RHEL7 ;

  • copy the 2 library files to a sub-directory libicudata.so.50.2 and libicuuc.so.50.2
  • add the 2 symlinks libicudata.so.50 and libicuuc.so.50
  • add the directory to LD_LIBRARY_PATH
ln -s libicuuc.so.50.2 libicuuc.so.50
ln -s libicudata.so.50.2 libicudata.so.50 

$ls $HOME/libicu/
libicudata.so.50  libicudata.so.50.2  libicuuc.so.50  libicuuc.so.50.2

export LD_LIBRARY_PATH=$HOME/libicu:$LD_LIBRARY_PATH