arm-elf cross compiler problem with newlib

ananda.motte@philips.com ananda.motte@philips.com
Thu Oct 18 00:18:00 GMT 2001


I am trying to make a cross compiler for arm-elf on a i686-pc-cygwin host.

Package                       Status
binutils -2.10.1             configured and built
gcc-2.95.2                     configured and built

At this point any code (Kernel) can be compiled but any user space code requiring C library functions cannot be linked (crt0.o not found for arm-elf )

So I need to build newlib

I build gcc in two passes:

First create the links
cd /src/gcc/gcc-2.95.3
ln -s ../../newlib/newlib-1.9.0/newlib newlib
ln -s ../../newlib-1.9.0/libgloss libgloss

Point towards directory containing binutils
PATH=/tools/H-i686-pc-cygwin/bin:$PATH

Configure and make gcc (PASS 1)

cd /tmp/build
mkdir gcc-2.95.2-arm
cd gcc-2.95.2-arm


/tmp/build/arm-elf  --target=arm-elf  --prefix=/tools--exec-prefix=/tools/H-i686-pc-cygwin  --enable-languages=c --disable-threads --without-headers \
--with-gnu-as --with-gnu-ld  --with-newlib -v 2>&1 | tee configure.out

Configure works.

Then I build ( with Dinhibit_libc hack)

( cd gcc
  mv Make-target Make-target.orig
  sed -e '/^TARGET_LIBGCC2_CFLAGS/s/$/ -Dinhibit_libc -D__gthr_posix_h/' \
     -e 's/ _dvmd_lnx$/ _dvmd_tls/' \
      <Make-target.orig >Make-target
  mv Makefile Makefile.orig
  sed -e '/^TARGET_LIBGCC2_CFLAGS/s/$/ -Dinhibit_libc -D__gthr_posix_h/' \
     -e 's/ _dvmd_lnx$/ _dvmd_tls/' \
      <Makefile.orig >Makefile
)
make -w all-gcc install-gcc | tee make.out

Make works

Now
CC=arm-elf-gcc
I try to configure and make newlib-1.9.0

/src/newlib/newlib-1.9.0/configure --host=arm-elf --build=i686-pc-cygwin --prefix=/tools/H-i686=pc-cygwin/arm-elf  --enable-add-ons -v 2>&1 | tee configure.out

but configure fails ( ??? )..........
at testing of the arm-elf-gcc comiler on conftest.c as it cannot open crt0.o on linking.......................
See file configure.out

Therafter on invoking make :
make -w all install 2>&1 | tee make.out

All hell brakes loose at memchr.S.
See make.out

It's the first time I am making a cross compiler so if any one can help explain at what point I am doing something wrong it would be of great help. Thanks in advance.

(See attached file: configure.out)(See attached file: make.out)
configure.out
make.out
------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

-------------- next part --------------
Created "Makefile" in /tmp/build/newlib-1.9.0-arm
/tools/tools/H-i686-pc-cygwin/arm-elf/bin/ld: cannot open crt0.o: No such file or directory
collect2: ld returned 1 exit status
*** The command 'arm-elf-gcc -o conftest -g -O2   conftest.c' failed.
*** You must set the environment variable CC to a working compiler.
-------------- next part --------------
make: Entering directory `/tmp/build/newlib-1.9.0-arm'
make[1]: Entering directory `/tmp/build/newlib-1.9.0-arm/newlib'
make "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g -O2" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=-g -O2" "LDFLAGS=" "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo  " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/tools/tools/H-i686-pc-cygwin/arm-elf" "infodir=/tools/tools/H-i686-pc-cygwin/arm-elf/info" "libdir=/tools/tools/H-i686-pc-cygwin/arm-elf/lib" "prefix=/tools/tools/H-i686-pc-cygwin/arm-elf" "tooldir=/tools/tools/H-i686-pc-cygwin/arm-elf/arm-elf" "AR=arm-elf-ar" "AS=arm-elf-as" "CC=arm-elf-gcc" "LD=arm-elf-ld" "LIBCFLAGS=-g -O2" "NM=arm-elf-nm" "PICFLAG=" "RANLIB=arm-elf-ranlib" "DESTDIR=" DO=all multi-do
make[2]: Entering directory `/tmp/build/newlib-1.9.0-arm/newlib'
if [ -z "be nofmult be/nofmult" ]; then \
  true; \
else \
  rootpre=`pwd`/; export rootpre; \
  srcrootpre=`cd /src/newlib/newlib-1.9.0/newlib; pwd`/; export srcrootpre; \
  lib=`echo ${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$,\1,'`; \
  compiler="arm-elf-gcc"; \
  for i in `${compiler} --print-multi-lib 2>/dev/null`; do \
    dir=`echo $i | sed -e 's/;.*$//'`; \
    if [ "${dir}" = "." ]; then \
      true; \
    else \
      if [ -d ../${dir}/${lib} ]; then \
	flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
	if (cd ../${dir}/${lib}; make "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g -O2" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=-g -O2" "LDFLAGS=" "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo   " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/tools/tools/H-i686-pc-cygwin/arm-elf" "infodir=/tools/tools/H-i686-pc-cygwin/arm-elf/info" "libdir=/tools/tools/H-i686-pc-cygwin/arm-elf/lib" "prefix=/tools/tools/H-i686-pc-cygwin/arm-elf" "tooldir=/tools/tools/H-i686-pc-cygwin/arm-elf/arm-elf" "AR=arm-elf-ar" "AS=arm-elf-as" "CC=arm-elf-gcc" "LD=arm-elf-ld" "LIBCFLAGS=-g -O2" "NM=arm-elf-nm" "PICFLAG=" "RANLIB=arm-elf-ranlib" "DESTDIR=" \
			CFLAGS="-g -O2 ${flags}" \
			prefix="/tools/tools/H-i686-pc-cygwin/arm-elf" \
			exec_prefix="/tools/tools/H-i686-pc-cygwin/arm-elf" \
			CXXFLAGS="-g -O2 ${flags}" \
			LIBCFLAGS="-g -O2 ${flags}" \
			LIBCXXFLAGS="-g -O2 -fno-implicit-templates ${flags}" \
			LDFLAGS=" ${flags}" \
			all); then \
	  true; \
	else \
	  exit 1; \
	fi; \
      else true; \
      fi; \
    fi; \
  done; \
fi
make[3]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib'
true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g -O2  -mbig-endian" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=-g -O2" "LDFLAGS=-mbig-endian" "LIBCFLAGS=-g -O2  -mbig-endian" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo    " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/tools/tools/H-i686-pc-cygwin/arm-elf" "infodir=/tools/tools/H-i686-pc-cygwin/arm-elf/info" "libdir=/tools/tools/H-i686-pc-cygwin/arm-elf/lib" "prefix=/tools/tools/H-i686-pc-cygwin/arm-elf" "tooldir=/tools/tools/H-i686-pc-cygwin/arm-elf/arm-elf" "AR=arm-elf-ar" "AS=arm-elf-as" "CC=arm-elf-gcc" "LD=arm-elf-ld" "LIBCFLAGS=-g -O2  -mbig-endian" "NM=arm-elf-nm" "PICFLAG=" "RANLIB=arm-elf-ranlib" "DESTDIR=" DO=all multi-do
Making all in libc
make[4]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc'
Making all in stdlib
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/stdlib'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/stdlib'
Making all in ctype
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/ctype'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/ctype'
Making all in stdio
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/stdio'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/stdio'
Making all in string
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/string'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/string'
Making all in signal
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/signal'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/signal'
Making all in time
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/time'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/time'
Making all in locale
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/locale'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/locale'
Making all in sys
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/sys'
Making all in cygwin
make[6]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/sys/cygwin'
make[6]: Nothing to be done for `all'.
make[6]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/sys/cygwin'
Making all in .
make[6]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/sys'
make[6]: Nothing to be done for `all-am'.
make[6]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/sys'
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/sys'
Making all in reent
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/reent'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/reent'
Making all in errno
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/errno'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/errno'
Making all in misc
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/misc'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/misc'
Making all in machine
make[5]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/machine'
Making all in i386
make[6]: Entering directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/machine/i386'
arm-elf-gcc -DPACKAGE=\"newlib\" -DVERSION=\"1.9.0\"  -I. -I/src/newlib/newlib-1.9.0/newlib/libc/machine/i386  -I /src/newlib/newlib-1.9.0/newlib/libc/machine/i386/../../../libm/common -O2 -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -DWANT_IO_LONG_DBL -DWANT_PRINTF_LONG_LONG -D_COMPILING_NEWLIB -I./../../../targ-include -I/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/../../../libc/include -I/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/../../../../winsup/cygwin/include  -I/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/../../../../winsup/w32api/include -fno-builtin      -g -O2  -mbig-endian -c /src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S: Assembler messages:
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:17: Error: bad instruction `pushl %ebp'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:18: Error: bad instruction `movl %esp,%ebp'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:19: Error: bad instruction `pushl %edi'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:20: Error: bad instruction `movl 12(%ebp),%eax'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:21: Error: bad instruction `movl 16(%ebp),%ecx'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:22: Error: bad instruction `movl 8(%ebp),%edi'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:24: Error: bad instruction `xorl %edx,%edx'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:25: Error: bad instruction `testl %ecx,%ecx'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:26: Error: bad instruction `jz L1'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:28: Error: bad instruction `cld'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:29: Error: bad instruction `repnz'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:30: Error: bad instruction `scasb'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:32: Error: bad instruction `setnz %dl'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:33: Error: bad instruction `decl %edi'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:34: Error: bad instruction `decl %edx'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:35: Error: bad instruction `andl %edi,%edx'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:37: Error: bad instruction `movl %edx,%eax'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:39: Error: bad instruction `leal -4(%ebp),%esp'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:40: Error: bad instruction `popl %edi'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:41: Error: bad instruction `leave'
/src/newlib/newlib-1.9.0/newlib/libc/machine/i386/memchr.S:42: Error: bad instruction `ret'
make[6]: *** [memchr.o] Error 1
make[6]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/machine/i386'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc/machine'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib/libc'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/tmp/build/newlib-1.9.0-arm/be/newlib'
make[2]: *** [multi-do] Error 1
make[2]: Leaving directory `/tmp/build/newlib-1.9.0-arm/newlib'
make[1]: *** [all-multi] Error 2
make[1]: Leaving directory `/tmp/build/newlib-1.9.0-arm/newlib'
make: *** [all-target-newlib] Error 2
make: Leaving directory `/tmp/build/newlib-1.9.0-arm'


More information about the crossgcc mailing list