This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix multilib build problem


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

2007-04-24  Nathan Sidwell  <nathan@codesourcery.com>

	* config-ml.in: Avoid double spaces in CC, CXX, F77, GCJ and
	GFORTRAN values.

Index: config-ml.in
===================================================================
RCS file: /cvs/src/src/config-ml.in,v
retrieving revision 1.20
diff -c -3 -p -r1.20 config-ml.in
*** config-ml.in	14 Apr 2007 20:35:07 -0000	1.20
--- config-ml.in	24 Apr 2007 13:34:51 -0000
*************** if [ -n "${multidirs}" ] && [ -z "${ml_n
*** 789,799 ****
      ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
  
      if [ "${with_target_subdir}" = "." ]; then
! 	CC_=$CC' '
! 	CXX_=$CXX' '
! 	F77_=$F77' '
! 	GCJ_=$GCJ' '
! 	GFORTRAN_=$GFORTRAN' '
      else
  	# Create a regular expression that matches any string as long
  	# as ML_POPDIR.
--- 789,799 ----
      ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
  
      if [ "${with_target_subdir}" = "." ]; then
! 	CC_=$CC
! 	CXX_=$CXX
! 	F77_=$F77
! 	GCJ_=$GCJ
! 	GFORTRAN_=$GFORTRAN
      else
  	# Create a regular expression that matches any string as long
  	# as ML_POPDIR.
*************** if [ -n "${multidirs}" ] && [ -z "${ml_n
*** 802,812 ****
  	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
  
--- 802,812 ----
  	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
  
*************** if [ -n "${multidirs}" ] && [ -z "${ml_n
*** 814,824 ****
  	for arg in ${CXX}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    CXX_="${CXX_}"`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}"/*)
! 	    CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  	  *)
! 	    CXX_="${CXX_}${arg} " ;;
  	  esac
  	done
  
--- 814,824 ----
  	for arg in ${CXX}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    CXX_="${CXX_} "`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}"/*)
! 	    CXX_="${CXX_} "`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` ;;
  	  *)
! 	    CXX_="${CXX_} ${arg}" ;;
  	  esac
  	done
  
*************** if [ -n "${multidirs}" ] && [ -z "${ml_n
*** 826,836 ****
  	for arg in ${F77}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    F77_="${F77_}"`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}"/*)
! 	    F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  	  *)
! 	    F77_="${F77_}${arg} " ;;
  	  esac
  	done
  
--- 826,836 ----
  	for arg in ${F77}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    F77_="${F77_} "`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}"/*)
! 	    F77_="${F77_} "`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` ;;
  	  *)
! 	    F77_="${F77_} ${arg}" ;;
  	  esac
  	done
  
*************** if [ -n "${multidirs}" ] && [ -z "${ml_n
*** 838,848 ****
  	for arg in ${GCJ}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    GCJ_="${GCJ_}"`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}"/*)
! 	    GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  	  *)
! 	    GCJ_="${GCJ_}${arg} " ;;
  	  esac
  	done
  
--- 838,848 ----
  	for arg in ${GCJ}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    GCJ_="${GCJ_} "`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}"/*)
! 	    GCJ_="${GCJ_} "`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` ;;
  	  *)
! 	    GCJ_="${GCJ_} ${arg}" ;;
  	  esac
  	done
  
*************** if [ -n "${multidirs}" ] && [ -z "${ml_n
*** 850,860 ****
  	for arg in ${GFORTRAN}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    GFORTRAN_="${GFORTRAN_}"`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}"/*)
! 	    GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  	  *)
! 	    GFORTRAN_="${GFORTRAN_}${arg} " ;;
  	  esac
  	done
  
--- 850,860 ----
  	for arg in ${GFORTRAN}; do
  	  case $arg in
  	  -[BIL]"${ML_POPDIR}"/*)
! 	    GFORTRAN_="${GFORTRAN_} "`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}"/*)
! 	    GFORTRAN_="${GFORTRAN_} "`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` ;;
  	  *)
! 	    GFORTRAN_="${GFORTRAN_} ${arg}" ;;
  	  esac
  	done
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]