Percona-Lab / clickhousedb_fdw

PostgreSQL's Foreign Data Wrapper For ClickHouse
Other
199 stars 24 forks source link

File named in documentation is not being generated when following install from source instructions #17

Open thebf opened 5 years ago

thebf commented 5 years ago

I've gone through and resolved all the dependencies that a fresh install is missing to be able to make and install this project.

The only .so files i can find are: libclickhouse-1.0.so and clickhousedb_fdw.so while the documentation references a file named libclickhouseodbc.so when defining the server using the foreign data wrapper.

Using either file in it's place returns the following error when i try to run a query through it: ERROR: could not connect to server "clickhouse_svr" DETAIL: IM004:[unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed

The make install has this output on CentOS 7 at the moment: m -rf libclickhouse-1.0.so lib/*.o make -f lib/Makefile make[1]: Entering directory /root/clickhousedb_fdw' g++ -O0 -g3 -Wno-unused-variable -fPIC -Wall -I. -Ilib -c -o lib/clickhouse-client.o lib/clickhouse-client.cpp g++ lib/clickhouse-client.o -o libclickhouse-1.0.so -fPIC -shared -ldl -lstdc++ -L -lodbc make[1]: Circular test <- test dependency dropped. g++ -O0 -g3 -Wno-unused-variable -Iinclude lib/example/odbc_test.o -o test -ldl -L. -lclickhouse-1.0 -lodbc -lodbcinst make[1]: Leaving directory/root/clickhousedb_fdw' make -f lib/Makefile make[1]: Entering directory /root/clickhousedb_fdw' make[1]: Circular test <- test dependency dropped. make[1]: Nothing to be done forall'. make[1]: Leaving directory `/root/clickhousedb_fdw' /usr/bin/install -c -m 755 libclickhouse-1.0.so /usr/pgsql-11/lib/libclickhouse-1.0.so /usr/bin/mkdir -p '/usr/pgsql-11/lib' /usr/bin/mkdir -p '/usr/pgsql-11/share/extension' /usr/bin/mkdir -p '/usr/pgsql-11/share/extension' /usr/bin/install -c -m 755 clickhousedb_fdw.so '/usr/pgsql-11/lib/clickhousedb_fdw.so' /usr/bin/install -c -m 644 .//clickhousedb_fdw.control '/usr/pgsql-11/share/extension/' /usr/bin/install -c -m 644 .//clickhousedb_fdw--1.0.sql '/usr/pgsql-11/share/extension/' /usr/bin/mkdir -p '/usr/pgsql-11/lib/bitcode/clickhousedb_fdw' /usr/bin/mkdir -p '/usr/pgsql-11/lib/bitcode'/clickhousedb_fdw/ /usr/bin/install -c -m 644 clickhousedb_fdw.bc '/usr/pgsql-11/lib/bitcode'/clickhousedb_fdw/./ /usr/bin/install -c -m 644 clickhousedb_option.bc '/usr/pgsql-11/lib/bitcode'/clickhousedb_fdw/./ /usr/bin/install -c -m 644 clickhousedb_deparse.bc '/usr/pgsql-11/lib/bitcode'/clickhousedb_fdw/./ /usr/bin/install -c -m 644 clickhousedb_connection.bc '/usr/pgsql-11/lib/bitcode'/clickhousedb_fdw/./ /usr/bin/install -c -m 644 clickhousedb_shipable.bc '/usr/pgsql-11/lib/bitcode'/clickhousedb_fdw/./ cd '/usr/pgsql-11/lib/bitcode' && /usr/lib64/llvm5.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o clickhousedb_fdw.index.bc clickhousedb_fdw/clickhousedb_fdw.bc clickhousedb_fdw/clickhousedb_option.bc clickhousedb_fdw/clickhousedb_deparse.bc clickhousedb_fdw/clickhousedb_connection.bc clickhousedb_fdw/clickhousedb_shipable.bc

Are there any repos which currently hold prebuilt deb or rpm packages that the readme references?

harris-chiu commented 5 years ago

If you have installed the odbc on centos7, you can look at /etc/odbcinst.ini and use the path for the file for the CREATE SERVER statement.

thebf commented 5 years ago

@harris-chiu It does not look like it added anything to this file during the installation.

Example driver definitions

Driver from the postgresql-odbc package

Setup from the unixODBC package

[PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/psqlodbcw.so Setup = /usr/lib/libodbcpsqlS.so Driver64 = /usr/lib64/psqlodbcw.so Setup64 = /usr/lib64/libodbcpsqlS.so FileUsage = 1

Driver from the mysql-connector-odbc package

Setup from the unixODBC package

[MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc5.so Setup = /usr/lib/libodbcmyS.so Driver64 = /usr/lib64/libmyodbc5.so Setup64 = /usr/lib64/libodbcmyS.so FileUsage = 1

harris-chiu commented 5 years ago

for the default installation I had, it's installed under the odbc driver is installed under /usr/local/lib64/odbc/libclickhouseodbc.so Hope this helps

thebf commented 5 years ago

@harris-chiu Thank you! Files were placed there and are working, I'll keep this in mind when proposing some enhancements of the documentation. I'll try to get it working on FreeBSD as well as CentOS 7 and document all dependencies and implicit steps to get it working.