lurcher / unixODBC

The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
GNU Lesser General Public License v2.1
103 stars 52 forks source link

2.3.12: build fails with gcc 14.x #158

Open kloczek opened 9 months ago

kloczek commented 9 months ago

Looks like with new gcc is reported [-Wimplicit-function-declaration] error

make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/unixODBC-2.3.12/Drivers/nn'
/bin/sh ../../libtool  --tag=CC   --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../..  -I../../include -I.   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -pthread -c -o yyparse.lo yyparse.c
libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I. -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -pthread -c yyparse.c  -fPIC -DPIC -o .libs/yyparse.o
yyparse.c: In function 'nnsql_yyparse':
yyparse.y:38:33: error: implicit declaration of function 'nnsql_yylex'; did you mean 'nnsql_yyinit'? [-Wimplicit-function-declaration]
   38 | # define yylex(pyylval)         nnsql_yylex(pyylval, pyyenv)
      |                                 ^~~~~~~~~~~
yyparse.c:1465:16: note: in expansion of macro 'yylex'
 1465 |       yychar = yylex (&yylval);
      |                ^~~~~
yyparse.y:374:17: warning: unused variable 'p' [-Wunused-variable]
  374 |         | search_condition kwd_or search_condition
      |                 ^
yyparse.y: In function 'unpack_col_name':
yyparse.y:824:7: warning: unused variable 'c' [-Wunused-variable]
  824 | static void     unpack_col_name(char* schema_tab_column_name, column_name_t* ptr)
      |       ^
yyparse.y: At top level:
yyparse.y:17:17: warning: 'sccsid' defined but not used [-Wunused-variable]
   17 | static  char    sccsid[]
      |                 ^~~~~~
make[3]: *** [Makefile:617: yyparse.lo] Error 1
dememax commented 7 months ago

Under Gentoo:

/bin/sh ../../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1 -I../..  -I/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/include    -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=12288 -O2 -pthread -c -o md5.lo /var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/md5.c
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c: In function 'SQLStatistics':
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c:1868:63: error: passing argument 6 of 'PG_SQLBindCol' from incompatible pointer type [-Wincompatible-pointer-types]
 1868 |                                 column_name, MAX_INFO_STRING, &column_name_len);
      |                                                               ^~~~~~~~~~~~~~~~
      |                                                               |
      |                                                               int *
In file included from /var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/statement.h:18,
                 from /var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c:42:
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/bind.h:49:39: note: expected 'SQLLEN *' {aka 'long int *'} but argument is of type 'int *'
   49 |                               SQLLEN *pcbValue);
      |                               ~~~~~~~~^~~~~~~~
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c:1925:54: error: passing argument 6 of 'PG_SQLBindCol' from incompatible pointer type [-Wincompatible-pointer-types]
 1925 |                         index_name, MAX_INFO_STRING, &index_name_len);
      |                                                      ^~~~~~~~~~~~~~~
      |                                                      |
      |                                                      SDWORD * {aka int *}
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/bind.h:49:39: note: expected 'SQLLEN *' {aka 'long int *'} but argument is of type 'SDWORD *' {aka 'int *'}
   49 |                               SQLLEN *pcbValue);
      |                               ~~~~~~~~^~~~~~~~
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c:1934:44: error: passing argument 6 of 'PG_SQLBindCol' from incompatible pointer type [-Wincompatible-pointer-types]
 1934 |                         fields_vector, 16, &fields_vector_len);
      |                                            ^~~~~~~~~~~~~~~~~~
      |                                            |
      |                                            SDWORD * {aka int *}
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/bind.h:49:39: note: expected 'SQLLEN *' {aka 'long int *'} but argument is of type 'SDWORD *' {aka 'int *'}
   49 |                               SQLLEN *pcbValue);
      |                               ~~~~~~~~^~~~~~~~
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c: In function 'PG_SQLPrimaryKeys':
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c:2220:51: error: passing argument 6 of 'PG_SQLBindCol' from incompatible pointer type [-Wincompatible-pointer-types]
 2220 |                         attname, MAX_INFO_STRING, &attname_len);
      |                                                   ^~~~~~~~~~~~
      |                                                   |
      |                                                   SDWORD * {aka int *}
/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/bind.h:49:39: note: expected 'SQLLEN *' {aka 'long int *'} but argument is of type 'SDWORD *' {aka 'int *'}
   49 |                               SQLLEN *pcbValue);
      |                               ~~~~~~~~^~~~~~~~

But it's possible to turn on minimal use flag and all compiles.

kloczek commented 7 months ago

Actually this issue has nothing to do with gcc version It is result of use latest glibc + -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS in $CFLAGS which turns some warnings into errors.

dememax commented 7 months ago

@kloczek All that I've done to have these errors, I've moved from gcc 13 to 14. And I think the same will be with the modern clang:

Clang 15 (it's been reverted in 15.0.1) turns on the following as -Werror-by-default:

From: https://bugs.gentoo.org/870412

lurcher commented 7 months ago

On 18/04/2024 15:15, Maxim P. DEMENTIEV wrote:

Under Gentoo:

|/bin/sh ../../libtool --tag=CC --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1 -I../.. -I/var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/include -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=12288 -O2 -pthread -c -o md5.lo /var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/md5.c /var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c: In function 'SQLStatistics': /var/tmp/portage/dev-db/unixODBC-2.3.12/work/unixODBC-2.3.12/Drivers/Postgre7.1/info.c:1868:63: error: passing argument 6 of 'PG_SQLBindCol' from incompatible pointer type [-Wincompatible-pointer-types] 1868 | column_name, MAX_INFO_STRING, &column_name_len); | ^~~~ | | | int *|

|Checking my source for 2.3.13pre all of those arguments in the unsupported samples have been changed to SQLLEN *|

dememax commented 7 months ago

@lurcher Thanks! Indeed, it was already fixed on master by 45f501e1

jubalh commented 7 months ago

Also see https://github.com/lurcher/unixODBC/pull/157#issuecomment-1914286922