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: Wrongfully compiled code


ariga masahiro wrote:
Hello Dave and others,

To Mr.Dave Lawrence,
I have studied a little bit about building sh-elf-gcc.
As I know nothing about Python,I made my shell scripts from it.
I append contents of these shell scripts below.
I could not find out what configure.patch is and how to do it,
so I did not do anything about it.
Perhaps this is the cause of trouble but I explain later.

I decided the directory to hold newly built files to be
/usr/local/sh-elf/bin.

I downloaded next sources into /usr/local/sh-elf
and decompressed them.

binutils-2.16.tar.bz2
gcc-4.1.1.tar.bz2
newlib-1.14.0.tar.gz

After that newly directory looks like below.
/usr
 `-- local
        `-- sh-elf
                |-- binutils-2.16
                |-- newlib-1.14.0
                |-- gcc-4.1.1
                |-- bin
                |

And I made building-directories in which I executed building scripts.
/tmp/build/build_binutils
/tmp/build/build_gcc

I made setup.sh to set environment variables like TARGET,PREFIX etc.

First of all I built binutils
and this succeeded without any trouble.

$ cd /tmp/build
$ . setup.sh
$ cd build_binutils
$ . binutilsbuild.sh

And I executed appendpath.sh which set PATH to /usr/local/sh-elf/bin.

$ cd ..
$ . appendpath.sh

And I tried to build gcc.
Before that,I made symbolic link to newlib like next.

$ cd /usr/local/sh-elf/gcc-4.1.1
$ ln -s ../newlib-1.14.0/newlib ../newlib-1.14.0/libgloss ../newlib-1.14.0/COPYING.NEWLIB .


Then I executed buildgcconetime.sh

$ cd /tmp/build/build_gcc
$ . buildgcconetime.sh

but I was encountered next error.

checking for ISO C99 support in <stdio.h>... yes
checking for ISO C99 support in <stdlib.h>... no
checking for ISO C99 support in <wchar.h>... no
checking for fully enabled ISO C99 support... no
configure: Debug build flags set to -g3 -O0
checking for additional debug build... no
checking for extra compiler flags for building...
checking for thread model used by GCC... single
checking for shared libgcc... configure: error: Link tests are not allowed after
GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/tmp/build/build_gcc'
make: *** [all] Error 2
make: Leaving directory `/tmp/build/build_gcc'


My first-guess was that since this includes "test" ,
I remembered Dave's next sentences.

"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."

Now is this related to what you mean ?
If it does,could you elaborate what it is and how I should do it ?
Like which file I should apply configure.patch to,and how ?


Yes this was the error I had. I attached two files "patch" and "configure.patch" which was a bit pointless as you only need one of them. "patch" was created using "diff" from the Cygwin command line and can be applied using "patch" (the program). So the command you need is
patch gcc-4.1.1/libstdc++-v3/configure patch
(where the first use of the word patch is the program name and the second use is the name of the file)


Or is it not related to what you mean ?
Anyway would you please help me ?

There is one more thing I care about.

Cygwin's original gnutools exec file directory is next.
/cygwin/opt/ecos/gnutools/sh-elf/bin

I noticed when I build it is interfered with.
First I renamed this directory like /gnutools-old
but I was encountered error like next.

echo 'STMP_FIXPROTO=""' \
>> /usr/local/sh-elf/lib/gcc/sh-elf/4.1-GNUSH_v0602/install-tool
s/mkheaders.conf
echo 'STMP_FIXINC="stmp-fixinc"' \
>> /usr/local/sh-elf/lib/gcc/sh-elf/4.1-GNUSH_v0602/install-tool
s/mkheaders.conf
make[1]: *** No rule to make target `/opt/ecos/gnutools/sh-elf/bin/sh-elf-ld', n
eeded by `stamp-collect-ld'. Stop.
make[1]: Leaving directory `/home/tkernel/shtools/buildshgcc/build_gcc/gcc'
make: *** [install-gcc] Error 2


So I remained it as it was and only renamed next exec files.
sh-elf-as.exe.prev
sh-elf-gcc.exe.prev

I am not sure if I am right about it.

If I succeeded to build newly sh-elf-gcc in /usr/local/sh-elf/bin
I intend to overwrite exec files in /usr/local/sh-elf/bin to /opt/ecos/gnutools/sh-elf/bin.
Am I right ?

The fact that its trying to drag in files from your old install doesn't sound good - I'd go with your plan of renaming that to gnutools-old or something. The "no rule to make target ..." error is almost certainly caused by dependency file generated during your previous build - try doing a "make clean" and start again.

Would you please enlighten me ? I am much obliged to you.

shell scripts
=========================================================
setup.sh ;this is for setting environment variables like next.
export TARGET=sh-elf
export HOST=i686-pc-cygwin
export BUILD=i686-pc-cygwin
export PREFIX=/usr/local/sh-elf
export CFLAGS="-O2"
export CXXFLAGS="-O2"
export CFLAGS_FOR_TARGET="-Os"
export CXXFLAGS_FOR_TARGET="Os"
--------------------------------------------------------
appendpath.sh ;this is for adding newly built exec Directory to PATH
PATH=$PATH:/usr/local/sh-elf/bin
--------------------------------------------------------
binutilsbuild.sh ;this is script for building binutils.
/usr/local/sh-elf/binutils-2.16/configure --target=$TARGET --host=$HOST --build=$BUILD --prefix=$PREFIX 2>&1 | tee config.out
make 2>&1 | tee makeall.out
make install 2>&1 | tee makeinstall.out
--------------------------------------------------------
buildgcconetime.sh ;this is script for building sh-elf-gcc
/usr/local/sh-elf/gcc-4.1.1/configure --target=$TARGET --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-ggxx-include-dir=/usr/local/sh-elf/sh-elf/include --with-ecos -v 2>&1 | tee configgcc.txt
make -w all install 2>&1 | tee makegcc.txt


Masahiro Ariga





--
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]