Hi Alexander:
(Please ignore my previous message as it was not composed in plain text while
this one is. Apart from that, the message content is all the same.)
> Date: Wed, 02 Oct 2013 02:04:02 +0300
> From: Alexander Panyushkin
> To: freebsd-current@freebsd.org
> Subject: mysql-client-5.6.14 build failed
> Message-ID: <524b54e2.1040...@gmail.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Hi all.
>
> mysql-client-5.6.14 not build with clang
>
> /usr/ports/databases/mysql56-client/work/mysql-5.6.14/sql/net_serv.cc:48:
> In file included from /usr/include/c++/v1/algorithm:627:
> /usr/include/c++/v1/memory:968:39: error: expected unqualified-id
> template static __two test(...);
The build fails because the 'test' macro is defined in include/my_global.h:
#define test(a) ((a) ? 1 : 0)
yet libc++ standard header defines 'test' as the name of a function:
template static char test(typename _Up::pointer* = 0);
MySQL C++ source code files like sql/net_serv.cc #include before
including . This ordering will result in the 'test' function in
macro-expanded into nonsense.
After a casual scan, more C++ source code files might be affacted:
client/mysql.cc:45:#include
client/mysqlbinlog.cc:58:#include
client/mysqltest.cc:51:#include
client/sql_string.cc:28:#include
...
I've prepared an ad hoc patch that modifies include/my_global.h to include
before defining the 'test' macro, so that further including of
will be uneffective and hence unharmful. I believe this likely to be useful
before there is a fix from upstream mysql or libc++. Now this package
(mysql56-client) and the server counterpart (mysql56-server) build fine. I'm new
to FreeBSD so I hope someone else could produce a better solution. Any comments
will be highly appreciated! Thanks.
Here comes the patch (see also the attachment):
root@r:/svn/ports/databases/mysql56-client # cat files/patch-include_my_global.h
--- include/my_global.h.orig2013-10-13 22:22:33.0 +0800
+++ include/my_global.h 2013-10-13 22:26:57.0 +0800
@@ -460,6 +460,13 @@
typedef unsigned short ushort;
#endif
+/* the macro test() below will break libc++ standard header which
+ defines function named 'test'; fix it in an ad hoc manner by including the
+ header before definition of the macro. */
+#ifdef __cplusplus
+#include
+#endif
+
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
#define test(a)((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
--
Regards,
Renjie Sun
patch-include_my_global.h
--- include/my_global.h.orig2013-10-13 22:22:33.0 +0800
+++ include/my_global.h 2013-10-13 22:26:57.0 +0800
@@ -460,6 +460,13 @@
typedef unsigned short ushort;
#endif
+/* the macro test() below will break libc++ standard header which
+ defines function named 'test'; fix it in an ad hoc manner by including the
+ header before definition of the macro. */
+#ifdef __cplusplus
+#include
+#endif
+
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
#define test(a)((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"