This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Cross compile is broken?


> 
> 	for libgcc2.c when your C library and header files are in
> 	$(build_tooldir). I have to do
> 
> 	# mkdir $(libdir)/gcc-lib/$(target_alias)/$(version)
> 
> There is code in the Makefile stmp-fixinc rule that creates this directory
> before it is first needed.
> 

1. Linux doesn't use stmp-fixinc.
2. You may have to be root to create it.

> 	Is gcc cross compile broken for glibc? From what I can see in gcc
> 	source, cross compile only works for newlib. These are in
> 	gcc/Makefile.in:
> 
> I wouldn't say that cross compiles using newlib work right.  They do manage
> to work, but only because we cripple libgcc by defining inhibit_libc.  Since
> most of these crippled gcc features are hard to use for embedded targets
> anyways, few people care.
> 
> There is a little support for cygwin builds that gets it right, but it
> requires that newlib be part of the source tree, e.g. a one-tree build,
> and it isn't very pretty.  There is no one-tree support for GNU libc, and
> I am not convinced that there should be.

Even if it does, I don't want to compiler my glibc every time when I
build a new C compiler.

> 
> We do have a standard way to support cross compiler builds using library
> supplied from elsewhere.  This is done via the --with-headers and --with-libs
> options.  This has been successfully used for vxworks cross compilers for a
> long time.

>From what I can tell in the top level configure.in, --with-headers and
--with-libs just copy header files and libraries to the tool dir. But

1. You may have to be root to create it.
2. In my case, they are already in the tool dir.

> 
> With GNU libc provided as source, there is the matter of bootstrapping the
> process.  You need to build and install a library before you can use
> --with-headers and --with-libs.  This would require doing something by hand,
> but you should only need to do it once, so it doesn't seem like it would be
> too hard.
> 
> I don't really know enough about GNU libc to know what the best way to build
> it is though. 
> 

1. I am not quite sure that glibc can be compiled within gcc.
2. I don't want to compile glibc within gcc.

It used to work fine. As I said before, the problem is the change to
the relative directory in gcc didn't take into account of the header
files and libraries for cross compile. It is very annoying. It took
me a while to figure out why cross compile no longer worked for Linux.
I had to tell other people that you had to "install" gcc before you
could build gcc as a cross-compiler.


-- 
H.J. Lu (hjl@gnu.org)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]