This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Crosscompiler: gcc 3.1 on linux for sparc + buildscript


I have build a gcc3.1 cross compiler for sparc solaris but I have some concerns about the way I am build the compiler..
Basically the script can create a cross compile using gcc-3.0.4 or gcc-3.1 distribution plus binutils-2.12.tar.

Here are my concerns:

When using gcc-3.0.4 I need to patch the distributed gcc-3.0.4/libstdc++-v3/configure.in file in order to pickup the right bits headers file
see previous posting on this mailing list http://sources.redhat.com/ml/crossgcc/2002-q2/msg00077.html).
I am pretty sure here in what I am doing, so no problem..

When using gcc-3.1 I have a similar patch to apply to gcc-3.1/libstdc++-v3/configure.in file but this time the patch will also switch off
these line from configure.in

AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)
AC_DEFINE(HAVE_ATANF)
AC_DEFINE(HAVE_CEILF)
AC_DEFINE(HAVE_COPYSIGN)
AC_DEFINE(HAVE_COPYSIGNF)
AC_DEFINE(HAVE_COSF)
AC_DEFINE(HAVE_COSHF)
AC_DEFINE(HAVE_EXPF)
AC_DEFINE(HAVE_FABSF)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_FINITEF)
AC_DEFINE(HAVE_FLOORF)
AC_DEFINE(HAVE_FMODF)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_ISINFF)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISNANF)
AC_DEFINE(HAVE_LDEXPF)
AC_DEFINE(HAVE_LOG10F)
AC_DEFINE(HAVE_LOGF)
AC_DEFINE(HAVE_MODFF)
AC_DEFINE(HAVE_POWF)
AC_DEFINE(HAVE_SINF)
AC_DEFINE(HAVE_SINHF)
AC_DEFINE(HAVE_SQRTF)
AC_DEFINE(HAVE_TANF)
AC_DEFINE(HAVE_TANHF)

If I don't do that I will fall into compilation errors like those posted in message (http://sources.redhat.com/ml/crossgcc/2002-q2/msg00351.html)
can somebody tell me if is acceptable to patch the configure.in file in this way ?

-Corrado


*** configure.in	Tue Aug 28 17:19:07 2001
--- configure.in.patched	Thu Jun 27 10:52:49 2002
*************** if test -n "$with_cross_host" || test x"
*** 179,184 ****
--- 179,197 ----
  	# AC_FUNC_MMAP
  	AC_DEFINE(HAVE_MMAP)
  	;;
+     *-solaris*)
+ 	# We assume newlib.  This lets us hard-code the functions we know
+ 	# we'll have.
+ 	AC_DEFINE(HAVE_FINITE)
+ 	AC_DEFINE(HAVE_ISNAN)
+ 	AC_DEFINE(HAVE_ISNANF)
+ 	AC_DEFINE(HAVE_ISINF)
+ 	AC_DEFINE(HAVE_ISINFF)
+ 
+ 	os_include_dir="config/os/solaris/solaris2.7"
+ 
+ 	# need to check for faster f versions of math functions, ie sinf?
+ 	;;
      *)
  	# We assume newlib.  This lets us hard-code the functions we know
  	# we'll have.
*** configure.in	Thu Jun 27 11:17:41 2002
--- configure.in	Thu Jun 27 11:18:20 2002
*************** if test -n "$with_cross_host" || test x"
*** 156,161 ****
--- 156,165 ----
        GLIBCPP_CHECK_WCHAR_T_SUPPORT
        os_include_dir="config/os/mingw32"
        ;;
+     *-solaris*)
+       os_include_dir="config/os/solaris/solaris2.7"
+       AC_DEFINE(HAVE_HYPOT)
+       ;;
      *)
        os_include_dir="config/os/newlib"
        AC_DEFINE(HAVE_HYPOT)
*************** if test -n "$with_cross_host" || test x"
*** 164,169 ****
--- 168,175 ----
  
    case "$target_alias" in
      *-mingw32*)
+       ;;
+     *-solaris*)
        ;;
      *)
        # GLIBCPP_CHECK_STDLIB_SUPPORT
#!/bin/bash 

TOPDIR=`pwd`
BINUTILSDISTO_LIST="binutils-2.12"
GCCDISTO_LIST="gcc-3.0.4 gcc-3.1"
TARFLAGS=xf
TARDIR=$TOPDIR/Zipped
PREFIX=

TARGET_LIST="sparc-sun-solaris"


###############################################################################
#
# Function    :
# Description :
#
###############################################################################

read_target()
{
  
  echo
  echo Linux crosscompiler building script,
  echo

  #
  # only prompt if we're missing information
  #
  if [ x${PREFIX} = x ] || [ x${TARGET} = x ] || [ x${TARDIR} = x ] ; then

     echo ""
     PS3="Please select a target: "
     select TARGET in ${TARGET_LIST};
	 do echo; break; done

     echo ""
     PS3="Please select a GCC distribution: "
     select GCCDISTO in ${GCCDISTO_LIST};
	 do echo; break; done

     echo ""
     PS3="Please select a binutils distribution: "
     select BINUTILSDISTO in ${BINUTILSDISTO_LIST};
	 do echo; break; done

     PREFIX=${TOPDIR}/${TARGET}_${GCCDISTO}

     echo ""
     echo "Install the tools where?"
     read -p "[${PREFIX}]: "

     if [ x${REPLY} != x ]; then 
	PREFIX=$REPLY;
     fi
 
     echo ""
     echo "Tarballs are where?"
     read -p "[${TARDIR}]: "

     if [ x${REPLY} != x ]; then 
	TARDIR=${REPLY}; 
     fi

  fi

  #
  # test that we have write permissions to the install dir
  #
  mkdir -p ${PREFIX}
  touch ${PREFIX}/test-if-write
  if [ ! -f ${PREFIX}/test-if-write ]; then
      echo "You don't appear to have write permissions to ${PREFIX}."
      echo "You must fix that before continuing."
      exit
  else 
      rm -f ${PREFIX}/test-if-write
  fi

  echo "----------------------------------------------------------------------"
  echo Building for:
  echo "    --target=$TARGET"
  echo "    --prefix=$PREFIX"
  echo "    tarballs are at $TARDIR"

  export PATH=${PATH}:${PREFIX}/bin
}


###############################################################################
#
# Function    :
# Description :
#
###############################################################################

prepare_headers_and_libs()
{
  echo ------------------------------------------------------------------------
  echo 
  echo Preparing headers end libs for $TARGET target
  echo 

  case $TARGET in

      sparc-sun-solaris)

          mkdir ${PREFIX}/copied-includes
          mkdir ${PREFIX}/copied-libs
	  cd ${PREFIX}/copied-includes
	  gunzip -c ${TARDIR}/${TARGET}_incs.tar.gz | tar $TARFLAGS -
	  cd ${PREFIX}/copied-libs
	  gunzip -c ${TARDIR}/${TARGET}_libs.tar.gz | tar $TARFLAGS -
	  cd ${PREFIX}/copied-libs

 	  ;; 
  esac
}

###############################################################################
#
# Function    :
# Description :
#
###############################################################################

build_binutils()
{
  echo ------------------------------------------------------------------------
  echo
  echo Building binutils ${BINUTILSDISTO}
  echo
  

  cd ${TOPDIR}
  tar xzf ${TARDIR}/${BINUTILSDISTO}.tar.gz 
  mkdir ${TOPDIR}/${BINUTILSDISTO}-build; 
  cd ${TOPDIR}/${BINUTILSDISTO}-build

  ../${BINUTILSDISTO}/configure --target=$TARGET --prefix=$PREFIX > ${PREFIX}/Build.log 2>&1
  make all install >> ${PREFIX}/Build.log 2>&1
  cd ${TOPDIR}

  #
  # test to see if this step passed
  #
  if [ ! -f ${PREFIX}/bin/${TARGET}-ld ]; then
      echo Build failed during binutils 
      exit 1
  fi
}

###############################################################################
#
# finally, build a full-up gcc c/c++ compiler
#
###############################################################################

build_gcc()
{
  echo ------------------------------------------------------------------------
  echo
  echo Building gcc. ${GCCDISTO}
  echo


  cd ${TOPDIR}
  tar xzf ${TARDIR}/${GCCDISTO}.tar.gz
  mkdir ${TOPDIR}/${GCCDISTO}-build

  #
  #patch libstdc++ configure.in to pickup the right bits headers
  #
  case $GCCDISTO in
       gcc-3.0.4)
       PATCHFILE=${TARDIR}/patch_gcc304_libstdc_configure.in
       ;;

       gcc-3.1)
       PATCHFILE=${TARDIR}/patch_gcc31_libstdc_configure.in
       ;;

       *)
       ;;
  esac

  if [ "${GCCDISTO}" = "gcc-3.0.4" -o "${GCCDISTO}" = "gcc-3.1" ] ; then
     echo "Patching libstdc++-v3 configure script..."
     cd ${TOPDIR}/${GCCDISTO}/libstdc++-v3
     patch < ${PATCHFILE}
     autoconf configure.in > configure
     echo "Done"
  fi

  cd ${TOPDIR}/${GCCDISTO}-build

  #
  # GCC Configuration
  #
  case $TARGET in

	sparc-sun-solaris)

        ../${GCCDISTO}/configure --target=$TARGET --prefix=$PREFIX \
            --with-headers=${PREFIX}/copied-includes/include \
	    --with-libs=${PREFIX}/copied-libs/lib \
	    --enable-languages=c,c++ --without-newlib  \
            --with-gnu-as --with-gnu-ld >> ${PREFIX}/Build.log 2>&1
	;;

  esac

  #
  # GCC Build
  #
  case $TARGET in

      sparc-sun-solaris)
  
      # everyone else can use the standard procedure
      make all install >> ${PREFIX}/Build.log 2>&1


      # test to see if this step passed
      if [ ! -f ${PREFIX}/bin/${TARGET}-gcc ]; then
          echo Build failed during gcc && exit 1
      fi
  
      ;;

  esac

}

###############################################################################
#
#  Main Stuff
#
###############################################################################

read_target
#prepare_headers_and_libs
#build_binutils
build_gcc


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

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