Subject: RE: HELP - Egcs 1.1.1

From: "Chagas, Jason" <[email-masked]>
Date: Tue, 23 Feb 1999 12:25:43 -0800

You need to tell it which compiler to use as well.  Otherwise it
defaults to 
	`gcc' which is of course the native compiler.

	Also, `--target' is meaningless for glibc because it's not a
compiler tool.  
	Configure was probably ignoring that option and again defaulting to
a native 
	build.

	Try something like this, assuming `arm-linux-gcc' is in your PATH:

	$ CC=arm-linux-gcc ./configure arm-linux --enable-add-ons
--prefix=whatever

Phil,

I ran ...

# CC=arm-linux-gcc ./configure arm-linux --build=i686-pc-linux-gnu
--prefix=/usr/local/arm/glibc/arm-linux-glibc -enable-add-ons

and it gave me this error...

checking installed Linux kernel header files... TOO OLD!
configure: error: GNU libc requires kernel header files from
Linux 2.0.10 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 2.0.10 or later.  This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.

So I searched for 'version.h' ...

[/]# find . -name "version.h" -type f
./home/chagas/egcs/egcs-1.1.1/gcc/f/version.h
./home/chagas/glibc/glibc-2.0.111/version.h
./home/chagas/linux-2.2.0/linux/arch/i386/math-emu/version.h
./usr/src/linux-2.0.36/include/linux/version.h

and ran ...

# CC=arm-linux-gcc ./configure arm-linux --build=i
686-pc-linux-gnu --prefix=/usr/local/arm/glibc/arm-linux-glibc
-enable-add-ons --with-headers=/usr/src/linux-2.0.36/include

This time I got this error...

include -isystem /usr/src/linux-2.0.36/include -D_LIBC_REENTRANT -include
../inc
lude/libc-symbols.h     -DASSEMBLER   -o syscall.o
../sysdeps/unix/syscall.S: Assembler messages:
../sysdeps/unix/syscall.S:28: Error: Can not represent SWI relocation in
this ob
ject file format (0)
make[1]: *** [syscall.o] Error 1
make[1]: Leaving directory `/home/chagas/glibc/glibc-2.0.111/misc'
make: *** [misc/subdir_lib] Error 2

Which leads me to believe I have the wrong headers... Is that that case?
Where should I get the headers from?

Any ideas?

Thanks,

Jason

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

---

From: Philip Blundell <[email-masked]>
Date: Tue, 23 Feb 1999 21:18:00 +0000

>-enable-add-ons --with-headers=/usr/src/linux-2.0.36/include

Jason,

A similar problem again I think.  It matters which architecture the kernel 
is configured for, and it looks like this is an i586 kernel source tree.  In 
fact the i386 and ARM headers and APIs are similar enough that the compilation 
would very nearly have worked.  Fortunately the i386 does indirect syscalls 
rather differently.

The version.h file is only created during the kernel compile process.  You 
need to at least do `make config' to generate it.  Get hold of an ARM kernel 
source tree, check that ARCH is set to `arm' in the makefile, configure the 
kernel and then point the glibc compile at it.  If you put symlinks to the 
kernel source tree in $PREFIX/include/{asm,linux} you can do without the 
--with-headers option.

If that really was an ARM kernel source tree then I guess the problem must be 
somewhere else.

BTW, I noticed you're using glibc-2.0.111.  I have a feeling that version was 
rather buggy.  To save more grief in the future you might like to get the 
official 2.1 release from ftp://sourceware.cygnus.com/pub/glibc/ and try your 
luck with that instead.

p.

---

From: Tim Lindquist <[email-masked]>
Date: Wed, 24 Feb 1999 15:42:25 +1100

Jason, Phil,

Thanks for your input so far. I am coming up against many
of the hurdles Jason faced.

I currently have a problem compiling glibc2.1 in relation to
headers. I'll go into that in a moment.

First, I want to make absolutely sure that I AM configuring for
the right target. - I am trying to get a compiled linux kernel onto
the EBSA-285. After that I'll have to compile stuff to run on the
kernel.

Now, for the first pass (to get a kernel onto the board) is arm-linux
the correct target?

(I am confused about the arm-elf and other targets for standalone boards

- why aren't I using the stand alone board target?)

OK assuming that arm-linux is the right target, and I am cross
compiling on a solaris machine, then why do you recommend
the --build=i586-linux switch for configure on the web page at:

http://www.tazenda.demon.co.uk/phil/arm-tools.html

The dialog there says it is necessary, but it can be anything so long
as it is different to the host system type.

(I also noticed in one of the recent emails that you told Jason to use:
CC=arm-linux-gcc ./configure arm-linux --enable-add-ons
--prefix=whatever
So is the build switch actually unnecessary?)

I actually followed the latter route:
CC=arm-linux-gcc ../glibc-2.1/configure arm-linux
--prefix=/home/elph/tjl/work/sw --enable-add-ons

and came up against the header problem. ->

Now, I have a linux 2.1.126 tree (as the whole point of this exercise is
to be able to build
this kernel), so I edited the configure line:
CC=arm-linux-gcc ../glibc-2.1/configure arm-linux
--prefix=/home/elph/tjl/work/sw --enable-add-ons
--with-headers=/home/elph/tjl/work/sw/armlinux/linux/include

and got this error:
*** You should not compile the GNU libc without the `linuxthreads' and
*** `crypt' add-on.  Not using them risks to be incompatible with the
*** libraries of other systems.  Consider getting the add-ons and
restart
*** the configuration.
*** If you really mean to avoid those add-ons run configure again, now
*** using the extra parameter `--disable-sanity-checks'.

DO I REALLY NEED THESE?? I don't want to have to blast away glibc2.1 and

get the crypt package. I tried the --disable-sanity-checks switch and
got:

*** WARNING: Are you sure you do not want to use the `linuxthreads'
*** and `crypt' add-ons?
checking for symlinks in /home/elph/tjl/work/sw//include...
../glibc-2.1/configure: test: argument expected

Where to from here????

Thanks

---

From: Philip Blundell <[email-masked]>
Date: Wed, 24 Feb 1999 10:40:29 +0000

>Now, for the first pass (to get a kernel onto the board) is arm-linux

Yes.

>- why aren't I using the stand alone board target?)

`Stand alone' in this context implies no operating system.  It would probably 
work to compile the kernel itself with an arm-elf compiler in fact but you 
need arm-linux for user space things.  Also, the arm-elf support in the Linux 
versions of egcs is in a somewhat indeterminate state so I don't suggest you 
use it.

>[...]

I think the --build switch is certainly less necessary these days than it used 
to be.  Maybe you can get away without it altogether.  In that email to Jason 
I just forgot about it.

As you mention above, all that matters is that --build is different from the 
host.  Some parts of the configure system use this to determine whether 
they're cross-compiling or not.

>DO I REALLY NEED THESE??

Yes.  I think linuxthreads at least is pretty non-negotiable.  You can 
probably make do without crypt but I don't recommend it.

>I don't want to have to blast away glibc2.1 and

Just download crypt and linuxthreads and unpack them according to the 
instructions.  I don't follow what you're saying about `blasting away 
glibc2.1'.  What's the big deal?

p.

---

From: Tim Lindquist <[email-masked]>
Date: Thu, 25 Feb 1999 13:19:54 +1100

The saga continues:

I retrieved the crypt and linuxthreads
packages and untarred them under the glibc2.1
directory.

I then ran configure again, this time not trying to
disable sanity check. It failed on a test with:

checking for symlinks in
/home/elph/tjl/work/sw/armlinux/arm-linux/include...
../glibc-2.1/configure: test: argument expected

So I went back to the ARM tool web page and reread it. There was some
info for
compiling GCC which I hadn't thought relevant earlier, so I went and
added sym links
as described. But that wasn't the problem was it?

I'd already specified where to find linux headers with the special
configure option:
CC=arm-linux-gcc ../glibc-2.1/configure arm-linux
--prefix=/home/elph/tjl/work/sw/armlinux/arm-linux --enable-add-ons
--with-headers=/home/elph/tjl/work/sw/armlinux/linux/include

Are my prefixes the problem??

I used:

prefix=/home/elph/tjl/work/sw/armlinux

for binutils and egcs

and

prefix=/home/elph/tjl/work/sw/armlinux/arm-linux

for glibc2.1

What sym link is configure actually testing for?

Here is the transcript for that run of configure, if it helps.

tjl@gobbi $ CC=arm-linux-gcc ../glibc-2.1/configure arm-linux
--prefix=/home/elph/tjl/work/sw/armlinux/arm-linux --enable-add-ons
--with-headers=/home/elph/tjl/work/sw/armlinux/linux/include
loading cache ./config.cache
checking host system type... arm-unknown-linux-gnu
checking sysdep dirs... sysdeps/arm/elf crypt/sysdeps/unix
linuxthreads/sysdeps/unix/sysv/linux linuxthreads/sysdeps/pthread
linuxthreads/sysdeps/unix/sysv linuxthreads/sysdeps/unix
linuxthreads/sysdeps/arm linuxthreads/sysdeps/pthread/no-cmpxchg
sysdeps/unix/sysv/linux/arm sysdeps/unix/sysv/linux sysdeps/gnu
sysdeps/unix/common sysdeps/unix/mman sysdeps/unix/inet
sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix
sysdeps/arm/fpu sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754
sysdeps/libm-ieee754 sysdeps/generic/elf sysdeps/generic
checking for a BSD compatible install... ../glibc-2.1/scripts/install-sh
-c
checking whether ln -s works... yes
checking build system type... arm-unknown-linux-gnu
checking for gcc... arm-linux-gcc
checking version of arm-linux-gcc... egcs-2.91.60, ok
checking for make... make
checking version of make... 3.77, ok
checking for msgfmt... msgfmt
checking version of msgfmt... v. ?.??, bad
checking for makeinfo... no
configure: warning:
*** An auxiliary program is missing or too old;
*** some features will be disabled.
*** Check the INSTALL file for required versions.
checking whether the C compiler (arm-linux-gcc  ) works... no
checking whether the C compiler (arm-linux-gcc  ) is a cross-compiler...
(cached) yes
checking whether we are using GNU C... yes
checking build system type... arm-unknown-linux-gnu
checking how to run the C preprocessor... /lib/cpp
checking whether /home/elph/tjl/work/sw/armlinux/arm-linux/bin/as is GNU
as... yes
checking whether /home/elph/tjl/work/sw/armlinux/arm-linux/bin/ld is GNU
ld... yes
checking for mig... mig
checking whether ranlib is necessary... no
checking LD_LIBRARY_PATH variable... ok
checking for bash... /usr/bin/bash
checking for mawk... no
checking for gawk... no
checking for nawk... nawk
checking for perl... /usr/local/bin/perl
checking for install-info... no
checking for signed size_t type... yes
checking for libc-friendly stddef.h... yes
checking whether we need to use -P to assemble .S files... no
checking for assembler global-symbol directive... .globl
checking for .set assembler directive... no
checking for .symver assembler directive... yes
checking for ld --version-script... yes
checking for .previous assembler directive... yes
checking for assembler .weak directive... yes
checking for ld --no-whole-archive... yes
checking for gcc -fexceptions... yes
checking for DWARF2 unwind info support... no
checking for __builtin_expect... no
running configure fragment for
../glibc-2.1/linuxthreads/sysdeps/unix/sysv/linux
running configure fragment for ../glibc-2.1/sysdeps/unix/sysv/linux
checking installed Linux kernel header files... 2.0.10 or later
checking for symlinks in
/home/elph/tjl/work/sw/armlinux/arm-linux/include...
../glibc-2.1/configure: test: argument expected

---

From: Philip Blundell <[email-masked]>
Date: Thu, 25 Feb 1999 10:54:19 +0000

>What sym link is configure actually testing for?

It's looking to see if `scsi' and `net' are symlinks into the kernel source.

>/home/elph/tjl/work/sw/armlinux/arm-linux/include...

Does that directory actually exist?  If not, try creating it.  If that's not 
the problem you need to figure out why configure is blowing up and fix it 
appropriately.

p.

---

From: Tim Lindquist <[email-masked]>
Date: Fri, 26 Feb 1999 15:18:23 +1100

> It's looking to see if `scsi' and `net' are symlinks into the kernel source.

DO I need to put in links for these????
If I do, tell me where please.

> the problem you need to figure out why configure is blowing up and fix it

That directory exists, and has I added (was it necessary?) the links to

linux/include/asm-arm
linux/include/linux

How do I work out why configure is blowing up? just the log? here is the
tail of the log:

configure:2794: arm-linux-gcc  -nostdlib -nostartfiles -o conftest conftest.c
-lgcc >&5
/home/elph/tjl/work/sw/armlinux/arm-linux/bin/ld: warning: cannot find entry
symbol _start; defaulting to 02000074
/var/tmp/ccLRvZfa.o: In function `foo':
/var/tmp/ccLRvZfa.o(.text+0x1c): undefined reference to `__builtin_expect'
collect2: ld returned 1 exit status
configure:16: checking installed Linux kernel header files
configure:30: arm-linux-gcc -c  -nostdinc -isystem
/home/elph/tjl/work/sw/armlinux/lib/gcc-lib/arm-linux/egcs-2.91.60/include
-isystem /home/elph/tjl/work/sw/armlinux/linux/include  conftest.c 1>&5
In file included from configure:21:
confdefs.h:2: warning: undefining `__SIZE_TYPE__'
configure:131: checking for symlinks in
/home/elph/tjl/work/sw/armlinux/arm-linux/include

I wish I was on the same time zone as you guys - I'd have it working now if I
was.

Thanks

---

From: Philip Blundell <[email-masked]>
Date: Fri, 26 Feb 1999 10:30:48 +0000

>If I do, tell me where please.

No.  If they exist, it'll just refuse to continue until you delete them.

>That directory exists, and has I added (was it necessary?) the links to

That is only necessary if you don't use --with-headers.

>How do I work out why configure is blowing up? just the log? here is the

Just the log doesn't help.  You need to look at the script itself, find the 
offending line, and then work out what's wrong with it.  Nobody else has 
reported the problem so it's probably something specific to your system - 
maybe the version of the shell you're using or maybe something in the 
environment.

p.