Dienstag, 30. März 2010

building avr-gcc from source..

Arduino project

building avr-gcc from source..

see: Building and Installing the GNU Tool Chain
http://www.nongnu.org/avr-libc/user-manual/install_tools.html

before installing avr-gcc, I need to install GMP and MPFR first.

after installing gmp,

I then try to install MPFR 2.4.2 but I get a warning at the configure stage:
>
> checking if gmp.h version and libgmp version are the same... (5.0.1/4.2.2) no
> configure: WARNING: 'gmp.h' and 'libgmp' seems to have different versions or
> configure: WARNING: we cannot run a program linked with GMP (if you cannot
> configure: WARNING: see the version numbers above).
> configure: WARNING: However since we can't use 'libtool' inside the configure,
> configure: WARNING: we can't be sure. See 'config.log' for details.

--with-gmp-build=pathname
--with-gmp=pathname
--with-gmp-include=pathname
--with-gmp-lib=pathname

--with-mpfr=pathname
--with-mpfr-include=pathname
--with-mpfr-lib=pathname



2. If you do not have GMP (the GNU Multiple Precision library), the MPFR library and/or the MPC library installed in a standard location and you want to build GCC, you can explicitly specify the directory where they are installed (`--with-gmp=gmpinstalldir', `--with-mpfr=mpfrinstalldir').

3. The --with-gmp=gmpinstalldir option is shorthand for --with-gmp-lib=gmpinstalldir/lib and --with-gmp-include=gmpinstalldir/include.

Likewise the --with-mpfr=mpfrinstalldir option is shorthand for --with-mpfr-lib=mpfrinstalldir/lib and --with-mpfr-include=mpfrinstalldir/include,

include the --with-gmp-build=pathname of gmp directive to configure mpfr

4.If these shorthand assumptions are not correct, you can use the explicit include and lib options directly.

solution : ./configure --with-gmp-build= location of new gmp.h
eg ./configure --with-gmp-build=/root/Desktop/gmp-5.0.1/obj-gmp

eg. to configure gcc :

../configure --prefix=/usr/local/avr --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 --with-mpfr=/usr/local/lib --with-gmp=/root/Desktop/gmp-5.0.1/obj-gmp

5. if you see the error : libmpfr.so.1: cannot open shared object file
[configure-target-libgcc] Error 1, then . . .

You need to set LD_LIBRARY_PATH : in the .bashrc file in root directory...

export PATH
export JAVA_HOME=/usr/local/jdk1.6.0_10/bin
export AVR_HOME=/usr/local/avr/bin
export MPFR_HOME=/usr/local/mpfr-2.4.2-obj/lib

LD_LIBRARY_PATH=/usr/local/mpfr-2.4.2-obj/lib
export LD_LIBRARY_PATH

PATH=$LD_LIBRARY_PATH:$MPFR_HOME:$PATH:$HOME/bin:$JAVA_HOME:$AVR_HOME

6. It is usually a good idea to configure and build binutils in a subdirectory so as not to pollute the source with the compiled files. This is recommended by the binutils developers.

$ mkdir obj-avr
$ cd obj-avr

The next step is to configure and build the tools. This is done by supplying arguments to the configure script that enable the AVR-specific options. ( to install binutils)

$ ../configure --prefix=$PREFIX --target=avr --disable-nls

7. don't forget to set theLD_LIBRARY_PATH and path in your login environment apart from root.

8. if error, get prepared to delete the files in directory obj-avr and ./configure again !!------( finally, after 6 nights of frustation and despair, I "make install". ) ^ ^



Keine Kommentare: