[OpenSIPS-Devel] [OpenSIPS/opensips] 087b23: Don't include <mysql/mysql_version.h> directly

Razvan Crainea razvan at opensips.org
Tue Nov 21 07:51:11 EST 2017


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 087b23ab55aee311fbd2201ec370310bde7d1967
      https://github.com/OpenSIPS/opensips/commit/087b23ab55aee311fbd2201ec370310bde7d1967
  Author: Peter Lemenkov <lemenkov at gmail.com>
  Date:   2017-11-21 (Tue, 21 Nov 2017)

  Changed paths:
    M modules/db_mysql/dbase.c
    M modules/db_mysql/my_con.c

  Log Message:
  -----------
  Don't include <mysql/mysql_version.h> directly

It seems that this header shouldn't be included directly. And sometimes
it may cause compilation issues (depending on MariaDB/MySQL version,
compiler, etc). See build log for the example:

	make[1]: Entering directory '/builddir/build/BUILD/opensips-2.2.5/modules/db_mysql'
	Compiling row.c
	gcc -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fgnu89-inline -Wcast-align -DMOD_NAME='db_mysql'  -I/usr/include/json-c -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC   -DNAME='"opensips"' -DVERSION='"2.2.5"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 7"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DUSE_FREERADIUS -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -I/usr/include -c row.c -o row.o
	Compiling my_con.c
	gcc -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fgnu89-inline -Wcast-align -DMOD_NAME='db_mysql'  -I/usr/include/json-c -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC   -DNAME='"opensips"' -DVERSION='"2.2.5"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 7"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DUSE_FREERADIUS -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -I/usr/include -c my_con.c -o my_con.o
	Compiling val.c
	gcc -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fgnu89-inline -Wcast-align -DMOD_NAME='db_mysql'  -I/usr/include/json-c -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC   -DNAME='"opensips"' -DVERSION='"2.2.5"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 7"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DUSE_FREERADIUS -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -I/usr/include -c val.c -o val.o
	In file included from my_con.c:25:0:
	/usr/include/mysql/mysql_version.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
	 #warning This file should not be included by clients, include only <mysql.h>
	  ^~~~~~~
	/usr/include/mysql/mysql_version.h:5:10: fatal error: mariadb_version.h: No such file or directory
	 #include <mariadb_version.h>
		  ^~~~~~~~~~~~~~~~~~~
	compilation terminated.
	make[1]: *** [../../Makefile.rules:25: my_con.o] Error 1
	make[1]: *** Waiting for unfinished jobs....
	make[1]: Leaving directory '/builddir/build/BUILD/opensips-2.2.5/modules/db_mysql'
	make: *** [Makefile:201: modules] Error 2

See also kamailio/kamailio at c31535072a04273b52a5cbc015e7ed1423d5dc33

Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>


  Commit: ec0acfba521bb0f5d0a630a08bdbc265f09565eb
      https://github.com/OpenSIPS/opensips/commit/ec0acfba521bb0f5d0a630a08bdbc265f09565eb
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2017-11-21 (Tue, 21 Nov 2017)

  Changed paths:
    M modules/db_mysql/dbase.c
    M modules/db_mysql/my_con.c

  Log Message:
  -----------
  Merge branch 'mariadb_unnecessary_include' of https://github.com/lemenkov/opensips into lemenkov-mariadb_unnecessary_include


  Commit: 63042c9221e596556233f7fc1b174cc30f6cfb8b
      https://github.com/OpenSIPS/opensips/commit/63042c9221e596556233f7fc1b174cc30f6cfb8b
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2017-11-21 (Tue, 21 Nov 2017)

  Changed paths:
    M modules/db_mysql/dbase.c
    M modules/db_mysql/my_con.c

  Log Message:
  -----------
  Merge branch 'lemenkov-mariadb_unnecessary_include'


Compare: https://github.com/OpenSIPS/opensips/compare/c23ad230af54...63042c9221e5


More information about the Devel mailing list