Problems compiling newlib under cygwin

Fernando Ramos framos@hypercom.com
Wed May 24 19:54:00 GMT 2006


Thanks for your help Dave, but still I do not think that's the problem.

I'm pretty sure I'm using the same --prefix for both the bootstrap
compiler and newlib.
Now, this is what I do for the bootstrap compiler:
../configure -v --quiet --target=arm-elf
--prefix=--prefix=/usr/gcc4.1/arm-elf-4.1.0 --with-newlib
--without-headers --with-gnu-as --with-gnu-ld --disable-shared
--enable-languages=c,c++"
make all-gcc
make install-gcc 

My understanding is that I need to do "make all-gcc" "make install-gcc",
or should I use " make install" instead?

Here's the script I'm using to build the toolchain if that helps:

build-arm.sh:

#! /bin/sh

# Configuration area
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/WINNT/syste
m32:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem:/cygdrive/c/WINNT/
system32/nls:/cygdrive/c/WINNT/system32/nls/ENGLISH:

base_directory=/usr/gcc4.1
target=arm-elf
program_prefix=MyCompany-

binutils_build=$base_directory/binutils
binutils_source=$base_directory/binutils-2.16.1

toolchain_prefix=$base_directory/arm-elf-4.1.0

gcc_build=$base_directory/gcc
gcc_source=$base_directory/gcc-4.1.0

newlib_build=$base_directory/newlib
# 1.14.1 is the cvs cut at 05/22/2006
newlib_source=$base_directory/newlib-1.14.1

gdb_build=$base_directory/gdb
gdb_source=$base_directory/gdb-6.4


# binutils options
#   Enable interwork and multilib to support both arm and thumb code
binutils_options="-v --quiet --enable-interwork --enable-multilib"
#   disable building NLS tables
binutils_options="$binutils_options --with-gnu-ld --with-gnu-as
--disable-nls"

# bootstrap gcc options
gcc_boot_options="--with-newlib --without-headers --with-gnu-as
--with-gnu-ld"
gcc_boot_options="$gcc_boot_options --disable-shared
--enable-languages=c,c++"


# gcc options
#   Enable interwork to support both arm and thumb code.
gcc_options=--enable-interwork
#   Enable multilib so that we build the interwork and thumb code
libraries
gcc_options="$gcc_options --enable-multilib"
#   The only compilers needed are the C and C++
gcc_options="$gcc_options --enable-languages=c,c++"
#   Use newlib because this is an embedded target and we need a small C
library
gcc_options="$gcc_options --with-gnu-as --with-gnu-ld --with-newlib"
gcc_options="$gcc_options
--with-headers=$newlib_source/newlib/libc/include"
gcc_options="$gcc_options --disable-threads --enable-target-optspace"


# newlib options
#   Enable interwork because we support thumb code
newlib_options=--enable-interwork
#   Enable multilib so that we build the interwork and thumb code
libraries
newlib_options="$newlib_options --enable-multilib --enable-interwork"
#   Enable optspace - optimize libraries for space, not speed
newlib_options="$newlib_options --enable-target-optspace"
#   Enable multithread because this will be used from multiple processes
newlib_options="$newlib_options --enable-newlib-multithread"
#   Disable floating point support for the printf family
newlib_options="$newlib_options --disable-newlib-io-float"
#   The system calls are provided by functions in the OS
newlib_options="$newlib_options --disable-newlib-supplied-syscalls"
#   Use gnu ld because ???
newlib_options="$newlib_options --with-gnu-as --with-gnu-ld"


# gdb options
#   Enable interwork to support both arm and thumb code
gdb_options=--enable-interwork
#   Enable multilib to support both arm and thumb code
gdb_options="$gdb_options --enable-multilib"
#   Disable nls on cygwin because otherwise we get an error regarding
libintl.a
gdb_options="--with-gnu-ld --with-gnu-as --disable-nls"


#End of configuration area



if [ ! $1 ]; then
echo Specify one of the following arguments:
echo "  all          to build all utilities"
echo "  binutils     to build binutils"
echo "  gccBootStrap to build the bootstrap compiler"
echo "  newlib       to build newlib"
echo "  gcc          to build the gnu compiler collection"
echo "  gdb          to build gdb"
exit
fi



case $1 in all | binutils)
echo "Build binutils"
echo "Build binutils" > status
if test ! -d $binutils_build; then
  mkdir $binutils_build
  cd $binutils_build;
else
  cd $binutils_build
  make clean;
fi
make clean
$binutils_source/configure --target=$target --prefix=$toolchain_prefix
--program-prefix=$program_prefix $binutils_options
make all
make install
make info
;;
esac

export PATH="$PATH:$toolchain_prefix/bin"

case $1 in all | gccBootStrap)
echo "Build gcc bootstrap compiler"
echo "Build gcc bootstrap compiler" > status
if test ! -d $gcc_build; then
  mkdir $gcc_build
  cd $gcc_build;
else
  cd $gcc_build
  make clean;
fi
$gcc_source/configure -v --quiet --target=$target
--prefix=$toolchain_prefix --program-prefix=$program_prefix
$gcc_boot_options
make all-gcc
make install-gcc
;;
esac

case $1 in all | newlib)
echo "Build newlib"
echo "Build newlib" > status
if test ! -d $newlib_build; then
  mkdir $newlib_build
  cd $newlib_build;
else
  cd $newlib_build
  make clean;
fi
$newlib_source/configure -v --quiet --target=$target
--prefix=$toolchain_prefix --program-prefix=$program_prefix
$newlib_options
make all
make install
make info
make html
;;
esac

case $1 in all | gcc)
echo "Build gcc"
cd $gcc_build
make all
make install
make info
make html
;;
esac

case $1 in all | gdb)
echo "Build gdb"
echo "Build gdb" > status
if test ! -d $gdb_build; then
  mkdir $gdb_build
  cd $gdb_build;
else
  cd $gdb_build
  make clean;
fi
$gdb_source/configure -v --quiet --target=$target
--prefix=$toolchain_prefix --program-prefix=$program_prefix $gdb_options
make all
make install
make info
;;
Esac


Fernando Ramos
Senior Software Engineer
Hypercom Corp.

-----Original Message-----
From: Dave Korn [mailto:dave.korn@artimi.com] 
Sent: Wednesday, May 24, 2006 9:08 AM
To: Fernando Ramos; newlib@sources.redhat.com
Subject: RE: Problems compiling newlib under cygwin

On 24 May 2006 16:41, Fernando Ramos wrote:

> I'm trying to generate a gcc toolset for arm-elf. To that effect I'm 
> using binutils 2.16.1, gcc 4.1.0 and a newlib image from cvs from
> 05/22/2006 (I have tried newlib-1.14.0 with the same results, by the 
> way).
> 
> I have created a bootstrap compiler for gcc 4.1.0 and then went ahead 
> and tried the following configuration for newlib:
> ../configure -v --quiet --target=arm-elf 
> --prefix=/usr/gcc4.1/arm-elf-4.1.0 --enable-interwork 
> --enable-multilib \ --enable-target-optspace  
> --enable-newlib-multithread --disable-newlib-io-float 
> --disable-newlib-supplied-syscalls \ --with-gnu-as --with-gnu-ld

  Did you configure your compiler with the exact same --prefix?  Have
you run "make install" on the bootstrap compiler, or are you trying to
build newlib with the freshly built compiler?

> I found this problem when issuing a "make all":
> 
> /bin/sh: arm-elf-cc: command not found

> I think this is the relevant portion of
> newlib/arm-elf/newlib/config.log:

> configure:2141: checking for gcc
> configure:2167: result: arm-elf-cc 
> -B/usr/gcc4.1/newlib/arm-elf/newlib/
> -isystem /usr/gcc4.1/newlib/arm-elf/newlib/targ-include -isystem 
> /usr/gcc4.1/newlib-1.14.1/newlib/libc/include

  This use of a -B argument suggests it's getting mixed up between the
freshly built compiler in your build tree and the installed (or perhaps
not yet
installed) version in --prefix.

> uh?? there's nothing called "arm-elf-cc" in my 
> /usr/gcc4.1/arm-elf-4.1.0/bin directory. I guess it should be 
> arm-elf-gcc ? maybe this is something related to cygwin or to the 
> version of autoconf used (autoconf-2.5x) ?

  You could look at lines 2141 to 2167 of the configure script, and see
why it chooses that name.  My guess is that it's a
last-chance-default-fallback guess.

> what if I hack the thing horribly and make a copy of arm-elf-gcc as 
> arm-elf-cc ?

  In principle that could work, but you'd need to know /which/ compiler
to use.  You could also use a softlink or perhaps set CC= in your
environment, but really this problem is a sign of some underlying error
that needs fixing.
My first guess is that you used different --prefix settings for gcc and
newlib.


    cheers,
      DaveK
--
Can't think of a witty .sigline today....



More information about the Newlib mailing list