public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Building Relocatable gcc
@ 2011-01-26 15:27 Kyle Girard
  2011-01-26 15:34 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Girard @ 2011-01-26 15:27 UTC (permalink / raw)
  To: gcc-help


Can anyone point me to or show me a basic set of configure args that I
can use to compile a relocatable gcc toolchain on linux?  I'm not cross
compiling or anything (host and target are both 32 linux)  After reading
the docs I thought that I basically just had to use the options
--with-sysroot and --prefix with equal values  for binutils and gcc and
everything should work however during the build of gcc it fails to find
headers.  What am I missing?  Do I need to somehow create a cross
compiler from 32bit linux to 32bit linux?  Any help is appreciated.

Cheers

Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Building Relocatable gcc
  2011-01-26 15:27 Building Relocatable gcc Kyle Girard
@ 2011-01-26 15:34 ` Ian Lance Taylor
  2011-01-26 19:24   ` Kyle Girard
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2011-01-26 15:34 UTC (permalink / raw)
  To: Kyle Girard; +Cc: gcc-help

Kyle Girard <kyle@kdmanalytics.com> writes:

> Can anyone point me to or show me a basic set of configure args that I
> can use to compile a relocatable gcc toolchain on linux?  I'm not cross
> compiling or anything (host and target are both 32 linux)  After reading
> the docs I thought that I basically just had to use the options
> --with-sysroot and --prefix with equal values  for binutils and gcc and
> everything should work however during the build of gcc it fails to find
> headers.  What am I missing?  Do I need to somehow create a cross
> compiler from 32bit linux to 32bit linux?  Any help is appreciated.

What do you mean by relocatable?

If you use just the --prefix=DIR option, and run "make" and "make
install", then you can move the directory DIR wherever you like and
everything should continue to work.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Building Relocatable gcc
  2011-01-26 15:34 ` Ian Lance Taylor
@ 2011-01-26 19:24   ` Kyle Girard
  2011-01-26 19:43     ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Girard @ 2011-01-26 19:24 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help


> What do you mean by relocatable?
> 
> If you use just the --prefix=DIR option, and run "make" and "make
> install", then you can move the directory DIR wherever you like and
> everything should continue to work.

By relocatable I mean I guess self contained..  I can use --prefix and
install the compiler to DIR, yes, but after I rename DIR to DIR2 doesn't
gcc continue to look for it's headers in DIR?  If I wanted to zip up the
gcc in DIR and put it on another machine that doesn't have gcc installed
on it and doesn't the directory DIR wont it still be looking for headers
in DIR?

I'd like to make version of gcc that I can zip up and drop on to a
machine in a directory of my choice and instantly have a version of gcc
that I can compile things with.  Sort of like the way mingw is done but
for linux.  

Cheers,

Kyle



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Building Relocatable gcc
  2011-01-26 19:24   ` Kyle Girard
@ 2011-01-26 19:43     ` Ian Lance Taylor
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2011-01-26 19:43 UTC (permalink / raw)
  To: Kyle Girard; +Cc: gcc-help

Kyle Girard <kyle@kdmanalytics.com> writes:

>> What do you mean by relocatable?
>> 
>> If you use just the --prefix=DIR option, and run "make" and "make
>> install", then you can move the directory DIR wherever you like and
>> everything should continue to work.
>
> By relocatable I mean I guess self contained..  I can use --prefix and
> install the compiler to DIR, yes, but after I rename DIR to DIR2 doesn't
> gcc continue to look for it's headers in DIR?

No.  gcc uses relative paths to find its own internal headers.

> If I wanted to zip up the
> gcc in DIR and put it on another machine that doesn't have gcc installed
> on it and doesn't the directory DIR wont it still be looking for headers
> in DIR?

No.

> I'd like to make version of gcc that I can zip up and drop on to a
> machine in a directory of my choice and instantly have a version of gcc
> that I can compile things with.  Sort of like the way mingw is done but
> for linux.  

That should happen more or less automatically if you follow the simple
procedure I described above.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Building Relocatable GCC
  2011-02-01 23:10 ` Building Relocatable GCC NightStrike
@ 2011-02-02  1:28   ` Bryan Hundven
  0 siblings, 0 replies; 6+ messages in thread
From: Bryan Hundven @ 2011-02-02  1:28 UTC (permalink / raw)
  To: NightStrike; +Cc: Kyle Girard, gcc-help

On Tue, Feb 1, 2011 at 3:10 PM, NightStrike <nightstrike@gmail.com> wrote:
> On Tue, Jan 25, 2011 at 5:19 PM, Kyle Girard <kyle@kdmanalytics.com> wrote:
>>
>> I'm trying compile a version of gcc-4.5 on linux x86 for linux x86 which
>> is relocatable but I'm having difficulty.
>>
>> Does anyone have an example of how to build such a relocatable gcc?
>>
>> I've been building binutils, and gcc-4.5 over and over
>> with many different options.  After reading the docs I thought the key
>> configure options are the --with-sysroot=/my/root and --prefix=/my/root
>> for both binutils and gcc with those options and it should be
>> relocatable but I've had no luck.  For most of my attempts I can compile
>> binutils fine but gcc compilation fails saying it cannot file system
>> headers in /my/root/usr/include.. Am I missing a step somewhere?  I've
>> even tried the bringing in eglibc/libc into the mix and trying to create
>> a cross-compiler from linux x86 to linux x86 but that was even worse.
>>
>> From the googling that I've done it doesn't seem like it's that
>> difficult.  I think I'm missing some critical step somewhere
>
> Yes.  You have to pre-populate /my/root with an actual sysroot,
> including system headers and a crt.  You can do this by rolling your
> own, copying from /usr/, or any of a few other means.

Or, have crosstool-ng help you :)

http://ymorin.is-a-geek.org/projects/crosstool
hg clone http://ymorin.is-a-geek.org/hg/crosstool-ng/
or
wget http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-1.10.0.tar.bz2

-Bryan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Building Relocatable GCC
       [not found] <1295993996.3050.2164.camel@Tak>
@ 2011-02-01 23:10 ` NightStrike
  2011-02-02  1:28   ` Bryan Hundven
  0 siblings, 1 reply; 6+ messages in thread
From: NightStrike @ 2011-02-01 23:10 UTC (permalink / raw)
  To: Kyle Girard; +Cc: gcc-help

On Tue, Jan 25, 2011 at 5:19 PM, Kyle Girard <kyle@kdmanalytics.com> wrote:
>
> I'm trying compile a version of gcc-4.5 on linux x86 for linux x86 which
> is relocatable but I'm having difficulty.
>
> Does anyone have an example of how to build such a relocatable gcc?
>
> I've been building binutils, and gcc-4.5 over and over
> with many different options.  After reading the docs I thought the key
> configure options are the --with-sysroot=/my/root and --prefix=/my/root
> for both binutils and gcc with those options and it should be
> relocatable but I've had no luck.  For most of my attempts I can compile
> binutils fine but gcc compilation fails saying it cannot file system
> headers in /my/root/usr/include.. Am I missing a step somewhere?  I've
> even tried the bringing in eglibc/libc into the mix and trying to create
> a cross-compiler from linux x86 to linux x86 but that was even worse.
>
> From the googling that I've done it doesn't seem like it's that
> difficult.  I think I'm missing some critical step somewhere

Yes.  You have to pre-populate /my/root with an actual sysroot,
including system headers and a crt.  You can do this by rolling your
own, copying from /usr/, or any of a few other means.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-02  1:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 15:27 Building Relocatable gcc Kyle Girard
2011-01-26 15:34 ` Ian Lance Taylor
2011-01-26 19:24   ` Kyle Girard
2011-01-26 19:43     ` Ian Lance Taylor
     [not found] <1295993996.3050.2164.camel@Tak>
2011-02-01 23:10 ` Building Relocatable GCC NightStrike
2011-02-02  1:28   ` Bryan Hundven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).