tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
377 stars 101 forks source link

Unable to create extension "tds_fdw" using repo master code #230

Closed mattiamarzo closed 4 years ago

mattiamarzo commented 4 years ago

Hi everyone, I finally managed to install correctly the tds_fdw extension in Debian10 - PSQL 11.

I'm writing a MarkDown file also for Debian, because there is some minor difference comparing to what is indicated about Ubuntu.

The issue I'm reporting is the following:

I did "sudo make uninstall", that worked like a charm, and then i grabbed the latest Alpha release (tds_fdw-2.0.0-alpha.3). This time the build ended successfully.

So I think there is something to be fixed in the current master repo code.

juliogonzalez commented 4 years ago

Master is working fine for me following your instructions from #231

root@8a9b8d49dff1:/tds_fdw# make USE_PGXS=1
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/tds_fdw.o src/tds_fdw.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/options.o src/options.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/deparse.o src/deparse.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -shared -o tds_fdw.so src/tds_fdw.o src/options.o src/deparse.o -L/usr/lib/x86_64-linux-gnu  -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-7/lib  -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed  -lsybdb 
cp sql/tds_fdw.sql sql/tds_fdw--2.0.0-alpha.3.sql
cp README.md README.tds_fdw.md
/usr/bin/clang-7 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o src/tds_fdw.bc src/tds_fdw.c
/usr/bin/clang-7 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o src/options.bc src/options.c
/usr/bin/clang-7 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o src/deparse.bc src/deparse.c
root@8a9b8d49dff1:/tds_fdw# make USE_PGXS=1 install
/bin/mkdir -p '/usr/lib/postgresql/11/lib'
/bin/mkdir -p '/usr/share/postgresql/11/extension'
/bin/mkdir -p '/usr/share/postgresql/11/extension'
/bin/mkdir -p '/usr/share/doc/postgresql-doc-11/extension'
/usr/bin/install -c -m 755  tds_fdw.so '/usr/lib/postgresql/11/lib/tds_fdw.so'
/usr/bin/install -c -m 644 .//tds_fdw.control '/usr/share/postgresql/11/extension/'
/usr/bin/install -c -m 644 .//sql/tds_fdw--2.0.0-alpha.3.sql  '/usr/share/postgresql/11/extension/'
/usr/bin/install -c -m 644 .//README.tds_fdw.md '/usr/share/doc/postgresql-doc-11/extension/'
/bin/mkdir -p '/usr/lib/postgresql/11/lib/bitcode/tds_fdw'
/bin/mkdir -p '/usr/lib/postgresql/11/lib/bitcode'/tds_fdw/src/
/usr/bin/install -c -m 644 src/tds_fdw.bc '/usr/lib/postgresql/11/lib/bitcode'/tds_fdw/src/
/usr/bin/install -c -m 644 src/options.bc '/usr/lib/postgresql/11/lib/bitcode'/tds_fdw/src/
/usr/bin/install -c -m 644 src/deparse.bc '/usr/lib/postgresql/11/lib/bitcode'/tds_fdw/src/
cd '/usr/lib/postgresql/11/lib/bitcode' && /usr/lib/llvm-7/bin/llvm-lto -thinlto -thinlto-action=thinlink -o tds_fdw.index.bc tds_fdw/src/tds_fdw.bc tds_fdw/src/options.bc tds_fdw/src/deparse.bc
root@8a9b8d49dff1:/tds_fdw# su - postgres
postgres@8a9b8d49dff1:~$ psql
psql (11.6 (Debian 11.6-1.pgdg100+1))
Type "help" for help.

postgres=# CREATE EXTENSION tds_fdw;
CREATE EXTENSION

Are you sure you are using an updated commit from master?

Can you paste the output of git log -n1?

You should see:

commit 2e548aec14827ec7fbfbaf12d04564d20c445715 (HEAD -> master, origin/master, origin/HEAD)
Author: Julio Gonzalez Gil <git@juliogonzalez.es>
Date:   Fri Oct 18 17:39:42 2019 +0200

    Fix typo at the testing version check
juliogonzalez commented 4 years ago

Maybe if you paste the log with the CLI calls you did, I can figure out some other alternatives for your problem.

mattiamarzo commented 4 years ago

Hi Julio, I tried again with fresh code obtained cloning master, now everything worked like a charm.

I will close this issue.

Don't know what changed and why something went wrong, so I decided re-do all my previous installation trials. I found out some problem using the code from stable release (1.0.8), but I want to try when I have enough time and will open another issue if the problem is confirmed.

juliogonzalez commented 4 years ago

IIRC stable 1.0.8 will not work with recent PostgreSQL versions, starting at least with 11.X: #181

However 2.0.0-alpha.3 should equally stable. The only reason there isn't a 2.0.0 yet is because we are waiting for #222 (and most probably we should get #233 merged as well).