From owner-freebsd-current@FreeBSD.ORG Sun Oct 13 16:23:24 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1EA43740 for ; Sun, 13 Oct 2013 16:23:24 +0000 (UTC) (envelope-from sunrenjie6@gmail.com) Received: from mail-lb0-x234.google.com (mail-lb0-x234.google.com [IPv6:2a00:1450:4010:c04::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 84CB52AA7 for ; Sun, 13 Oct 2013 16:23:23 +0000 (UTC) Received: by mail-lb0-f180.google.com with SMTP id q8so4996059lbi.11 for ; Sun, 13 Oct 2013 09:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=uOo3dSfrFRXFcobTkJ/e8MvZYoimgrLo638FPW3LHVA=; b=h1s99icqio/BCd/rTt10LOgwL1A3dwdtdKk/XhHf1J4Nb+cCiyih1VqZJHvnxPs7IY lZYqHVgb8PxrNinZBHGbRqjXjsGr8NuULKfpECedDr4uaCKi6yCItUhcStX7a/YIAlmT O5XEwFCQGLnOdRcNyvdgFMgcGF2vM5eQVd76aG6NR9uPkI7UjO9kzEF/z719+Pn9U8Hc R7Z/yjcNTPPqpXKqKgCE5le/bGbto8FYenmZYNCh8tejpftWG81ZKfl8Tl86P1ZsGebq ugb5oxK2g/O0RtKrl9C/SNFwqnOvWJRhdGqtMoRtQTllGpBcNCcbai2HCiL5bgORsTf2 +/PA== MIME-Version: 1.0 X-Received: by 10.152.120.37 with SMTP id kz5mr26485458lab.21.1381681401506; Sun, 13 Oct 2013 09:23:21 -0700 (PDT) Received: by 10.152.29.135 with HTTP; Sun, 13 Oct 2013 09:23:21 -0700 (PDT) Date: Mon, 14 Oct 2013 00:23:21 +0800 Message-ID: Subject: Re: mysql-client-5.6.14 build failed From: Sun Renjie To: vsityz@gmail.com, freebsd-current@freebsd.org Content-Type: multipart/mixed; boundary=089e0122814821336b04e8a1c5b7 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2013 16:23:24 -0000 --089e0122814821336b04e8a1c5b7 Content-Type: text/plain; charset=ISO-8859-1 Hi Alexander: > 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.1040608@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.orig 2013-10-13 22:22:33.000000000 +0800 +++ include/my_global.h 2013-10-13 22:26:57.000000000 +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 --089e0122814821336b04e8a1c5b7--