1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linux bash script problems

Discussion in 'Software' started by Herbicide, 29 Mar 2009.

  1. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    I came across this instructable and have decided that the whole thing looks easy enough.

    Heh.

    I've looked at and modified the provided shell script, but I'm a bit stuck.

    Code:
    #! /usr/bin bash
    
    ## Get basic compile tools if you don't already got 'em:
    ## (removed those - have them already)
    ## Uncomment the relevant line below before running.
    
     slapt-get --install flex bison byacc
    # yum install flex bison byacc gcc 
    
    ## This is going to be the base install directory
    cd /usr/local/avr
    
    ## Get the source files
    ## Note: you can get an updated version of GCC if you want.  
    ## This one works for me.
    wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.6.4.tar.bz2
    wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.6.tar.gz 
    
    ## Unpack them all
    tar xvjf avr-libc-1.6.4.tar.bz2
    tar xvzf avrdude-5.6.tar.gz
    
    ## And start compiling.  This takes a while.  Go get some tea.
    
    # Binutils
    cd binutils-2.17.50.0.17-i486-1/
    ./configure --prefix=/usr/local/avr --target=avr
    make
    make install
    cd ..
    
    # Update path, b/c GCC needs the avr linker from binutils above
    export PATH=$PATH:/usr/local/avr/bin
    
    # GCC
    cd gcc-4.1.2/  # note: if you changed GCC versions above, change this!
    mkdir avr-gcc  # GCC needs a sub-directory to compile into
    cd avr-gcc
    ../configure --prefix=/usr/local/avr \
                  --target=avr --enable-languages="c" \
                  --disable-nls
    make
    make install
    cd ../..
    
    # AVR LibC
    ## Note: build method changed recently -- much cleaner now.
    cd avr-libc-1.4.5/
    ./configure --build=`./config.guess` --host=avr --prefix=/usr/local/avr
    make
    make install
    cd ..
    
    # AVRdude
    cd avrdude-5.6/
    ./configure --prefix=/usr/local/
    make
    make install
    cd ..
    
    ## Now set up paths and we're done
    echo "
    ## Added to put avr-gcc and utils in the search path
    export PATH=\$PATH:/usr/local/avr/bin" | cat >> /etc/profile 
    
    Anyway, I sh avrinstaller.sh, hit enter and wait.

    It's all OK, until:

    avrinstaller.sh: line 25: cd: binutils-2.17.50.0.17-i486-1/: No such file or directory
    avrinstaller.sh: line 26: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install'. Stop.
    avrinstaller.sh: line 35: cd: gcc-4.1.2/: No such file or directory
    mkdir: cannot create directory `avr-gcc': File exists
    avrinstaller.sh: line 38: ../configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install'. Stop.
    avrinstaller.sh: line 47: cd: avr-libc-1.4.5/: No such file or directory
    avrinstaller.sh: line 48: ./config.guess: No such file or directory
    avrinstaller.sh: line 48: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    make: Nothing to be done for `install'.
    avrinstaller.sh: line 54: cd: avrdude-5.6/: No such file or directory
    avrinstaller.sh: line 55: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install'. Stop.


    Bearing in mind I'm running slackware 12.1, what do I need to change/sort/install to get this to work?

    Oh, the full path to binutils (which is where it all seems to fall over) is:
    /mnt/hdd2/root/Pseudo/ISO/packages/dev/binutils-2.17.50.0.17-i486-1.tlz
     
  2. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    It almost seems too easy but:

    Code:
    cd /mnt/hdd2/root/Pseudo/ISO/packages/dev
    sh <path to avrinstaller.sh>
     
  3. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    Code:
    metheuselah://home/simon
    root:# cd /mnt/hdd2/root/Pseudo/ISO/packages/dev
    bash: cd: /mnt/hdd2/root/Pseudo/ISO/packages/dev: No such file or directory
    metheuselah://home/simon
    root:# 
    :( :grr:
     
  4. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    You sure you put the binutils package in the correct directory?
     
  5. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    As far as I'm aware I didn't do anything, it must have installed with the distro.

    slapt-get --install binutils
    shows it as up to date.
     
  6. Zoon

    Zoon Hunting Wabbits since the 80s

    Joined:
    12 Mar 2001
    Posts:
    5,888
    Likes Received:
    824
    If you have locate installed, try and locate it, and check where the folder really is?
     
  7. trigger

    trigger Procrastinator

    Joined:
    22 Mar 2004
    Posts:
    1,106
    Likes Received:
    37
    Looking at the full version of that script it appears that it downloads a specific version of Binutils and GCC, which you've removed; however you haven't removed the lines that would have compiled and installed them, so you want to either reinstate the wget and tar lines or remove the lines that install Binutils and GCC.
     
  8. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    locate, slocate and mlocate all fail to work.
    :wallbash:
     
  9. Zoon

    Zoon Hunting Wabbits since the 80s

    Joined:
    12 Mar 2001
    Posts:
    5,888
    Likes Received:
    824
    Does the error message state it can't find the locate database? In which case run locate.updatedb or whatever your distro names it!
     
  10. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    Thanks.

    It's running now.

    This is more involved than I usually get - slapt-get --install [package] is usually my limit.

    Edit: Nope - same problem.
     
  11. trigger

    trigger Procrastinator

    Joined:
    22 Mar 2004
    Posts:
    1,106
    Likes Received:
    37
    Did you remove the GCC and Binutils install lines or add the wget and tar lines back in? I would guess it would be better to remove the install lines as you already have them both installed from your package manager. Also is avr and avrdude not in your distro's package manager? They are certainly in Debian...
     
  12. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    I removed them.
    Code:
    #! /usr/bin bash
    
    ## Get basic compile tools if you don't already got 'em:
    ## Uncomment the relevant line below before running.
    
     slapt-get --install flex bison byacc 
    # yum install flex bison byacc gcc 
    
    ## This is going to be the base install directory
    cd /usr/local/avr
    
    ## Get the source files
    ## Note: you can get an updated version of GCC if you want.  
    ## This one works for me.
    wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.6.4.tar.bz2
    wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.6.tar.gz 
    
    ## Unpack them all
    tar xvjf avr-libc-1.6.4.tar.bz2
    tar xvzf avrdude-5.6.tar.gz
    
    ## And start compiling.  This takes a while.  Go get some tea.
    
    
    # AVR LibC
    ## Note: build method changed recently -- much cleaner now.
    cd avr-libc-1.4.5/
    ./configure --build=`./config.guess` --host=avr --prefix=/usr/local/avr
    make
    make install
    cd ..
    
    # AVRdude
    cd avrdude-5.6/
    ./configure --prefix=/usr/local/
    make
    make install
    cd ..
    
    ## Now set up paths and we're done
    echo "
    ## Added to put avr-gcc and utils in the search path
    export PATH=\$PATH:/usr/local/avr/bin" | cat >> /etc/profile 
    
    
    here's the output where it went wrong:

    ...
    ...
    avrdude-5.6/doc/Makefile.in
    avrdude-5.6/doc/stamp-vti
    avrdude-5.6/doc/version.texi
    avrdude-5.6/doc/TODO
    avrdude-5.6/doc/mdate-sh
    avrdude-5.6/doc/texinfo.tex
    avrdude-5.6/doc/avrdude.texi
    avrdude-5.6/doc/avrdude.info
    avrinstaller2.sh: line 27: cd: avr-libc-1.4.5/: No such file or directory
    avrinstaller2.sh: line 28: ./config.guess: No such file or directory
    avrinstaller2.sh: line 28: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install'. Stop.
    avrinstaller2.sh: line 34: cd: avrdude-5.6/: No such file or directory
    avrinstaller2.sh: line 35: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install'. Stop.

    the only result I get for 'avr' is libmcrypt...
     
  13. trigger

    trigger Procrastinator

    Joined:
    22 Mar 2004
    Posts:
    1,106
    Likes Received:
    37
    Ah, I see it, you are downloading avr-libc-1.6.4 but trying to cd to avr-libc-1.4.5. If you change the references to 1.4.5 to 1.6.4, and give it another go, hopefully it'll work.
     
  14. Herbicide

    Herbicide Lurktacular

    Joined:
    27 May 2004
    Posts:
    1,533
    Likes Received:
    17
    :rolleyes: :wallbash:
    thanks.

    *fingers crossed*

    I think it's worked!

    Just need some components now.

    /me scavenges.

    y'know - this roll-your-own compile and install thing is simpler than I thought...
     
    Last edited: 30 Mar 2009

Share This Page