public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problems building a cross compiler...
@ 2005-07-21 13:10 Andrew McCall
  2005-07-21 16:56 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew McCall @ 2005-07-21 13:10 UTC (permalink / raw)
  To: gcc-help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Hi Folks,

I am attempting to build a patched gcc 2.95.3 cross compiler so I can
produce targets of powerpc-*-haiku that are ELF's.  I was planning on
patching it in two phases, firstly to get gcc to compile using
- --target=powerpc-apple-haiku by duplicating all the code for
powerpc-apple-beos - if I am correct this would produce COFF or PE
binaries, the second phase would be to patch again so it produces ELF's.

I patched gcc to recognise powerpc-apple-haiku as a target, but still
use the original BFD, and configured using:

../configure --target=powerpc-apple-haiku --disable-nls
- --enable-shared=yes --enable-languages=c,c++ --prefix=/home/mccall/haiku

This worked OK, and you can see the output here:

http://www.h2o.demon.co.uk/haiku/haiku_gcc_configure.txt

However, when I run make, I eventually get the following error:

../../gcc/libgcc2.c:41: stdlib.h: No such file or directory
../../gcc/libgcc2.c:42: unistd.h: No such file or directory
make[3]: *** [libgcc2.a] Error 1
make[3]: Leaving directory
`/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
make[2]: *** [stmp-multilib-sub] Error 2
make[2]: Leaving directory
`/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
make[1]: *** [stmp-multilib] Error 1
make[1]: Leaving directory
`/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
make: *** [all-gcc] Error 2

The full output can be seen here:

http://www.h2o.demon.co.uk/haiku/haiku_gcc_make.txt

I thought that it might have been my patches, so I tried the same
thing, but with the --target=powerpc-apple-beos, and this produces the
exact same error.

Can anyone suggest what the problem is?  Is it something to do with me
needing headers from BeOS/Haiku to build a cross compiler?

Thanks,

Andrew McCall

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFC356W3NPNAi0EUWURAoUZAJ9VxQJRmhTy9uairdO5vPdSNkxyPgCg3HWz
n3BbNw4yLLQ6BdPNdSQHmmo=
=d5WN
-----END PGP SIGNATURE-----

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

* Re: Problems building a cross compiler...
  2005-07-21 13:10 Problems building a cross compiler Andrew McCall
@ 2005-07-21 16:56 ` Ian Lance Taylor
  2005-07-22 10:50   ` Andrew McCall
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2005-07-21 16:56 UTC (permalink / raw)
  To: Andrew McCall; +Cc: gcc-help

Andrew McCall <andrew.mccall@gmail.com> writes:

> However, when I run make, I eventually get the following error:
> 
> ../../gcc/libgcc2.c:41: stdlib.h: No such file or directory
> ../../gcc/libgcc2.c:42: unistd.h: No such file or directory
> make[3]: *** [libgcc2.a] Error 1
> make[3]: Leaving directory
> `/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
> make[2]: *** [stmp-multilib-sub] Error 2
> make[2]: Leaving directory
> `/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
> make[1]: *** [stmp-multilib] Error 1
> make[1]: Leaving directory
> `/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
> make: *** [all-gcc] Error 2
> 
> The full output can be seen here:
> 
> http://www.h2o.demon.co.uk/haiku/haiku_gcc_make.txt
> 
> I thought that it might have been my patches, so I tried the same
> thing, but with the --target=powerpc-apple-beos, and this produces the
> exact same error.
> 
> Can anyone suggest what the problem is?  Is it something to do with me
> needing headers from BeOS/Haiku to build a cross compiler?

Yes, that is exactly what it is.

The simplest approach is to copy all the header files and libraries
onto the cross-host, using the same directory layout under some
directory DIR, and then configure --with-sysroot=DIR.

Ian

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

* Re: Problems building a cross compiler...
  2005-07-21 16:56 ` Ian Lance Taylor
@ 2005-07-22 10:50   ` Andrew McCall
  2005-07-22 11:04     ` Rupert Wood
  2005-07-22 16:48     ` Ian Lance Taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew McCall @ 2005-07-22 10:50 UTC (permalink / raw)
  To: gcc-help, andrew.mccall

Hi Ian,

Thanks for the help with my cross compile problems!

On 21 Jul 2005 09:56:16 -0700, Ian Lance Taylor <ian@airs.com> wrote:
> Andrew McCall <andrew.mccall@gmail.com> writes:
> 
> > However, when I run make, I eventually get the following error:
> >
> > ../../gcc/libgcc2.c:41: stdlib.h: No such file or directory
> > ../../gcc/libgcc2.c:42: unistd.h: No such file or directory
> > make[3]: *** [libgcc2.a] Error 1
> > make[3]: Leaving directory
> > `/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
> > make[2]: *** [stmp-multilib-sub] Error 2
> > make[2]: Leaving directory
> > `/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
> > make[1]: *** [stmp-multilib] Error 1
> > make[1]: Leaving directory
> > `/home/mccall/haiku/src/gcc-2.95.3-haiku/gcc-obj/gcc'
> > make: *** [all-gcc] Error 2

[Snip]

> > Can anyone suggest what the problem is?  Is it something to do with me
> > needing headers from BeOS/Haiku to build a cross compiler?
> 
> Yes, that is exactly what it is.
> 
> The simplest approach is to copy all the header files and libraries
> onto the cross-host, using the same directory layout under some
> directory DIR, and then configure --with-sysroot=DIR.

I have been trying to get this working since you suggested it.

I have the headers, but they come in multiple folders like this:

headers/cpp
headers/gnu
headres/libs
headers/os
headers/posix
headers/private
headers/tools

In os I have the normal "Be" headers, such as Be.h, Appkit.h etc. etc.
in posix I have the posix headers like alloca.h, assert.h and
stdlib.h.

You can see the layout here:

http://svn.berlios.de/viewcvs/haiku/haiku/trunk/headers/

I have tried using:

--with-sysroot=../../../haiku/headers
--with-sysroot=../../../haiku/headers/os
--with-sysroot=../../../haiku/headers/posix

But all of these fail with the same error.

-- 
Thanks,

Andrew McCall
andrew.mccall@gmail.com

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

* RE: Problems building a cross compiler...
  2005-07-22 10:50   ` Andrew McCall
@ 2005-07-22 11:04     ` Rupert Wood
  2005-07-22 12:27       ` Andrew McCall
  2005-07-22 16:48     ` Ian Lance Taylor
  1 sibling, 1 reply; 6+ messages in thread
From: Rupert Wood @ 2005-07-22 11:04 UTC (permalink / raw)
  To: 'Andrew McCall'; +Cc: gcc-help

Andrew McCall wrote: 

> You can see the layout here:
> 
> http://svn.berlios.de/viewcvs/haiku/haiku/trunk/headers/
> 
> I have tried using:
> 
> --with-sysroot=../../../haiku/headers
> --with-sysroot=../../../haiku/headers/os
> --with-sysroot=../../../haiku/headers/posix

IIRC, the sysroot directory should contain subdirectories 'include' and
'lib'. By the look of it, posix is the one you need as include, although you
might want to merge in the os directory depending on what layout the apps
you want to compile expect. You could do this by making a new 'include'
directory and using cpio or similar to link in all the files in os and
posix. I don't know the convention for your OS.

I may be a few years out of date but it used to be safest to use absolute
paths for configure parameters rather than relative paths, i.e.

    --with-sysroot=/home/mccall/haiku/headers

Rup.

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

* Re: Problems building a cross compiler...
  2005-07-22 11:04     ` Rupert Wood
@ 2005-07-22 12:27       ` Andrew McCall
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew McCall @ 2005-07-22 12:27 UTC (permalink / raw)
  To: Rupert Wood; +Cc: gcc-help

On 22/07/05, Rupert Wood <me@rupey.net> wrote:
> Andrew McCall wrote:
> 
> > You can see the layout here:
> >
> > http://svn.berlios.de/viewcvs/haiku/haiku/trunk/headers/
> >
> > I have tried using:
> >
> > --with-sysroot=../../../haiku/headers
> > --with-sysroot=../../../haiku/headers/os
> > --with-sysroot=../../../haiku/headers/posix
> 
> IIRC, the sysroot directory should contain subdirectories 'include' and
> 'lib'. By the look of it, posix is the one you need as include, although you
> might want to merge in the os directory depending on what layout the apps
> you want to compile expect. You could do this by making a new 'include'
> directory and using cpio or similar to link in all the files in os and
> posix. I don't know the convention for your OS.
> 
> I may be a few years out of date but it used to be safest to use absolute
> paths for configure parameters rather than relative paths, i.e.
> 
>     --with-sysroot=/home/mccall/haiku/headers

Thanks for the reply Rupert, again, I have tried this, but I still get
the same error.  Can I not use -H or something to include multiple
directories?

-- 
Thanks,

Andrew McCall
andrew.mccall@gmail.com

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

* Re: Problems building a cross compiler...
  2005-07-22 10:50   ` Andrew McCall
  2005-07-22 11:04     ` Rupert Wood
@ 2005-07-22 16:48     ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2005-07-22 16:48 UTC (permalink / raw)
  To: Andrew McCall; +Cc: gcc-help

Andrew McCall <andrew.mccall@gmail.com> writes:

> > The simplest approach is to copy all the header files and libraries
> > onto the cross-host, using the same directory layout under some
> > directory DIR, and then configure --with-sysroot=DIR.
> 
> I have been trying to get this working since you suggested it.
> 
> I have the headers, but they come in multiple folders like this:
> 
> headers/cpp
> headers/gnu
> headres/libs
> headers/os
> headers/posix
> headers/private
> headers/tools
> 
> In os I have the normal "Be" headers, such as Be.h, Appkit.h etc. etc.
> in posix I have the posix headers like alloca.h, assert.h and
> stdlib.h.

By the default gcc expects to see a Unix style file system layout,
with /lib, /usr/include, /usr/lib, etc.  The header files would
normally be found in SYSROOT/usr/include, and, e.g., stdlib.h would be
found in SYSROOT/usr/include/stdlib.h.

You could shuffle your header files around to meet Unix expectations.
Or you could sort out INCLUDE_DEFAULTS for the particular case of
CROSS_COMPILER and TARGET_SYSTEM_ROOT.  See cppdefault.c.  I see an
instance of INCLUDE_DEFAULT in config/i386/beos-elf.h, although the
directories there do not appear to match the directories you listed
above.

I'm afraid that you have an unusual scenario, and you are going to
have to learn how gcc handles include file searching.

Ian

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

end of thread, other threads:[~2005-07-22 16:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-21 13:10 Problems building a cross compiler Andrew McCall
2005-07-21 16:56 ` Ian Lance Taylor
2005-07-22 10:50   ` Andrew McCall
2005-07-22 11:04     ` Rupert Wood
2005-07-22 12:27       ` Andrew McCall
2005-07-22 16:48     ` Ian Lance Taylor

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).