From owner-freebsd-current@FreeBSD.ORG Sun Oct 13 16:33:03 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 09AF9B4B for ; Sun, 13 Oct 2013 16:33:03 +0000 (UTC) (envelope-from sunrenjie6@gmail.com) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com [IPv6:2a00:1450:4010:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8BEDE2B26 for ; Sun, 13 Oct 2013 16:33:02 +0000 (UTC) Received: by mail-la0-f51.google.com with SMTP id hp15so833817lab.38 for ; Sun, 13 Oct 2013 09:33:00 -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=iUQG4rSQMJD6iDxgyPbmGRKW/R/uiN/79lr8x/9xCcg=; b=zLlGj9HqyCzRlg3tLvza/Oe/OCSCUpM0lyYnIKBwZF80uOF5i6ah6cVUoXcz4nMfW5 gsho8sPpRrPeCy/M0RMkKOJ76AXp6nXsNk46d8M7aDEw2gZXTd9ggNn3x30YZPi+3pHE ANzVMD05Zun4gtohurQPBY7qOgn4KOWEl2Z3cYr/X4m549DAisSjFZY+6JnG5RC0dof0 OxeTEmleYNeqO/lvz+LscAOPYNmAjU9xQB2h4L7Y549IsIBZpAjoSPFYNVd5gh5wikuL jp7zjBc3yDpJ3AUdISwZR5j9CkQUnnpu0asFVV99YSK2qdzDOHl+1PiDPSt9mo3D5uJK 7acQ== MIME-Version: 1.0 X-Received: by 10.112.77.134 with SMTP id s6mr1842526lbw.38.1381681980481; Sun, 13 Oct 2013 09:33:00 -0700 (PDT) Received: by 10.152.29.135 with HTTP; Sun, 13 Oct 2013 09:33:00 -0700 (PDT) Date: Mon, 14 Oct 2013 00:33:00 +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=001a11c3dfbaa3a6ac04e8a1e70e 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:33:03 -0000 --001a11c3dfbaa3a6ac04e8a1e70e Content-Type: text/plain; charset=ISO-8859-1 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.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 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) --001a11c3dfbaa3a6ac04e8a1e70e--