From owner-freebsd-current@FreeBSD.ORG  Sat Nov  5 19:41:44 2011
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: current@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 636431065672;
	Sat,  5 Nov 2011 19:41:44 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200])
	by mx1.freebsd.org (Postfix) with ESMTP id EC91B8FC0C;
	Sat,  5 Nov 2011 19:41:43 +0000 (UTC)
Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pA5Jfbrm040162
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 5 Nov 2011 21:41:37 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
Received: from alf.home (kostik@localhost [127.0.0.1])
	by alf.home (8.14.5/8.14.5) with ESMTP id pA5Jfbgj052107;
	Sat, 5 Nov 2011 21:41:37 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by alf.home (8.14.5/8.14.5/Submit) id pA5JfaLI052106;
	Sat, 5 Nov 2011 21:41:36 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com
	using -f
Date: Sat, 5 Nov 2011 21:41:36 +0200
From: Kostik Belousov <kostikbel@gmail.com>
To: Dimitry Andric <dim@freebsd.org>
Message-ID: <20111105194136.GI50300@deviant.kiev.zoral.com.ua>
References: <20111104190912.GA21948@bewilderbeast.blackhelicopters.org>
	<4EB53803.2000205@FreeBSD.org>
	<20111105132816.GR50300@deviant.kiev.zoral.com.ua>
	<4EB58932.1030309@FreeBSD.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="PQp0kazJUQKmOuaU"
Content-Disposition: inline
In-Reply-To: <4EB58932.1030309@FreeBSD.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: current@freebsd.org
Subject: Re: 9.0/i386 build failure
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>, 
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Nov 2011 19:41:44 -0000


--PQp0kazJUQKmOuaU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Nov 05, 2011 at 08:06:26PM +0100, Dimitry Andric wrote:
> On 2011-11-05 14:28, Kostik Belousov wrote:
> > On Sat, Nov 05, 2011 at 02:20:03PM +0100, Dimitry Andric wrote:
> >> On 2011-11-04 20:09, Michael W. Lucas wrote:
> ...
> >>> : undefined reference to `__sync_add_and_fetch_4'
> ...
> > The system gcc was changed to assume march=3D486 some time ago.
> > I suppose that the current-9 system is before the change, see r198344.
>=20
> Yes, that is most likely the cause of this problem.  It is reproducible
> if you set CC to 'gcc -march=3Di386' and CXX to 'g++ -march=3Di386'.
>=20
> At first, I thought it would be easily fixable, since when you use
> -march=3Di386, the macro __tune_i386__ is defined, so you can disable
> LLVM's use of atomic builtins.
>=20
> However, since r212286, libstdc++ is also configured to use atomic
> builtins, and any non-trivial C++ program will encounter this linking
> issue when compiling with -march=3Di386.
>=20
> A workaround could be this:
>=20
> Index: gnu/lib/libstdc++/config.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- gnu/lib/libstdc++/config.h  (revision 227112)
> +++ gnu/lib/libstdc++/config.h  (working copy)
> @@ -671,7 +671,7 @@
>  /* #undef VERSION */
>=20
>  /* Define if builtin atomic operations are supported on this host. */
> -#if defined(__amd64__) || defined(__i386__)
> +#if defined(__amd64__) || (defined(__i386__) && !defined(__tune_i386__))
>  #define _GLIBCXX_ATOMIC_BUILTINS 1
>  #endif
>=20
> but unfortunately during the bootstrap stage, the system includes are
> used, not those in the source tree...
>=20
> At the moment I don't know a clean way out of this, except setting CC to
> 'gcc -march=3Di486' and CXX to 'g++ -march=3Di486', and then building the
> bootstrap-tools stage should at least complete successfully.
I believe that sources were bootstrapable after the commit, with the old
world. The solution could be to checkout exactly r198344, build and install
new world, and then checkout latest HEAD.

Personally, I would install from any snapshot, 9.0RC1 is good enough for
later HEAD rebuild.

--PQp0kazJUQKmOuaU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk61kXAACgkQC3+MBN1Mb4ji5gCgu6fdoe3cb1QcC74gxFVHVUpa
RJQAnRoWP30CnDp4RmoLGYq6i26BlyYr
=5VP1
-----END PGP SIGNATURE-----

--PQp0kazJUQKmOuaU--