Help in building a new installation script

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I am writing a script to build all the avr-tools with the last components, similar to the script from Bingo. My components are:
BINUTILS_VER="2.21"
GCC_VER="4.5.2"
GDB_VER="7.2"
GMP_VER="5.0.1"
MPFR_VER="3.0.0"
MPC_VER="0.8.2"
INSIGHT_VER="6.8-1"
AVARICE_VER="2.10"
AVRDUDE_VER="5.10"
AVRLIBC_VER="1.7.0"

(the current version of everything I've found). My aim is to make a 1-only script that works with the last versions of the above.

I was able to make a similar configuration with gcc 4.5.1 but I run into some trouble with 4.5.2. I hope you can give me some advice so that I can solve the problem.

The problem is that my avr-gcc gets compiled somehow incorrectly.

This is the execution error:

avr-gcc  -mmcu=at90usb1287 -Wl,-Map=SCD.map SCD.o EMV.o halSCD.o scdIO.o utils.o terminal.o  halSCD.S SCD.S    -o SCD.elf
/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/ld: cannot find -lgcc
/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status

avr-gcc:

avr-gcc -v
Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/usr/local/avr/libexec/gcc/avr/4.5.2/lto-wrapper
Target: avr
Configured with: ../configure --target=avr --prefix=/usr/local/avr -v --program-prefix=avr- --with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-libssp --enable-languages=c,c++ --disable-werror --disable-nls
Thread model: single
gcc version 4.5.2 (GCC)

Error while building avr-gcc (although it completes the build):

make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-4.5.2/buildavr/libiberty/testsuite'
/bin/bash ../../libiberty/../mkinstalldirs /usr/local/avr/lib/`gcc -g -O2 -print-multi-os-directory`
/usr/bin/install -c -m 644 ./libiberty.a /usr/local/avr/lib/`gcc -g -O2 -print-multi-os-directory`/./libiberty.an
( cd /usr/local/avr/lib/`gcc -g -O2 -print-multi-os-directory` ; chmod 644 ./libiberty.an ;ranlib ./libiberty.an )
mv -f /usr/local/avr/lib/`gcc -g -O2 -print-multi-os-directory`/./libiberty.an /usr/local/avr/lib/`gcc -g -O2 -print-multi-os-directory`/./libiberty.a
if test -n ""; then \
          case "" in \
            /*)    thd=;; \
            *)     thd=/usr/local/avr/include/;; \
          esac; \
          /bin/bash ../../libiberty/../mkinstalldirs ${thd}; \
          for h in ../../libiberty/../include/ansidecl.h ../../libiberty/../include/demangle.h ../../libiberty/../include/dyn-string.h ../../libiberty/../include/fibheap.h ../../libiberty/../include/floatformat.h ../../libiberty/../include/hashtab.h ../../libiberty/../include/libiberty.h ../../libiberty/../include/objalloc.h ../../libiberty/../include/partition.h ../../libiberty/../include/safe-ctype.h ../../libiberty/../include/sort.h ../../libiberty/../include/splay-tree.h; do \
            /usr/bin/install -c -m 644 $h ${thd}; \
          done; \
        fi
make[3]: Entering directory `/local/scratch/osc22/temp/build-avr/gcc-4.5.2/buildavr/libiberty/testsuite'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-4.5.2/buildavr/libiberty/testsuite'
make[2]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-4.5.2/buildavr/libiberty'
/bin/bash: line 3: cd: avr/libgcc: No such file or directory
make[1]: *** [install-target-libgcc] Error 1
make[1]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-4.5.2/buildavr'
make: *** [install] Error 2

I cannot attach gcc/config.log (problems with the website?). But I can send some parts if you think is relevant (please tell me which).

I've checked the following bug report but I didn't find it useful (or maybe I didn't understand?):
http://gcc.gnu.org/bugzilla/show...

Thanks.

-----

In case it helps, this is the result of the initial command run with -v:

avr-gcc -v -mmcu=at90usb1287 -Wl,-Map=SCD.map SCD.o EMV.o halSCD.o scdIO.o utils.o terminal.o  halSCD.S SCD.S    -o SCD.elf
Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/usr/local/avr/libexec/gcc/avr/4.5.2/lto-wrapper
Target: avr
Configured with: ../configure --target=avr --prefix=/usr/local/avr -v --program-prefix=avr- --with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-libssp --enable-languages=c,c++ --disable-werror --disable-nls
Thread model: single
gcc version 4.5.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mmcu=at90usb1287' '-o' 'SCD.elf'
 /usr/local/avr/libexec/gcc/avr/4.5.2/cc1 -E -lang-asm -quiet -v -imultilib avr51 halSCD.S -mmcu=at90usb1287 -fno-directives-only -o /tmp/ccPZdrIF.s
ignoring nonexistent directory "/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/avr/lib/gcc/avr/4.5.2/include
 /usr/local/avr/lib/gcc/avr/4.5.2/include-fixed
 /usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-mmcu=at90usb1287' '-o' 'SCD.elf'
 /usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/as -v -mmcu=at90usb1287 -o /tmp/ccAv4Kbo.o /tmp/ccPZdrIF.s
GNU assembler version 2.21 (avr) using BFD version (GNU Binutils) 2.21
COLLECT_GCC_OPTIONS='-v' '-mmcu=at90usb1287' '-o' 'SCD.elf'
 /usr/local/avr/libexec/gcc/avr/4.5.2/cc1 -E -lang-asm -quiet -v -imultilib avr51 SCD.S -mmcu=at90usb1287 -fno-directives-only -o /tmp/ccPZdrIF.s
ignoring nonexistent directory "/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/avr/lib/gcc/avr/4.5.2/include
 /usr/local/avr/lib/gcc/avr/4.5.2/include-fixed
 /usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-mmcu=at90usb1287' '-o' 'SCD.elf'
 /usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/as -v -mmcu=at90usb1287 -o /tmp/ccswYC86.o /tmp/ccPZdrIF.s
GNU assembler version 2.21 (avr) using BFD version (GNU Binutils) 2.21
COMPILER_PATH=/usr/local/avr/libexec/gcc/avr/4.5.2/:/usr/local/avr/libexec/gcc/avr/4.5.2/:/usr/local/avr/libexec/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.5.2/:/usr/local/avr/lib/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/
LIBRARY_PATH=/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/lib/avr51/:/usr/local/avr/lib/gcc/avr/4.5.2/:/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-v' '-mmcu=at90usb1287' '-o' 'SCD.elf'
 /usr/local/avr/libexec/gcc/avr/4.5.2/collect2 -m avr51 -Tdata 0x800100 -o SCD.elf /usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/lib/avr51/crtusb1286.o -L/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/lib/avr51 -L/usr/local/avr/lib/gcc/avr/4.5.2 -L/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/lib -Map=SCD.map SCD.o EMV.o halSCD.o scdIO.o utils.o terminal.o /tmp/ccAv4Kbo.o /tmp/ccswYC86.o -lgcc -lc -lgcc
/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/ld: cannot find -lgcc
/usr/local/avr/lib/gcc/avr/4.5.2/../../../../avr/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, so I don't see many replies. I guess is partially because everyone knows there are already the scripts from Bingo and some ubuntu packages, etc. True.
However there are 2 major problems with that:

1) They use an old version (4.3.4) of GCC. Some may argue is good, but why not making something that works with the latest? As I said, I was able to make it work with 4.5.1 and I would like to make an automated script or maybe move it to the packages provided by Bingo.

2) The package for Ubuntu (x64):
http://www.wrightflyer.co.uk/avr...
is broken:

avr-gcc  -mmcu=at90usb1287 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT scdIO.o -MF dep/scdIO.o.d  -c scdIO.c -o scdIO.o
/usr/local/avr/lib/gcc/avr/4.3.4/../../../../avr/include/util/delay.h: In function 'SendLCDCommand':
/usr/local/avr/lib/gcc/avr/4.3.4/../../../../avr/include/util/delay.h:163: error: __builtin_avr_delay_cycles expects an integer constant.
make: *** [scdIO.o] Error 1

It doesn't contain the patch from here:
https://savannah.nongnu.org/bugs...

(a solution to that is to go to the directory /usr/local/avr/avr after installation and apply the patch above ... slightly modified to reflect delay.h instead of delay.h.in)

Therefore it would be useful to have a version that works completely fine with avr-libc-1.7.0, which is what I'm trying to do.

Again, any help is appreciated. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are correct about the delay.h being "in error" in avr-libc-1.7.0

Jörg uploaded a fixed version here (easier than patching)
https://www.avrfreaks.net/index.p...

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ohh ... Just noticed this


/bin/bash: line 3: cd: avr/libgcc: No such file or directory
make[1]: *** [install-target-libgcc] Error 1

This im quite sure , should be building the library that the -lgcc error refers to.

Why it cant make the library i don't know , or even if it should.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you sure multilibs are built correctly?

I saw multilib builds fail without promoting the error to higher level so that the overall build process did /not/ fail. Not easy to see in the bulk of output.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Sprinter,

Thanks for the idea. I was specifically disabling multilib by using --disable-multilib. My complete script is available here:
http://www.cl.cam.ac.uk/~osc22/f...

However I removed that and I still get the same problem while building gcc:
make[3]: Entering directory `/local/scratch/osc22/temp/build-avr/gcc-build-4.5.2/libiberty/testsuite'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-build-4.5.2/libiberty/testsuite'
make[2]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-build-4.5.2/libiberty'
/bin/bash: line 3: cd: avr/libgcc: No such file or directory
make[1]: *** [install-target-libgcc] Error 1
make[1]: Leaving directory `/local/scratch/osc22/temp/build-avr/gcc-build-4.5.2'
make: *** [install] Error 2

The full log is available here:
http://www.cl.cam.ac.uk/~osc22/f...

Maybe you can spot the problem.

Thanks,
Omar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks to you, the gcc and the avr-gcc community I have managed to solve the problems.
Seems I was using the wrong parameters in the make process.

The final script is available here:
http://www.cl.cam.ac.uk/~osc22/f...

This should work without any errors and install the latest versions (see the script for the versions) of the tools.

Best regards,
Omar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Omar

As i write in this thread
https://www.avrfreaks.net/index.p...

Your script looks very elegant (much nicer than my quick hacks) , but i have to mention that you build a raw GCC without any patches. That's usually not recommended (at th moment) by the avr-gcc/avr-libc maintainers.

But nice script :-)

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've replied to the other thread regarding the patches:
https://www.avrfreaks.net/index.p...
(as a small comment, I do use some patch for GCC and it all works directly from the script)

@Bingo
Thanks, although you also have much merit as the script was done based on yours as well.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Omar

I replied over there :-)

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Omar,

Bingo is correct. You really need to have *all* of the patches, or you might have an incomplete toolchain compared to some of the other distributions out there.

Oh, and realize that that there are a number of users that are both here and on the avr-gcc mailing list. So even though it may not seem like cross-posting, you may just want to stick with either AVR Freaks or avr-gcc instead of posting the same thing in both places. I'm the one who helped you out on the avr-gcc list. ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Eric,

Thanks for the advice on cross-posting. I'll try to stick to this forum, but as you've seen your help has come only after I sent the message to the avr-gcc list, so it's a bit tricky...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

goodhack wrote:
I was specifically disabling multilib by using --disable-multilib. My complete script is available here:
http://www.cl.cam.ac.uk/~osc22/f...

IMHO avr-gcc without multilib is not very useful.

As the output shows, install fails, so you have to look why the build does'n work, i.e. make all-target-libgcc.

To locate the problem it's better to build gcc on it's own and not by means of a script that does many other things. I have no linux handy at the moment, so I cannot help.

Try building avr-gcc and skim the log for probs, perhaps after building avr-gcc, make clean-target-multilib or even rm -rf $build/avr so that log is smaller.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for not replying sooner to this.

I am not disabling multilib anymore as far as I know. The issues have been fixed already, see the other link for the complete details:
https://www.avrfreaks.net/index.p...

Thanks.
Omar