This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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]

Re: Re: Wrongfully compiled code


ariga masahiro wrote:
Hello,

Thank you very much for your confirmation.
I am much relieved to have found the cause of trouble.

But I do not know how to re-install sh-elf-gcc on Cygwin.
Could you please teach me how to do it ?

Masahiro Ariga
I found no pre-built version of GCC for this target available for download.
It's 18 months since I built it, and I've only ever built GCC once, so I'm just
going off the top of my head, but I did save a python script which goes through
the steps of building binutils and GCC. I've also generated a patch for the configure
hack there are two versions attached, "configure.patch" was created using SVN
(from the root of that tag) "patch" was created using diff.


You will need the cygwin build of Python installed via the standard cygwin installer program from
cygwin.com


The GCC release can be obtained from SVN
svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_4_1_1_release gcc_4_1_1
If you don't have SVN search their website for a tarball.
Obtain the aforementioned versions of newlib and binutils (you'll have to search for these
the gcc website and/or google will get you there pretty quickly) and unpack them such
that you have the following directory layout


./gcc_4_1_1
./gcc_4_1_1/newlib
./binutils-2.16
./buildall.py
./patch
./configure.patch

Either apply configure.patch using SVN (and I have no idea how to do that from the
command line version) or apply "patch" using :
patch gcc_4_1_1/libstdc++-v3/configure -ipatch


Let's assume you want to install to /opt/ecos/gcc411:
run the attached script as
python buildall.py /opt/ecos/gcc411
*
*see also
http://gcc.gnu.org/install/

Good luck!*
*

sh-elf/sh-elf/include
Thread model: single
gcc version 3.2.1

We found a bug in this version (probably the same one). I managed to compile GCC 4.1.1 using the following sources


binutils 2.16
Newlib 1.14.0 (copy this to inside the GCC source directory)
Gcc 4.1.1

I had to make one hack to the configure file. It fails on a test, but you can proceed without it, you'll just have to inspect the file when the problem occurs and comment out that test. I can't remember any more details than that sorry.

binutils is compiled separately. Newlib is not strictly needed by ecos but I found GCC wouldn't compile without it (use the --with-newlib option in the configure).

btw the compile time is measured in hours (about 4.5 on the PC I used)


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss




Index: libstdc++-v3/configure
===================================================================
--- libstdc++-v3/configure	(revision 114326)
+++ libstdc++-v3/configure	(working copy)
@@ -4576,6 +4576,8 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+gcc_no_link=yes
+
      if test x$gcc_no_link = xyes; then
   { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
 echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
@@ -87646,6 +87648,8 @@
   fi
 fi
 
+gcc_no_link=no
+
 # Check to see if 'gnu' can win.
 if test $enable_symvers = gnu; then
   # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
@@ -87700,6 +87704,7 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+gcc_no_link=no
 glibcxx_shared_libgcc=no
 fi
 rm -f conftest.err conftest.$ac_objext \
@@ -88575,6 +88580,8 @@
 echo "${ECHO_T}$glibcxx_cv_func_setenv_use" >&6
   if test x$glibcxx_cv_func_setenv_use = x"yes"; then
 
+gcc_no_link=no
+
 for ac_func in setenv
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
#!/usr/bin/python

import os
import sys

def do(cmd):
	err = os.system(cmd)
	if (err != 0):
		sys.exit(err)

if sys.platform != "cygwin":
	print "This script is for a cygwin build environment"
	sys.exit(-1)

try:
	outdir = sys.argv[1]
except:
	print "Please specify output directory for built toolchain"
	sys.exit(-1)

startdir = os.getcwd()

if True:
	do("mkdir -p /tmp/build/binutils")
	os.chdir("/tmp/build/binutils")
	do("%s/binutils-2.16/configure --target=sh-elf --prefix=%s -v 2>&1 | tee binconfig.out" % (startdir, outdir))
	do("make -w all install 2>&1 | tee binmake.out")

#sys.exit(0)

savepath = os.environ["PATH"]
os.environ["PATH"] = "%s/bin:%s" %(outdir, savepath)
do("mkdir -p /tmp/build/gcc")
os.chdir("/tmp/build/gcc")
do("%s/gcc_4_1_1/configure --target=sh-elf --prefix=%s --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-gxx-include-dir=%s/sh-elf/include --with-ecos -v 2>&1 | tee configgcc.txt " %(startdir, outdir, outdir))
do("make -w all install 2>&1 | tee makegcc.txt")


4578a4579,4580
> gcc_no_link=yes
> 
87648a87651,87652
> gcc_no_link=no
> 
87702a87707
> gcc_no_link=no
88577a88583,88584
> gcc_no_link=no
> 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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