Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Nov 2011 21:41:36 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: 9.0/i386 build failure
Message-ID:  <20111105194136.GI50300@deviant.kiev.zoral.com.ua>
In-Reply-To: <4EB58932.1030309@FreeBSD.org>
References:  <20111104190912.GA21948@bewilderbeast.blackhelicopters.org> <4EB53803.2000205@FreeBSD.org> <20111105132816.GR50300@deviant.kiev.zoral.com.ua> <4EB58932.1030309@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111105194136.GI50300>