From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28755 invoked by alias); 16 Nov 2011 20:18:22 -0000 Received: (qmail 28746 invoked by uid 22791); 16 Nov 2011 20:18:21 -0000 X-SWARE-Spam-Status: No, hits=-2.4 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-pz0-f49.google.com (HELO mail-pz0-f49.google.com) (209.85.210.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Nov 2011 20:18:08 +0000 Received: by pzk6 with SMTP id 6so295012pzk.8 for ; Wed, 16 Nov 2011 12:18:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.85.129 with SMTP id h1mr35048730igz.47.1321474687128; Wed, 16 Nov 2011 12:18:07 -0800 (PST) Received: by 10.68.0.193 with HTTP; Wed, 16 Nov 2011 12:18:07 -0800 (PST) In-Reply-To: <201111161912.56150.yann.morin.1998@anciens.enib.fr> References: <201111152348.58253.yann.morin.1998@anciens.enib.fr> <201111161912.56150.yann.morin.1998@anciens.enib.fr> Date: Wed, 16 Nov 2011 20:18:00 -0000 Message-ID: Subject: Re: --host versus --target From: Trevor Woerner To: crossgcc@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00068.txt.bz2 Yann, On Wed, Nov 16, 2011 at 1:12 PM, Yann E. MORIN wrote: >> I'm assuming, however, to use option 1 I would need to specify the >> toolchain's sysroot directory as the --prefix? > > No, you want to set prefix to the _runtime_ prefix, probably / or /usr or > /usr/local. And you want to use: make DESTDIR=3D/path/to/staging install. Thank you, now I understand. I had been under the mistaken assumption that the cross-compiler would perform its #include search with the host system's /usr/include (etc...) by default (just like my system's native compiler). If that were the case I would have to somehow tell the compiler to change its behaviour, which I guessed could be done via ./configure's --prefix option. But by playing with the cross-compiler's "-v" option I can see that it instead looks in all the proper locations for the cross-toolchain's #include files without considering the host system's default locations: #include "..." search starts here: #include <...> search starts here: /lib/gcc/i686-nptl-linux-gnu/4.5.2/include /lib/gcc/i686-nptl-linux-gnu/4.5.2/include-fixed /lib/gcc/i686-nptl-linux-gnu/4.5.2/../../../../i686-npt= l-linux-gnu/include /i686-nptl-linux-gnu/sysroot/usr/include This is good news because it means I don't have to do anything explicitly (although its implicit nature confused me) other than to inform the compiler of the location of any staging directories. It also means that both the compiles which take place as part of the ./configure as well as the compiles which are done as part of the build itself (and any compiles that sometimes occur during an install!) will behave correctly. Just out of curiosity, why is the cross-compiler behaving this way (i.e. why isn't it searching for #includes in the system's /usr/include directory)? Is it because it is a cross-compiler, or because it is a sysroot'ed cross-compiler, or because it is performing a cross-compile? I noticed, while looking through the "-v" output that someone is including a --sysroot option implicitly. Thank you for the detailed explanation of how to work each option (in addition to listing the options previously). > Solution two would mean: > =A0 =A0cp -a $(tuple-gcc --your-cflags-except-sysroot -print-sysroot) =A0\ > =A0 =A0 =A0 /path/to/staging > =A0 =A0./configure --blabla-as-above =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CC=3D"tuple-gcc --syroot=3D/path/to/stagin= g" =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CXX=3D"tuple-g++ --sysroot=3D/path/to/stag= ing" =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LD=3D"tuple-ld --sysroot=3D/path/to/stagin= g" =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0AND_SO_ON=3Dtuple-andsoon --sysroot=3D/pat= h/to/staging" Very nice, I like this trick (of including the --sysroot as part of the tool command)! It would save me from caring whether the build system that comes with the software package handles CFLAGS/CXXFLAGS/CPPFLAGS/etc... correctly. Best regards, Trevor -- For unsubscribe information see http://sourceware.org/lists.html#faq