From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19076 invoked by alias); 20 Jan 2011 19:29:06 -0000 Received: (qmail 19066 invoked by uid 22791); 20 Jan 2011 19:29:05 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Jan 2011 19:29:00 +0000 Received: by iyj18 with SMTP id 18so920570iyj.20 for ; Thu, 20 Jan 2011 11:28:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.12.8 with SMTP id v8mr3010797ibv.147.1295551736313; Thu, 20 Jan 2011 11:28:56 -0800 (PST) Received: by 10.231.152.143 with HTTP; Thu, 20 Jan 2011 11:28:56 -0800 (PST) In-Reply-To: References: Date: Thu, 20 Jan 2011 19:29:00 -0000 Message-ID: Subject: Re: g++ cross distro compilation problem From: Nick Stokes To: Jonathan Wakely Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg00313.txt.bz2 On Thu, Jan 20, 2011 at 11:40 AM, Jonathan Wakely w= rote: > On 20 January 2011 15:53, Nick Stokes wrote: >> >> Assuming you are referring to compiling a code with g++ =A0(and not > > Yep, that's what I meant. > >> compiling gcc itself), then no it doesn't make a difference. (in fact, >> g++ -v shows that _GNU_SOURCE is already defined). >> >> Could it be some other silly mistake on my part, e.g forgetting to set >> an environment variable or something? Indeed there is the distro's g++ >> compiler installed on the login node, and most of these headers -- >> that are potentially incompatible with the gcc versions I am trying to >> install under /opt -- are under common places =A0/usr/include etc. > > You don't need to set any environment variables to use GCC, the 4.4.3 > compiler under /opt will find its own c++ headers not the ones in > /usr/include/c++/x.y.z (you can check the paths printed with -v to see > that for yourself) > > You need to find why uselocale is not defined here: > > /opt/gcc/4.4.3/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../../= include/c++/4.4.3/x86_64-unknown-linux-gnu/bits/c++locale.h:52: > error: 'uselocale' was not declared in this scope > > Try using the -E flag and examining the preprocessed output. Do that > on both machines and look for differences in the path or contents of > the locale.h header. =A0To minimise the output it should be sufficient > to do: > > echo '#include ' | g++ -E -x c++ =A0- > Great! This indeed revealed it. In /usr/include/locale.h (same location, line 133, in both distros actually) there is #ifdef __USE_GNU on CentOS version, which is #ifdef __USE_XOPEN2K8 in SUSE's version. So, in fact if I define `__USE_XOPEN2K8' while compiling on SUSE, it works. Hmm, go figure.. This can not be the right way to do this. What am I missing? Thanks!!