Date: Sat, 05 Nov 2011 20:06:26 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Kostik Belousov <kostikbel@gmail.com> Cc: current@FreeBSD.ORG Subject: Re: 9.0/i386 build failure Message-ID: <4EB58932.1030309@FreeBSD.org> In-Reply-To: <20111105132816.GR50300@deviant.kiev.zoral.com.ua> References: <20111104190912.GA21948@bewilderbeast.blackhelicopters.org> <4EB53803.2000205@FreeBSD.org> <20111105132816.GR50300@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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) @@ -671,7 +671,7 @@ /* #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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EB58932.1030309>