[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-glpk] src/glplib.h:28:17: error: conflicting types for '_glp_li

From: Andrew Makhorin
Subject: Re: [Bug-glpk] src/glplib.h:28:17: error: conflicting types for '_glp_lib_str2int' with gplk-4.52.1 and mariadb-5.5.32
Date: Tue, 04 Feb 2014 18:02:21 +0400

On Tue, 2014-02-04 at 13:10 +0100, Dennis Schridde wrote:
> Hello!
> When compiling glpk-4.52.1 with mysql support against mariadb-5.5.32, the 
> build will fail:
> In file included from 
> /var/tmp/portage/sci-mathematics/glpk-4.52.1-r1/work/glpk-4.52.1/src/glpmpl.h:32:0,
>                  from 
> /var/tmp/portage/sci-mathematics/glpk-4.52.1-r1/work/glpk-4.52.1/src/glpsql.c:31:
> /var/tmp/portage/sci-mathematics/glpk-4.52.1-r1/work/glpk-4.52.1/src/glplib.h:28:17:
>  error: conflicting types for '_glp_lib_str2int'
>  #define str2int _glp_lib_str2int
>                  ^
> /usr/include/mysql/m_string.h:182:14: note: in expansion of macro 'str2int'
>  extern char *str2int(const char *src,int radix,long lower,long upper,
>               ^
> /var/tmp/portage/sci-mathematics/glpk-4.52.1-r1/work/glpk-4.52.1/src/glplib.h:28:17:
>  note: previous declaration of '_glp_lib_str2int' was here
>  #define str2int _glp_lib_str2int
>                  ^
> /var/tmp/portage/sci-mathematics/glpk-4.52.1-r1/work/glpk-4.52.1/src/glplib.h:29:5:
>  note: in expansion of macro 'str2int'
>  int str2int(const char *str, int *val);
>      ^
> Makefile:1230: recipe for target 'libglpk_la-glpsql.lo' failed
> A complete build.log is attached.
> For more details please see the bugreport at the Gentoo/Linux tracker [1].
> If you need more information to fix this, please do not hesitate to ask me, 
> or reply to the Gentoo bug.
> Best regards,
> Dennis
> [1] https://bugs.gentoo.org/show_bug.cgi?id=420095

Thank you for your bug report.

The error occurs on compilation of glpsql.c because str2int is declared
in both glplib.h and in m_string.h, where the latter is included via
mysql.h. (I'd like to note that mysql.h is a public api header, so it
should keep the namespace clean, but it does not, having declared many
non-reserved non-prefixed identifiers in secondary headers.) 

To fix the bug please add the #undef directive at the beginning of the
file glpsql.c as follows:

. . .
#include "glpmpl.h"
#include "glpsql.h"
#undef str2int /* <--- this line should be added */
. . .

This must work because str2int is not used in glpsql.c.

This bug will be fixed in a next release of glpk.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]