linux help please please (building a toolchain)

  • so i'm really trying to set-up this linux toolchain as per the Aleph readme, but this line is stumping me

    echo "PATH="\$PATH:~/avr32-gnu-toolchain/bin" >> ~/.bashrc
    PATH=$PATH:~/avr32-gnu-toolchain/bin

    i've used the notes from another thread and done this
    export PATH=$PATH:/home/duncan/avr32-gnu-toolchain/bin

    but when i run 'make' in the bees directory i just get a stream of errors, any suggestions?

    example -
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:240: error: 'U8' undeclared (first use in this function)
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:240: error: expected ';' before numeric constant
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:125: warning: unused variable 'hsb_mhz_up'
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c: In function 'smc_enable_muxed_pins':
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:746: error: 'AVR32_EBI_DATA_0_PIN' undeclared (first use in this function)
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:746: warning: excess elements in struct initializer
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:746: warning: (near initialization for 'SMC_EBI_GPIO_MAP[0]')
    ../../avr32_lib/asf-3.7.3/avr32/drivers/ebi/smc/smc.c:746: error: 'AVR32_EBI_DATA_0_FUNCTION' undeclared (first use in this function)

  • oh and when i try to 'make' Lines I get these errors . .

    duncan@duncan-N150P-N210P-N220P:~/aleph-1/modules/lines$ sudo make
    bfin-elf-gcc -Wall -mcpu=bf533 -I../../bfin_lib/src/ -I../../bfin_lib/src//libfixmath -I../../bfin_lib//../common -I../../bfin_lib//../dsp -I./ -03 -D ARCH_BFIN=1 -g -I../../bfin_lib/src/ -I../../bfin_lib/src//libfixmath -I../../bfin_lib//../common -I../../bfin_lib//../dsp -I./ -c \
    -D MAJ=0 -D MIN=1 -D REV=2 \
    ../../bfin_lib/src/control.c \
    -o ../../bfin_lib/obj/control.o
    make: bfin-elf-gcc: Command not found

  • You might consider trying this environment I set up:

    https://github.com/bensteinberg/aleph-development

  • ok, tried this, got a few errors on download, seemed it dropped internet connection and couldn't get all the bits? how do i run it again?
    if i halt it and then try vagrant up again i just get -

    default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Authentication failure. Retrying...

  • The timeout appears to be normal -- I see it too -- but the auth failure I'm not sure about. I suspect it's this:

    http://stackoverflow.com/questions/22575261/vagrant-stuck-connection-timeout-retrying

    See if that helps.

    Here's the complete sequence on my machine, from first run to login to halt to second run and another login:

    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Importing base box 'precise64'...
    ==> default: Matching MAC address for NAT networking...
    ==> default: Setting the name of the VM: aleph-development_default_1408037464197_31719
    ==> default: Fixed port collision for 22 => 2222. Now on port 2200.
    ==> default: Clearing any previously set network interfaces...
    ==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    ==> default: Forwarding ports...
    default: 22 => 2200 (adapter 1)
    ==> default: Booting VM...
    ==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    ==> default: Machine booted and ready!
    ==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.2.0
    default: VirtualBox Version: 4.3
    ==> default: Setting hostname...
    ==> default: Mounting shared folders...
    default: /vagrant => /Users/bens/Documents/code/aleph-development
    default: /tmp/vagrant-puppet-3/manifests => /Users/bens/Documents/code/aleph-development/manifests
    ==> default: Running provisioner: puppet...
    ==> default: Running Puppet with default.pp...
    ==> default: stdin: is not a tty
    ==> default: notice: /Stage[main]//Exec[get_atmel]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[untar_atmel]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[update_path]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[get_jansson]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[update]/returns: executed successfully
    ==> default: notice: /Stage[main]//Package[make]/ensure: ensure changed 'purged' to 'present'
    ==> default: notice: /Stage[main]//Package[emacs]/ensure: ensure changed 'purged' to 'present'
    ==> default: notice: /Stage[main]//Package[git]/ensure: created
    ==> default: notice: /Stage[main]//Exec[get_blackfin]/returns: executed successfully
    ==> default: notice: /Stage[main]//Package[alien]/ensure: ensure changed 'purged' to 'present'
    ==> default: notice: /Stage[main]//Exec[install_jansson]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[unzip_blackfin]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[aleph]/returns: executed successfully
    ==> default: notice: /Stage[main]//Package[libjansson4]/ensure: ensure changed 'purged' to 'present'
    ==> default: notice: /Stage[main]//Package[vim]/ensure: ensure changed 'purged' to 'present'
    ==> default: notice: /Stage[main]//Package[unzip]/ensure: ensure changed 'purged' to 'present'
    ==> default: notice: /Stage[main]//Exec[unzip_atmel]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[setup_avr32]/returns: executed successfully
    ==> default: notice: /Stage[main]//Exec[chown]/returns: executed successfully
    ==> default: notice: Finished catalog run in 242.85 seconds
    $ vagrant ssh
    Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

    * Documentation: https://help.ubuntu.com/
    New release '14.04.1 LTS' available.
    Run 'do-release-upgrade' to upgrade to it.

    Welcome to your Vagrant-built virtual machine.
    Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
    vagrant@aleph-dev:~$ exit
    logout
    Connection to 127.0.0.1 closed.
    $ vagrant halt
    ==> default: Attempting graceful shutdown of VM...
    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Clearing any previously set forwarded ports...
    ==> default: Fixed port collision for 22 => 2222. Now on port 2200.
    ==> default: Clearing any previously set network interfaces...
    ==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    ==> default: Forwarding ports...
    default: 22 => 2200 (adapter 1)
    ==> default: Booting VM...
    ==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    ==> default: Machine booted and ready!
    ==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.2.0
    default: VirtualBox Version: 4.3
    ==> default: Setting hostname...
    ==> default: Mounting shared folders...
    default: /vagrant => /Users/bens/Documents/code/aleph-development
    default: /tmp/vagrant-puppet-3/manifests => /Users/bens/Documents/code/aleph-development/manifests
    ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
    ==> default: to force provisioning. Provisioners marked to run always will still run.
    $ vagrant ssh
    Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

    * Documentation: https://help.ubuntu.com/
    New release '14.04.1 LTS' available.
    Run 'do-release-upgrade' to upgrade to it.

    Welcome to your Vagrant-built virtual machine.
    Last login: Thu Aug 14 17:35:46 2014 from 10.0.2.2
    vagrant@aleph-dev:~$

  • hmmm... tried the authorisation suggestions on Stackoverflow but it says this

    "Don't forget to add you public key to ~/.ssh/authorized_keys on the Vagrant VM"

    how do i do that if i can't boot it up??!

  • is it possible to just turn off the ssh authentication?

  • i also see this error in the window when i first ran 'vagrant up'

    ==> default: err: /Stage[main]//Exec[aleph]/returns: change from notrun to 0 failed: Command exceeded timeout at /tmp/vagrant-puppet-3/manifests/default.pp:15

    ==> default: notice: Finished catalog run in 875.85 seconds
    The following SSH command responded with a non-zero exit status.
    Vagrant assumes that this means the command failed!

    puppet apply --manifestdir /tmp/vagrant-puppet-3/manifests --detailed-exitcodes /tmp/vagrant-puppet-3/manifests/default.pp

  • Try the advice in the first answer at http://stackoverflow.com/questions/22575261/vagrant-stuck-connection-timeout-retrying -- add

    config.vm.provider :virtualbox do |vb|
    vb.gui = true
    end

    to the Vagrantfile so you can see the console as the VM boots.

  • ok, you've nailed it!
    so we're getting somewhere! I think i've just successfully run make on bees (had to use sudo make, is that normal?) but if i try the same on lines i get

    lines.c:20:17: error: dac.h: No such file or directory
    lines.c: In function 'module_init':
    lines.c:257: warning: unused variable 'j'
    lines.c: In function 'module_process_frame':
    lines.c:419: error: 'filter_1p_lo' has no member named 'sync'
    lines.c:422: error: 'filter_1p_lo' has no member named 'sync'
    lines.c:444: error: 'filter_1p_lo' has no member named 'sync'
    lines.c:446: warning: implicit declaration of function 'dac_update'
    In file included from lines.c:456:
    param_set.c: In function 'module_set_param':
    param_set.c:328: error: 'DAC_VALUE_MASK' undeclared (first use in this function)
    param_set.c:328: error: (Each undeclared identifier is reported only once
    param_set.c:328: error: for each function it appears in.)
    make: *** [lines.o] Error 1



    - is this all down to the error i get when i first ran vagrant up

    ==> default: err: /Stage[main]//Exec[aleph]/returns: change from notrun to 0 failed: Command exceeded timeout at /tmp/vagrant-puppet-3/manifests/default.pp:15

    and

    ==> default: warning: /Stage[main]//Exec[chown]: Skipping because of failed dependencies

  • Yeah, you might need to start over, making the change to the Vagrantfile before running 'vagrant up', so all the downloads happen. Before you try that, though, start the system with 'vagrant up' and then run 'vagrant provision' to see if it'll get the things it missed before.

  • here are my humble interpretations of the errors...

    lines.c:20:17: error: dac.h: No such file or directory
    missing the dependency to header file dac.h, some of the errors below seems to be caused by this missing file

    lines.c:419: error: 'filter_1p_lo' has no member named 'sync'
    filter_1p_lo is a function from the dsp library filter_1p.h, maybe this function is not called correctly, not sure!
    EDIT: sorry, there is a struct in filter_1p.h called filter_1p_lo, the member called 'sync' is commented out in the version I´m using, so I guess this was written using an older version of this library file

    lines.c:446: warning: implicit declaration of function 'dac_update'
    this function is probably included in dac.h, but now it can´t be found so the compiler thinks that you are trying to create this function

    param_set.c:328: error: 'DAC_VALUE_MASK' undeclared (first use in this function)
    this is a macro substitution that could be declared in dac.h, hence the name! now it can´t be found

    check that it is the latest version of lines you are trying to compile, see if you can locate the dac.h file somewhere

  • ok thanks both, i'll try starting over :)
    i tried vagrant provision but got this
    -Guest-specific operations were attempted on a machine that is not
    ready for guest communication. This should not happen and a bug
    should be reported.

  • nope, no luck that way, does even less than before.. .. photo attached,..
    is there something i should set-up in virtualbox beforehand to sort out permission issues?


  • Weird, it looks like the VM is booting fine. When I say start over, I mean delete the aleph-development directory, clone it again from github, copy the atmel stuff into it, edit the Vagrantfile as above, then run vagrant up.

  • yup yup, that's exactly what i did :) i even un/reinstalled vagrant beforehand.
    previously when i first ran vagrant up it would try authorising a couple of times and then carry on and do all the provisiniong.
    Doing it with the vagrant file changed means it opens a new window interface to the VM and offers me a log-in option, and then it stops (I've done this whole process twice now, same effect whether I log in or not, it just sits there and eventually gives that message in red in my terminal.

    -Have you done anything to set up ssh on your computer or on virtualbox beforehand?
    - what is that [Aleph] file, is there anything different about it than all the other ones?

    this is a great option ben and thanks for the help but I'm feeling it might be a bit crazy trying to get this VM to work (i've spent almost a whole day on it now) when I have a actual linux machine sitting next to me.
    has anyone seen those errors that I originally posted in their linux set up?
    d

  • Weird. I don't think I did anything special to set up ssh beforehand, although the machines I've used to do this have had ssh working generally. I've been rummaging around in stackoverflow and related sites and found people saying they had a firewall issue, but I can't imagine that's the case here. Another idea is changing the timeout in the Vagrantfile.

    What do you mean by that "[Aleph] file"? I don't *think* I have one in the repo... Ah, got it, I think. That's the job in the puppet manifest (manifests/default.pp) for cloning the actual aleph repo, not an actual file. Here's the stanza:

    exec { 'aleph':
    command => 'git clone https://github.com/tehn/aleph.git',
    path => '/usr/bin',
    require => Package['git'],
    }

    Yeah, know what you mean about spending time on this instead of the toolchain itself. Here's an idea, though. If you can identify which parts of the manifest failed, you can run them by hand, and get the system into the proper state. That is, clone the aleph repo, then run the chown command at the bottom of the manifest -- that would cover the two failed jobs you mentioned earlier:

    ==> default: err: /Stage[main]//Exec[aleph]/returns: change from notrun to 0 failed: Command exceeded timeout at /tmp/vagrant-puppet-3/manifests/default.pp:15

    and

    ==> default: warning: /Stage[main]//Exec[chown]: Skipping because of failed dependencies

  • when you got here:
    lines.c:20:17: error: dac.h: No such file or directory
    lines.c: In function 'module_init':
    lines.c:257: warning: unused variable 'j'.......

    the toolchain was up and working, it didn't compile but that was because the code had some problems

  • @bens ok sounds like a plan, how do i run them manually though?

    @test2 i've tried cloning the tehn/aleph master repository into a new folder in the aleph-development folder, but i still get the same errors? if you compile from the master repository does it compile without errors?

  • oh, one question about repositories which i really don't understand, if i use

    git clone https://github.com/tehn/aleph.git

    how do i know if it's the master or dev branch? the cloning url on github seems to be the same no matter which page i'm viewing? when i look in the aleph directory there is no dev or master seperation?

  • ok, one other weirdness that i don't understand. on github i just freshly forked tehn/aleph,
    now if i search my repository for dac.h i get no results
    but if i search tehn/aleph i get a load of results ? shouldn't my fork and the main repository be the same?
    (some of them say they are in https://github.com/tehn/aleph/blob/3ac9aef080e4ddd1b8694990810dd05a62412b1b/bfin_lib/src/cv.h
    but i don't see this 'blob' directory anywhere?

  • I get the same errors (EDIT: using dev fork), made some changes, now it compiles, haven't tested with aleph yet though!

  • @Test2 ok cool, but how do I know if it's the dev fork I'm using? i still don't really get github!!

    @bens is it normal that i should have to use sudo vagrant up ? if i just try vagrant up when i start from scratch I get

    duncans-MacBook-Air:aleph-development duncanspeakman$ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:410:in `initialize': Permission denied - /Users/duncanspeakman/.vagrant.d/data/lock.machine-action-f5ce70eed169ff13471998df3a9ab906.lock (Errno::EACCES)
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:410:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:410:in `block in lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:434:in `lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:409:in `lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

  • Hey Duncan -- here's how you change branches:

    $ git clone https://github.com/tehn/aleph.git
    $ cd aleph
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.

    nothing to commit, working directory clean
    $ git checkout dev
    Branch dev set up to track remote branch dev from origin.
    Switched to a new branch 'dev'
    $ git status
    On branch dev
    Your branch is up-to-date with 'origin/dev'.

    nothing to commit, working directory clean
    $

  • Also, you shouldn't have to use sudo to run vagrant. The perms on my ~/.vagrant.d/ directory are drwxr-xr-x -- you might check yours with 'ls -al ~'.

  • To run puppet manifest items manually, you'd need to get into the VM with 'vagrant ssh', then run whatever the command line is -- in the case of the two manifest items above, i'd do the following, output to the terminal omitted:

    $ vagrant up
    $ vagrant ssh
    vagrant@aleph-dev:~$ git clone https://github.com/tehn/aleph.git
    vagrant@aleph-dev:~$ chown -R vagrant.vagrant /home/vagrant

  • ok! i think we're almost there!
    i did this
    duncanspeakman$ sudo chown -R duncanspeakman .vagrant.d

    it seems to be up and running now and i can log in via ssh normally

    so the thing next is how to i get files from my mac into the folder (e.g. the files that @test2 just sent) can i send them with scp or something similar?

  • IGNORE! :) just found it :)

  • ok, thanks so much for the help and hand holding @bens and @test2 !!!

  • @duncan_speakman
    "oh, one question about repositories which i really don't understand, if i use

    git clone https://github.com/tehn/aleph.git

    how do i know if it's the master or dev branch? the cloning url on github seems to be the same no matter which page i'm viewing? when i look in the aleph directory there is no dev or master seperation? "

    to see which branch you're on, type "git branch"

    i think by default "git clone" just pulls the master branch. "git pull origin dev" or "git checkout dev" should get you the dev branch.

    the branches are stored as deltas and hashes and all kinds of nasty stuff in aleph/.git , don't worry about it, it is magic

  • @duncan_speakman

    from your first post, those errors look like you don't have the atmel avr32 headers installed, or they are not being seen by avr32-gcc. the headers are a separate download from the toolchain for some reason (probably a legal thing...) - that much is in the README.

    i recently went through this process on a clean system and had a slight moment of frustration when i couldn't get the toolchain to see the part headers. as a dirty hack i just edited apps/bees/config.mk
    added a line to the $INC_PATH make variable to explicitly include the atmel headers

    # List of include paths.
    INC_PATH += \
    $(APP_DIR) \
    $(APP_DIR)/src \
    $(APP_DIR)/../../common \
    $(APP_DIR)/../../../avr32-toolchain-linux/include


    there must be some default filestructure that i'm forgetting about. i'm loath to commit this since it means you have to have your toolchain in a specific location relative to the aleph sources. but maybe it helps.

  • @zebra i got it working in the end using the vagrant build :) - though there's still a few errors when i try to actually make things, but those are just problems with the code on github i guess?

  • ok. of course there should be no problems/errors with building bees from either branch. (not so much with the standalones.. i need to fix them, probably this weekend. busy now with patch editor.)

    if, as i suspect, you are getting a whole crapton of errors starting with:
    ../../avr32_lib/asf-3.7.3/avr32/utils/compiler.h:62:22: error: avr32/io.h: No such file or directory

    then it is not finding the atmel headers. the hack above should fix this. actually i just pushed this hack to the dev branch... so if you want you can try just grabbing that and see if it fixes it...

    cd ~/aleph/app/bees
    git checkout dev config.mk
    make