This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: uClinux/arm-elf-linux


John:


> I'm trying to build uClibc with an arm-elf-gcc I built using
> gcc-2.95.2 and newlib-1.9.0, I don't know if the --with-newlib has
> polluted this gcc as far as using it to build uClibc? It was the
> only way I could find to get a working arm cross gcc from source.

I haven't looked at it lately, but I *think* all the --with-newlib
does is change how a few of gcc's internal libraries get built.  I
think that newlib contains some code that is also included in libgcc,
and to prevent clashes the --with-newlib option causes libgcc to defer
to the copy in newlib...  Can anyone confirm this?

> The host is i686-pc-cygwin, I know this is sick, but if I can make
> it work it fits in much better with the rest of our tools.

If you can, at least try it first under Linux, until you get the hang
of it.  But others have gotten cross compilers to build under Cygwin,
so you should too... eventually!

> When I run a make menuconfig on the uClinux-2.4.x source it
> complains about not being able to find arm-elf-linux-gcc. It seems
> it does still want this flavour of gcc.

What does CROSS_COMPILE in the top-level Linux makefile say?  Change
it.  :^)

> One thing that looked very bad to me in the uClibc error output was
> a message at the very beginning about unknown operand true. When I
> ran the CRLF converter I only ran it on the uClibc source tree,
> maybe I need to run it through all of the system header directories?

Don't know if it will help, but it couldn't hurt--- tr is pretty
benign, I think.

> I've read everything I can find about including appropriate target
> headers and I'm still not clear on the details. I guess I'm in the
> stage of mucking it up a few times as you said. Once I get this
> straightened out I am willing to try to document it as an example in
> the FAQ if its deemed that my simple contribution can help prevent
> the savants here from having to answer the same questions over and
> over again.

This is going to be a major part of a book I'm working on, that I may
actually finish if you guys keep cheering me on (hint hint)...

Maybe the following will help...

The "gcc" sources contain not only the various applications that make
up gcc, but also some libraries that gcc uses in cross-compiled code.
One in particular that comes to mind is called libgcc, but there are
several others--- including portions of GNU's C++ runtime library
(which seems contradictory to gcc's position on a C runtime, except
that C++ exceptions bind the library code tightly to the compiler,
where most of a C library is compiler-neutral?).

As an example of what these libraries do, consider that the Hitachi SH
can't do arbitrary integer shifts, i.e. n << 26, so gcc emits calls to
a library function to do this--- rather than try to brute-force it
with inline code.  Ditto for floating-point emulation.  These
libraries are included with gcc, because they aren't C/C++
libraries--- they're "helper functions" for the compiler.

The gcc build process first builds a cross compiler called "xgcc",
then uses that cross compiler (which eventually becomes "the cross
compiler" proper) to build all of those libraries.  You need headers
for the *target* system here, because the code xgcc is producing will
run on the target system, not the host system, and parts of the
libraries themselves are in C and use #includes.

Newlib headers are usually used here, because they're usable directly
from the tarball.  Glibc's headers, on the other hand, get generated
during the build process--- there are no raw header files that can be
used to build things with until the library itself is built, a kind of
chicken-and-egg problem that newlib avoids.

So for uClinux, you aren't trying to build newlib--- you're only using
its headers long enough to get the cross compiler's libraries built.

Aside: to stop the gcc build process before it builds all of those
libraries, you do "make all-gcc install-gcc" instead of "make all
install".  You still end up with some target-related code, but not the
whole shebang.

> make[2]: Entering directory `/usr/src/uClibc/misc/assert'
> arm-elf-gcc  -Wall -Os -fno-builtin -nostdinc  -Dlinux -D__linux__
> -I../../inclu
> de -I/usr/local/lib/gcc-lib/arm-elf/2.95.2/include -I. -D__LIBC__   -DNDEBUG
> -D
> __HAS_NO_MMU__ -c __assert.c -o __assert.o
> Assembler messages:
>  for reading.open
> : No such file or directory
> make[2]: *** [__assert.o] Error 1
> make[2]: Leaving directory `/usr/src/uClibc/misc/assert'
> make[1]: *** [_dir_assert] Error 2
> make[1]: Leaving directory `/usr/src/uClibc/misc'
> make: *** [_dir_misc] Error 2

Ooh, this is coming from the assembler...

Do you have disk space?


b.g.
-- 
Bill Gatliff
bgat@open-widgets.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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