Subject: RE: HELP - Egcs 1.1.1

From: "Chagas, Jason" <[email-masked]>
Date: Wed, 3 Mar 1999 20:50:23 -0800

Hi Phil,

I built/installed "binutils" and "egcs" for "arm-linuxaout" [aparently]
successfully. Then I ran into problems compiling a "Hello World" application
with 'a.out':

#arm-linuxaout-gcc -v -c hello.c

Reading specs from
/usr/local/arm/lib/gcc-lib/arm-linuxaout/egcs-2.91.60/specs
gcc version egcs-2.91.60 19990113/philb (egcs-1.1.1 release)
 /usr/local/arm/lib/gcc-lib/arm-linuxaout/egcs-2.91.60/cpp -lang-c -v -undef
-D_
_GNUC__=2 -D__GNUC_MINOR__=91 -Dunix -Darm -Dlinux -D__unix__ -D__arm__
-D__linu
x__ -D__unix -D__arm -D__linux -Asystem(unix) -Asystem(posix) -Acpu(arm)
-Amachi
ne(arm) -D__CHAR_UNSIGNED__ -D__ARM_ARCH_2__ -D__APCS_26__ hello.c
/tmp/ccKF3lGx
.i
GNU CPP version egcs-2.91.60 19990113/philb (egcs-1.1.1 release) (ARM
GNU/Linux
with a.out)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/arm/lib/gcc-lib/arm-linuxaout/egcs-2.91.60/include
 /usr/local/arm/arm-linuxaout/include
End of search list.
hello.c:2: stdio.h: No such file or directory

I noticed that "/usr/local/arm/arm-linuxaout/sys-include" was not created.

Any ideas?

Thanks,

Jason
unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: "Chagas, Jason" <[email-masked]>
Date: Wed, 3 Mar 1999 20:50:35 -0800

Hi  "¿ÁÀ»¼®",

This is what you may want to do:

1)	Make sure you also have a "clean" installation with all the tools
and compilers working properly. I started with a "fresh" installation of
RedHat v5.2 on a x86 PC.
2)	Read http://www.tazenda.demon.co.uk/phil/arm-tools.html
<http://www.tazenda.demon.co.uk/phil/arm-tools.html)> ,
http://ssdl-redstone.stanford.edu/~zskiraly/salinux/
<http://ssdl-redstone.stanford.edu/~zskiraly/salinux/>  and
http://inkvine.fluff.org/~chris/arm-tools.html
<http://inkvine.fluff.org/~chris/arm-tools.html> . Print a hard copy of
these pages so you can refer to it as you follow my instructions below.
3)	Expand binutils v2.9.1.0.19a (apply patch
binutils-2.9.1.0.19a-arm-diff-981230.gz), EGCS 1.1.1 (apply patch
egcs-1.1.1-arm-diff-990113.gz) and GLIBC 2.1 (expand add ons -
glibc-linuxthreads-2.1.tar.gz and glibc-crypt-2.0.111.tar.gz).
4)	Build and install BINUTILS, EGCS and GLIBC (GLIBC is optional - if
you make a mistake here your system is hosed). You won't be able to compile
the ARM cross GLIBC if you don't have the latest compilers.
5)	Cleanup BINUTILS, EGCS and GLIBC build directories by running "make
distclean" for each of them. You don't want anything left around that could
affect your "arm-linux" cross build that you're about to start.
6)	Create a destination subdirectory. I put it under "/usr/local/arm".
7)	Now build the BINUTILS. Run './configure --target=arm-linux
--prefix=/usr/local/arm', 'make' and 'make install'.
8)	Add your arm-linux BINUTILS to your path
(PATH=/usr/local/arm/bin:$PATH).
9)	Download one of the latest kernel versions and expand it. I
downloaded Linux v2.2.0 and expanded it under '/home/chagas/linux-2.2.0'.
Also download the ARM patch and apply it (you'll need it later). Now create
symbolic links following Phil Blundell's instructions. I created the
'/usr/local/arm/arm-linux/include' directory, then created 'asm' and 'linux'
symbolic links.
10)	You're now ready to build the EGCS "C" compiler. Under the EGCS
subdirectory run './configure --target=arm-linux --prefix=/usr/local/arm'.
As soon as you hit "enter" you'll see something "Configuring for a
i686-pc-linux-gnu host". Write down that information on a piece of paper.
You may need it later. By the time "configure" finishes running a 'Makefile'
has been created.
11)	Modify 'Makefile' to add -Dinhibit_libc in CFLAGS. I just noticed
that Phillip Blundell removed this requirement from his instructions. I'm
not sure if it matters if you leave it out.
12)	Run 'make -i LANGUAGES=c'
13)	Run 'make -i LANGUAGES=c install'. Your cross "C" compiler is now
built and installed.
14)	If your goal is to build ARM-Linux kernels only you're done. Proceed
if you want to build applications.
15)	You need to make sure you have the latest headers. So go under the
directory where you expanded the kernel (v2.2.0), fix the Makefile with
"ARCH := arm" and "CROSS_COMPILE = /usr/local/arm/bin/arm-linux-". Then ran
"make config" followed by "make zImage". It doesn't not matter if the build
is completely successful. You just want to get the headers. Verify if the
headers were created (search for 'version.h' under /include). It might be a
good idea to modify the symbolic links that were created earlier point them
to these new headers (i.e. ln -s /home/chagas/linux-2.2.0/linux/include/asm
asm  and ln -s /home/chagas/linux-2.2.0/linux/include/linux linux) but it
may not be necessary.
16)	Create a separate subdirectory to receive the built GLIBC libraries.
I created a subdirectory called "/usr/local/arm/glibc/arm-linux-glibc". This
will be your "prefix" when building GLIBC.
17)	Now build GLIBC. Run "CC=arm-linux-gcc ./configure arm-linux
--build=i686-pc-linux-gnu --prefix=/usr/local/arm/glibc/arm-linux-glibc
-enable-add-ons --with-headers=/home/chagas/linux-2.2.0/linux/include". Note
the headers now point to the right place. Your "-build" switch is your host
that I asked you to write on a piece of paper. Run "make" and "make
install". This process can take hours.
18)	You may now want to finish building EGCS to get the C++ compiler
built. Go back to 'egcs' and run "./configure --target=arm-linux
--prefix=/usr/local/arm
--with-headers=/usr/local/arm/glibc/arm-linux-glibc/include
--with-libs=/usr/local/arm/glibc/arm-linux-glibc/lib". Note the 'glibc'
library files got copied when running 'configure'. Run 'make LANGUAGES="c
c++" and 'make LANGUAGES="c c++".
19)	DONE!!!! You now have all the ELF cross development tools for ARM.

Please let me know if these instructions work for you and if you had to
modify them.

Regards,

Jason

	----------
	From:  ¿ÁÀ»¼® [SMTP:[email-masked]]
	Sent:  Wednesday, March 03, 1999 7:58 PM
	To:  Chagas, Jason
	Subject:  Re: HELP - Egcs 1.1.1

	Hi...

	I have a question..

	I use brutus.
	and I will compile ARM-linux.
	so, I installed binutils and EGCS and glibc..

	but.. when I install binutils,
	1> tar zxvf binutils-2.9.1.0.19a.tar.gz
	  * I patched binutils.. (using
binutils-2.9.1.0.19a-arm-diff-981230)
	2> - Compile and install binutils-1.9.1.0.19a
	  > ./configure --target=arm-linux --prefix=where_you_want
	  > make
	     errors...
	         ../bfd/.libs/libbfd.a : could not read symbols:
Inout/output error
	         make[1]: *** [size] Error 1
	         make[1]: Leaving directory
'/second/DOWN/binutils/binutils-2.9.1.0.19a/binutils'
	         make: *** [all-binutils] Error2

	hmm..
	I don't know.....  why not..
	help me..

	It is difficult to send my question to mailing list..
	please send me your mail that you sent to mailing list.

	>Tim,
	>
	>Did you find a solution for the problem you described? I followed
	>Christophe's instructions step by step and everything seemed to
work fine
	>(after a few minor ajustments, that is) until I go back to finish
building
	>'EGCS'. That's when it fails with the error:
	>
	>checking whether the C compiler
(/home/chagas/egcs/egcs-1.1.1/gcc/xgcc
	>-B/home/c
	>hagas/egcs/egcs-1.1.1/gcc/ -g -O2 ) works... no
	>configure: error: installation or configuration problem: C compiler
cannot
	>create executables.
	>make: *** [configure-target-libiberty] Error 1
	>
	>Note I tested 'xgcc' and seems to run ok:
	>
	>#./xgcc -v
	>Reading specs from
/usr/local/arm/lib/gcc-lib/arm-linux/egcs-2.91.60/specs
	>Am I missing something?
	> ----------
	> From:  [email-masked]
	>[SMTP:[email-masked]]
	> Sent:  Friday, February 19, 1999 3:38 AM
	> To:  Tim Lindquist
	> Cc:  [email-masked]
	> Subject:  Re: HELP - Egcs 1.1.1
	>
	> Let me sum up stages and tell me where it fails, I'll help you
	>
	> - Compile and install binutils-1.9.1.0.19a
	> ./configure --target=arm-linux --prefix=where_you_want
	> make
	> make install
	> - add where_you_want/bin in your PATH
	> - Untar egcs, patch it, find . -name "*.rej"
	> - enter egcs dir, then ./configure --target=arm-linux --
	> prefix=wher_you_want_the_same
	> - modify makefile to add -Dinhibit-libc in CFLAGS
	> - make -i LANGUAGES=c
	> - make -i LANGUAGES=c install
	>
	> compile glibc, with 
	> prefix=/where_you_want_not_the_same_as_above
	> make, make install
	>
	> go back in egcs,
	> ./configure --prefix=same_place_as_first_time --with-
	> headers=/where_you_put_glibc/include --with-
	> libs=/where_you_put_glibc/lib --target=arm-linux
	> make LANGUAGES="c c++" 
	> make LANGUAGES="c c++" install
	>
	> DONE
	>
	> Christophe
	>
	>
	> > 
	> > > I'm having problems building a cross compiler on solaris.
	> > > When running  make, I get:
	> > >
	> > > checking whether the C compiler (arm-linux-gcc -g -O2 )
works...
	>no
	> > > configure: error: installation or configuration problem: C
	>compiler
	> > > cannot create executables.
	> > > gmake: *** [configure-target-libiberty] Error 1
	> > >
	> > > Before I got to this stage, I had the egcs-1.1.1 source,
	> > > and got 3 patch files for it that I applied consecutively:
	> > >
	> > > egcs-1.1.1-prerelease-2-arm-diff-981117.gz
	> > > egcs-1.1.1-prerelease-2-arm-diff-981117-981124
	> > > egcs-1.1.1-prerelease-2-arm-diff-981124-981125
	> > >
	> > > I got the following message during the final patch:
	> > >
	> > > patching file `gcc/f/intdoc.texi'
	> > > Reversed (or previously applied) patch detected!  Assume -R?
[y]
	> > >
	> > > I created an egcs-1.1.1-build dir, and from there ran:
	> > >
	> > >  ../egcs-1.1.1/configure --target=arm-linux
	> > > --prefix=/home/elph/tjl/work/sw/armlinux/
	> > >
	> > > and then ran make.
	> > >
	> > > What am I doing wrong?
	> > 
	>

---

From: "Chagas, Jason" <[email-masked]>
Date: Thu, 4 Mar 1999 12:47:47 -0800

A couple of observations: you don't have to build and install the
latest
	binutils, egcs and glibc as your native tools on the x86 to build
the
	cross-tools. (If you just want to , that is fine. But why compilcate
life ?)
	Mine worked perfectly fine on a Redhat 5.1 default native toolchain.
(Actually,
	it might be a better idea to use the defailt, older toolchain for
native
	stuff.) 

You're right. I think what happened was that an earlier attempt to run GLIBC
"./configure" failed because I didn't call it with "CC=arm-linux-gcc". So I
got back a message saying the compiling tools were too old. I guess it would
have been if it was compiling for x86. I'm attaching my recorded list of
steps to get the ARM cross build going so you can see what happened. Actualy
this list should be a lot longer if I were to list every single detail.

Jason

-------------

Odyssey for Building an ARM Development Environment:

1)	UnTARed 'binutils', applied patch and './configure
--target=arm-linux --prefix=/usr/local/arm', 'make' and 'make install'.
2)	Added '/usr/local/arm/bin' to the path.
3)	Expanded Linux v2.2.0 under '/home/chagas/linux-2.2.0', created
'/usr/local/arm/arm-linux/include' directory and created simbolic 'asm' and
'linux' simbolic links.
4)	UnTARed 'egcs 1.1.1', applied patch and './configure
--target=arm-linux --prefix=/usr/local/arm'.
5)	Modified 'Makefile' to add -Dinhibit_libc in CFLAGS
6)	Ran 'make -i LANGUAGES=c'
7)	Ran 'make -i LANGUAGES=c install'
8)	Create '/usr/local/arm/glibc/arm-linux-glibc' subdirectory to take
the libs.
9)	UnTARed 'glibc' and "add ons".
10)	Ran ./configure --target=arm-linux
--prefix=/usr/local/arm/glibc/arm-linux-glibc -enable-add-ons. 'configure'
complained about old versions of 'gcc' installed by RedHat v5.2.
11)	Installed latest 'binutils' and 'egcs' for x86.
12)	Ran glibc's  './configure --target=arm-linux
--prefix=/usr/local/arm/glibc/arm-linux-glibc -enable-add-ons' again.  It
ran successfully this time.
13)	Ran 'make' and 'make install' successfully.
14)	Went back to 'egcs' and ran './configure --target=arm-linux
--prefix=/usr/local/arm
--with-headers=/usr/local/arm/glibc/arm-linux-glibc/include
--with-libs=/usr/local/arm/glibc/arm-linux-glibc/lib'. It returned the
following errors:

	Created "Makefile" in /home/chagas/egcs/egcs-1.1.1 using "mt-frag"
	conftest.c:0: malformed option `-D inhibit-libc'
	*** The command 'gcc -o conftest -g -O2 -Dinhibit-libc   conftest.c'
failed.
	*** You must set the environment variable CC to a working compiler.

15)	Edited 'Makefile' and removed reference to '-Dinhibit_libc'.
16)	Ran './configure --target=arm-linux --prefix=/usr/local/arm
--with-headers=/usr/local/arm/glibc/arm-linux-glibc/include
--with-libs=/usr/local/arm/glibc/arm-linux-glibc/lib' again.
17)	Ran 'make LANGUAGES="c c++" and got the following errors:

(/home/chagas/egcs/egcs-1.1.1/gcc/xgcc -B/home/c

18)	However, 'xgcc' seems to work fine:

	#./xgcc -v
	Reading specs from

19)	However,  'glibc' was built for x86 instead of ARM. So I go back to
'glibc', ran "# CC=arm-linux-gcc ./configure arm-linux
--build=i686-pc-linux-gnu --prefix=/usr/local/arm/glibc/arm-linux-glibc
-enable-add-ons --with-headers=/usr/src/linux-2.0.36/include", make and
"make install". Note "-with-headers" switch point to the x86 kernel headers
currently installed the system.
20)	It complained the kernel headers were too old. So I unTARed the
kernel v2.2.0, applied the ARM patch, fixed the Makefile with "ARCH := arm"
and "CROSS_COMPILE = /usr/local/arm/bin/arm-linux-". Then ran "make config"
followed by "make zImage". I verified if the headers were created.
21)	Ran "CC=arm-linux-gcc ./configure arm-linux
--build=i686-pc-linux-gnu --prefix=/usr/local/arm/glibc/arm-linux-glibc
-enable-add-ons --with-headers=/home/chagas/linux-2.2.0/linux/include". Note
the headers now point to the right place. Also ran "make" and "make install"
successfully.
22)	At this point I was able to cross compile and link a "Hello world"
application after copying contents of
"/usr/local/arm/glibc/arm-linux-glibc/lib" to "/usr/local/arm/arm-linux/lib"
23)	I went back to 'egcs' and ran "#./configure --target=arm-linux
--prefix=/usr/local/arm
--with-headers=/usr/local/arm/glibc/arm-linux-glibc/include
--with-libs=/usr/local/arm/glibc/arm-linux-glibc/lib" followed by "make
LANGUAGES="c c++". I noticed the 'glibc' library files got copied when
running 'configure'. These are some of the errors returned:

	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h: In function
`fmodl':
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h:365: unknown
register nam
	e `ax' in `asm'
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h: In function
`pow':
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h:376: unknown
register nam
	e `st(1)' in `asm'
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h: In function
`powf':
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h:376: unknown
register nam
	e `st(1)' in `asm'
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h: In function
`powl':
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h:376: unknown
register nam
	e `st(1)' in `asm'
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h: In function
`floatformat
	_to_double':
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h:495:
inconsistent operand
	 constraints in an `asm'
	/usr/local/arm/arm-linux/sys-include/bits/mathinline.h:495:
inconsistent operand
	 constraints in an `asm'
	make[1]: *** [floatformat.o] Error 1
	make[1]: Leaving directory
`/home/chagas/egcs/egcs-1.1.1/arm-linux/libiberty'
	make: *** [all-target-libiberty] Error 2

24)	Aparently, things were in a unknown state. So I removed everything
(binutils, egcs and glibc) and re-started all the steps from scratch again.
This time I was successful building everything including the EGCS C++
compiler.