From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12884 invoked by alias); 20 Dec 2007 21:23:00 -0000 Received: (qmail 12870 invoked by uid 22791); 20 Dec 2007 21:23:00 -0000 X-Spam-Check-By: sourceware.org Received: from mail.zeugmasystems.com (HELO zeugmasystems.com) (192.139.122.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 20 Dec 2007 21:22:55 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: More questions on sysroots Date: Thu, 20 Dec 2007 21:23:00 -0000 Message-ID: In-Reply-To: From: "Kaz Kylheku" To: "NightStrike" , "gcc-help" 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: 2007-12/txt/msg00368.txt.bz2 gcc-help-owner@gcc.gnu.org wrote: > I thought I was doing the right thing for a while, but apparently > there are still issues. If I want to build a complete toolchain as a > canadian cross, tar it up, and give it to someone else, I have been > doing the following for configuring binutils/gcc: >=20 > ../gcc-svn/gcc/configure --prefix=3D/tmp/rt/root > --with-sysroot=3D/tmp/rt/root --target=3D$TARGET Using the same value for sysroot and prefix is not such a hot idea. The sysroot corresponds to the root of the target filesystem that you are building, or a least its toolchain materials, like usr/include and usr/lib. This is not where you are installing the cross-compiler (which isn't even compiled to run on that architecture). > Will this combinations of options, after tarring up /tmp/rt/root, > allow that tar to be distributed anywhere, untarred into any > directory, and run as normal with nothing but a simple change to PATH? To build a relocatable toolchain (runs in any directory), the sysroot has to be a subdirectory of the prefix. It doesn't have to correspond to the prefix itself. It can be anywhere underneath. Exactly where, that's up to you. You can just make up some subdirectory and stick it there. I use the scheme $prefix/$arch_string/root The reason for adding the architecture to the path is that the toolchain can, in principle, be built for multiple targets, all installing to the same prefix. (This is is supported). Yet each target needs a distinct sysroot under there. So say you built for arm and mips. You'd end up with $prefix/bin/mips-*-gcc and $prefix/bin/arm-*-gcc. Your sysroots in this combo toolchain would be $prefix/arm-*/root and $prefix/mips-*/root. Here * represents some additional components of the architecture tuple. In my case this is ``linux'', since that's the target OS; the toolchain is coupled with a Linux distro. So my C compiler would be: /path/to/toolchain/bin/mips64-linux-gcc or alternately: /path/to/toolchain/mips64-linux/bin/gcc the sysroot is /path/to/toolchain/mips64-linux/root where we find /path/to/toolchain/mips64-linux/root/usr/include /path/to/toolchain/mips64-linux/root/usr/lib32 etc. Note that the toolchain itself has lib and include directories: /path/to/toolchain/{include,lib} If we made that the sysroot, these would get mixed into the root.