fix multilib build problem

Nathan Sidwell nathan@codesourcery.com
Tue Apr 24 16:18:00 GMT 2007


In building an m68k-elf newlib I hit a multilib problem where configure 
complains about a cached value changing value:

configure: loading cache .././config.cache
configure: error: `CC' has changed since the previous run:
configure:   former value:  m68k-elf-gcc 
-B/home/nathan/newlib/m68k-elf/m68k-elf/m68000/newlib/ -isystem 
/home/nathan/newlib/m68k-elf/m68k-elf/m68000/newlib/targ-include -isystem 
/home/nathan/newlib/src/newlib/libc/include  -m68000
configure:   current value: m68k-elf-gcc 
-B/home/nathan/newlib/m68k-elf/m68k-elf/m68000/newlib/ -isystem 
/home/nathan/newlib/m68k-elf/m68k-elf/m68000/newlib/targ-include -isystem 
/home/nathan/newlib/src/newlib/libc/include -m68000
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm .././config.cache' and start over
configure: error: /bin/sh '../../../../../src/newlib/libc/configure' failed for libc
make[1]: *** [configure-target-newlib] Error 1
make[1]: Leaving directory `/home/nathan/newlib/m68k-elf'

As you can see the original CC value has two spaces just before the -m68000 
multilib.  I guess that duplicate space is getting stripped during some echo, 
but I didn't look very hard for that.  Instead I worked on having config-ml.in 
not produce the double space.

The spacing arises from two causes.
1) the code to produce the multilib options, produces a leading space:
     # find compiler flag corresponding to ${ml_dir}
     for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
       dir=`echo $i | sed -e 's/;.*$//'`
       if [ "${dir}" = "${ml_dir}" ]; then
         flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
         break
       fi
     done
  (that 's/@/ -/g' sed command)

2) the code to generate the processed CC_ value gives a trailing space:
	CC_=$CC' '
or
	for arg in ${CC}; do
	  case $arg in
	  -[BIL]"${ML_POPDIR}"/*)
	    CC_="${CC_}"`echo "X${arg}" | sed -n 
"s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n 
"s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
	  "${ML_POPDIR}"/*)
	    CC_="${CC_}"`echo "X${arg}" | sed -n 
"s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n 
"s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
	  *)
	    CC_="${CC_}${arg} " ;;
	  esac
	done

This patch changes (2) to not have a trailing space.  We'll get a leading space 
for the second alternative, but that appears harmless.

With that I was able to build a complete set of m68k multilibs. ok?

I'll see about pushing this patch to GCC.

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: all.diff
URL: <http://sourceware.org/pipermail/newlib/attachments/20070424/9bd8f732/attachment.ksh>


More information about the Newlib mailing list