postgresql-interfaces / psqlodbc

Other
16 stars 13 forks source link

[psqlodbc-REL-16_00_0004][Postgres 15 5][Debian][unixODBC] Need to add CPPFLAGS="-DSQLCOLATTRIBUTE_SQLLEN" to configure to get it to compile #16

Open jboakye opened 5 months ago

jboakye commented 5 months ago

Otherwise we get the error below. Same issue with previous releases.

odbcapi30.c:120:1: error: conflicting types for 'SQLColAttribute'; have 'SQLRETURN(void , SQLUSMALLINT, SQLUSMALLINT, void , SQLSMALLINT, SQLSMALLINT , void )' {aka 'short int(void , short unsigned int, short unsigned int, void , short int, short int , void )'} 120 | SQLColAttribute(SQLHSTMT StatementHandle, | ^~~~~~~ In file included from psqlodbc.h:145, from odbcapi30.c:21: /usr/local/include/sql.h:613:24: note: previous declaration of 'SQLColAttribute' with type 'SQLRETURN(void , SQLUSMALLINT, SQLUSMALLINT, void , SQLSMALLINT, SQLSMALLINT , SQLLEN )' {aka 'short int(void , short unsigned int, short unsigned int, void , short int, short int , long int )'} 613 | SQLRETURN SQL_API SQLColAttribute(SQLHSTMT StatementHandle, | ^~~~~~~

davecramer commented 5 months ago

@jboakye when did it stop compiling ?

jboakye commented 5 months ago

@davecramer I only downloaded it a few days ago and found the issue with it. This is my first time having to compile it on debian and standalone from the postgres source tree (I think) and in general I have not had to deal with this driver for over 4 years or so as I was too busy to work on this project that requires it.

jboakye commented 5 months ago

I tried the 8xx release also in the last few days and found the same issue.

jboakye commented 5 months ago

This is the actual compiler invocation if that helps: libtool: compile: gcc -DHAVE_CONFIG_H -I. -I -I/d/postgres/postgresql_15_5/src/bin/include -I/d/postgres/postgresql_15_5/src/bin/include/postgresql/internal -I/usr/local/pgsql/include -I/usr/local/pgsql/include/internal -DUNICODE_SUPPORT -g -O2 -Wall -MT psqlodbcw_la-odbcapi30.lo -MD -MP -MF .deps/psqlodbcw_la-odbcapi30.Tpo -c odbcapi30.c -fPIC -DPIC -o .libs/psqlodbcw_la-odbcapi30.o

jboakye commented 5 months ago

I did bootstrap and then configure prior: ./configure --with-unixodbc=/usr/local/bin --with-libpq=/d/postgres/postgresql_15_5/src/bin

Everything works fine with this configure line (and after replacing _strdup with strdup in psqlodbc.h): ./configure CPPFLAGS="-DSQLCOLATTRIBUTE_SQLLEN" --with-unixodbc=/usr/local/bin --with-libpq=/d/postgres/postgresql_15_5/src/bin