Re: 9.0/i386 build failure

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Sat, 5 Nov 2011 21:41:36 +0200
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=486 some time ago.
> > I suppose that the current-9 system is before the change, see r198344.
> 
> Yes, that is most likely the cause of this problem.  It is reproducible
> if you set CC to 'gcc -march=i386' and CXX to 'g++ -march=i386'.
> 
> At first, I thought it would be easily fixable, since when you use
> -march=i386, the macro __tune_i386__ is defined, so you can disable
> LLVM's use of atomic builtins.
> 
> 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=i386.
> 
> A workaround could be this:
> 
> Index: gnu/lib/libstdc++/config.h
> ===================================================================
> --- gnu/lib/libstdc++/config.h  (revision 227112)
> +++ gnu/lib/libstdc++/config.h  (working copy)
> _at__at_ -671,7 +671,7 _at__at_
>  /* #undef VERSION */
> 
>  /* 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
> 
> but unfortunately during the bootstrap stage, the system includes are
> used, not those in the source tree...
> 
> At the moment I don't know a clean way out of this, except setting CC to
> 'gcc -march=i486' and CXX to 'g++ -march=i486', 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.

Received on Sat Nov 05 2011 - 18:41:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:20 UTC