Search Posts

gcc, binutils and newlib can all be compiled at once.

gcc, binutils and newlib can all be compiled at once. This article http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.pdf said gcc, binutils and newlib are from the same source tree. Using the following script can linkup all files into a single directory and compile all of them at once.

#!/bin/bash
component_dirs='binutils-2.24 gcc-4.9.0 newlib-2.1.0'
unified_src=srcw
mkdir ${unified_src}
cd ${unified_src}
ignore_list=". .. CVS .svn"

for srcdir in ${component_dirs}
do
 echo "Component: $srcdir"
 case srcdir
 in
 /* | [A-Za-z]:[\\/]*)
 ;;

 *)
 srcdir="../${srcdir}"
 ;;
 esac

 files=`ls -a ${srcdir}`

 for f in ${files}
 do
 found=

 for i in ${ignore_list}
 do
 if [ "$f" = "$i" ]
 then
 found=yes
 fi
 done

 if [ -z "${found}" ]
 then
 echo "$f ..linked"
 ln -s ${srcdir}/$f .
 fi
 done
 ignore_list="${ignore_list} ${files}"
done
cd ..

Just put the directories (binutils-2.24 , gcc-4.9.0 , newlib-2.1.0) and the above script in the same directory. Run the above script, it will create a directory “srcw”, it will contains anything. Then create “build” directory, go into it and execute “../srcw/configure –target=i586-peter-elf –enable-languages=c –prefix=/somewhere –with-newlib” .

After all you can compile install it by :

make all-build all-binutils all-gas all-ld all-gcc all-target-newlib all-target-libgloss
make install-binutils install-gas install-ld install-gcc install-target-newlib install-target-libgloss

All newlib, binutils and gcc will be build at once

One thing that pdf is wrong is : latest gcc doesn’t support “make all-build”

1 comment on gcc, binutils and newlib can all be compiled at once.

Leave a Reply to Peter_OS Cancel reply

Your email address will not be published. Required fields are marked *