Arduino Forum

Products => Arduino Yún => Topic started by: SPlatten on Apr 27, 2014, 05:07 pm

Title: gcc on linino?
Post by: SPlatten on Apr 27, 2014, 05:07 pm
I would like to use gcc to build a jni library, can I install gcc?

How?

Thank you,
Title: Re: gcc on linino?
Post by: noblepepper on Apr 27, 2014, 05:48 pm
You can cross compile a program on a linux host system, transfer it to your Yun and run it on Linino. Since the newest Yun image is based on Attitude Adjustment this SDK should work with no problems now. It worked for most things on the old image as well.
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 (http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2)
Title: Re: gcc on linino?
Post by: SPlatten on Apr 27, 2014, 05:57 pm
Thank you, will investigate.
Title: Re: gcc on linino?
Post by: SPlatten on May 01, 2014, 01:57 pm
I've been trying to build the toolchain in:
Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP

I've been following the instructions at:
https://github.com/todbot/blink1/tree/master/openwrt

But I'm getting and error when I try to execute:
Code: [Select]

sudo make tools/install


The error is:
Code: [Select]

Checking 'working-make'... ok.
Checking 'case-sensitive-fs'... ok.
Checking 'getopt'... ok.
Checking 'fileutils'... ok.
Checking 'working-gcc'... ok.
Checking 'working-g++'... ok.
Checking 'ncurses'... ok.
Checking 'zlib'... ok.
Checking 'gawk'... ok.
Checking 'unzip'... ok.
Checking 'bzip2'... ok.
Checking 'perl'... ok.
Checking '/usr/bin/python2.7'... ok.
Checking 'wget'... ok.
Checking 'git'... ok.
Checking 'gnutar'... ok.
Checking 'svn'... ok.
Checking 'gnu-find'... ok.
Checking 'getopt-extended'... ok.
Checking 'non-root'... failed.

Build dependency: Please do not compile as root.

Prerequisite check failed. Use FORCE=1 to override.
make[2]: *** [tmp/.prereq-build] Error 1
make[1]: *** [prereq] Error 2
make: *** [tools/install] Error 2


Maybe because I'm prefixing the make with sudo, but if I don't then it won't build at all and the error displayed is:
Code: [Select]

make[2]: *** [tmp/.prereq-build] Error 1
make[1]: *** [prereq] Error 2
make: *** [tools/install] Error 2
simon@ubuntu:~/linino/trunk$ uname -a
Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
simon@ubuntu:~/linino/trunk$ make FORCE=1 tools/install
rm: cannot remove '/home/simon/linino/trunk/tmp/info/.files-packageinfo-3546': Permission denied
make[3]: *** No rule to make target `/home/simon/linino/trunk/tmp/info/.files-packageinfo-3910'.  Stop.
cat: /home/simon/linino/trunk/tmp/info/.files-packageinfo-3910: No such file or directory
rm: cannot remove '/home/simon/linino/trunk/tmp/info/.files-packageinfo.stamp.e2acf987b494d5dae9ced9f8732e751f': Permission denied
touch: cannot touch '/home/simon/linino/trunk/tmp/info/.files-packageinfo.stamp.d41d8cd98f00b204e9800998ecf8427e': Permission denied
touch: cannot touch '/home/simon/linino/trunk/tmp/info/.files-packageinfo.stamp': Permission denied
make[2]: *** [/home/simon/linino/trunk/tmp/info/.files-packageinfo.stamp] Error 1
make[1]: *** [prepare-tmpinfo] Error 2
make: *** [tools/install] Error 2


Any ideas?
Title: Re: gcc on linino?
Post by: sonnyyu on May 01, 2014, 02:01 pm
Quote
Checking 'non-root'... failed.


remove sudo and try it again.

Quote
Permission denied


Code: [Select]
sudo chown  username:username -R /home/username
Title: Re: gcc on linino?
Post by: SPlatten on May 01, 2014, 02:10 pm
That did the trick...thank you.
Title: Re: gcc on linino?
Post by: SPlatten on May 01, 2014, 04:15 pm
Next problem whilst working through:
https://github.com/todbot/blink1/tree/master/openwrt

Code: [Select]

    % cd ~/projects/linino/trunk
    % cd package
    % ln ~/projects/blink1/openwrt blink1


I don't see a blink1 file or folder anywhere.
Title: Re: gcc on linino?
Post by: sonnyyu on May 01, 2014, 05:40 pm
Why not use official  openwrt-yun source:

https://github.com/arduino/openwrt-yun (https://github.com/arduino/openwrt-yun)

http://forum.arduino.cc/index.php?topic=235489.msg1699935#msg1699935 (http://forum.arduino.cc/index.php?topic=235489.msg1699935#msg1699935)

after build complete.

Code: [Select]
make menuconfig

compile toolchain and SDK:

(http://i59.tinypic.com/307npfo.jpg)
Title: Re: gcc on linino?
Post by: SPlatten on May 01, 2014, 06:08 pm
Thank you, I'll give it a go.
Title: Re: gcc on linino?
Post by: SPlatten on May 01, 2014, 09:33 pm
Are they're any guides or tutorials on how to use the toolchain to build and target applications for the Yun?
Title: Re: gcc on linino?
Post by: noblepepper on May 01, 2014, 11:04 pm
There is little about the Yun that is not normal OpenWrt stuff. Most of the unique things are in Python.

Here are the OpenWrt guides:
http://wiki.openwrt.org/doc/start#developing (http://wiki.openwrt.org/doc/start#developing)
http://wiki.openwrt.org/doc/devel/crosscompile (http://wiki.openwrt.org/doc/devel/crosscompile)
http://wiki.openwrt.org/doc/devel/packages (http://wiki.openwrt.org/doc/devel/packages)
This tutorial is my favorite setup:
http://downloads.openwrt.org/docs/eclipse.pdf (http://downloads.openwrt.org/docs/eclipse.pdf)
You get full source level debugging!

For linux programs that use configure and make this post has an example:
http://forum.arduino.cc/index.php?topic=237050.msg1704929#msg1704929 (http://forum.arduino.cc/index.php?topic=237050.msg1704929#msg1704929)
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 03:26 am
Thank you very much, will go through those.
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 07:44 am
I left the system building overnight, this morning I found it had stopped with an error:
Code: [Select]

checking for gpgme-config... failed
configure: error: GPGME 1.0.0 or later needed
make[3]: *** [/home/simon/OpenWrt-yun/build_dir/linux-ar71xx_generic/opkg-618/.configured_yyyy] Error 1
make[3]: Leaving directory `/home/simon/OpenWrt-yun/package/opkg'
make[2]: *** [package/opkg/compile] Error 2
make[2]: Leaving directory `/home/simon/OpenWrt-yun'
make[1]: *** [/home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/simon/OpenWrt-yun'
make: *** [world] Error 2


I followed the instructions at:
https://github.com/arduino/openwrt-yun

Any clues?
Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 07:53 am
The instructions has  two ways ssh/git or ssl/https. Which way you are following?

The output of

Code: [Select]
cat /proc/cpuinfo |grep processor
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 09:18 am
From this link:
https://github.com/arduino/openwrt-yun

Followed instructions from 'How to build' down.
Code: [Select]

simon@ubuntu:~/OpenWrt-yun$ cat /proc/cpuinfo |grep processor
processor : 0
processor : 1
processor : 2
processor : 3

Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 09:25 am
output of:

Code: [Select]
nano feeds.conf.default

you have 4 CPU cores, use this command will speed up:

Code: [Select]
DL_FOLDER=~/DOWNLOAD MAKE_JOBS=5 ./build.sh

output of :

Quote
free


http://forum.arduino.cc/index.php?topic=235489.msg1699935#msg1699935 (http://forum.arduino.cc/index.php?topic=235489.msg1699935#msg1699935)

if you use ssl to get source like me then:

"feeds.conf.default"  need update, you might need start over again. But this time with MAKE_JOBS=5.
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 09:41 am
free:
Code: [Select]

simon@ubuntu:~/OpenWrt-yun$ free
             total       used       free     shared    buffers     cached
Mem:       4041044    1894244    2146800      10680     286452     791220
-/+ buffers/cache:     816572    3224472
Swap:      4192252          0    4192252


Contents of feeds.conf.default:
Code: [Select]

DL_FOLDER=/DOWNLOAD MAKE_JOBS=5 ./build.sh
#src-git packages git@github.com:arduino/openwrt-packages-yun.git
src-git packages https://github.com/arduino/openwrt-packages-yun.git
src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package
src-svn luci http://svn.luci.subsignal.org/luci/branches/luci-0.11/contrib/package
src-git routing git://github.com/openwrt-routing/packages.git;for-12.09.x
#src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
#src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
#src-svn xorg svn://svn.openwrt.org/openwrt/feeds/xorg
#src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop
#src-svn xfce svn://svn.openwrt.org/openwrt/feeds/xfce
#src-svn lxde svn://svn.openwrt.org/openwrt/feeds/lxde
#src-link custom /usr/src/openwrt/custom-feed

Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 09:45 am
Code: [Select]
DL_FOLDER=/DOWNLOAD MAKE_JOBS=5 ./build.sh
in "feeds.conf.default" ?
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 09:48 am
It is now, I added it before the last post.
Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 09:52 am
Code: [Select]
checking for gpgme-config... failed
configure: error: GPGME 1.0.0 or later needed


It means package of GPGME is not fed.  You might need  start  over.

Code: [Select]
            total       used       free     shared    buffers     cached
Mem:       4041044    1894244    2146800      10680     286452     791220


47%  memory has been used.


reboot  before start over or:

Code: [Select]
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 09:54 am

Code: [Select]
DL_FOLDER=/DOWNLOAD MAKE_JOBS=5 ./build.sh
in "feeds.conf.default" ?


remove it please.
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 10:00 am
I've removed the entry from "feeds.conf.default"

When I try to execute:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free

I get permission denied on drop_caches.
Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 10:00 am
I mean "start over":

Code: [Select]
rm -rf  /home/simon/OpenWrt-yun

but this time use:

Code: [Select]
DL_FOLDER=/DOWNLOAD MAKE_JOBS=5 ./build.sh

It will take 1/4 of time.

"feeds.conf.default" must updated before run above  command.

Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 10:01 am

I've removed the entry from "feeds.conf.default"

When I try to execute:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free

I get permission denied on drop_caches.


Code: [Select]
sudo free && sync && echo 3 > /proc/sys/vm/drop_caches && free
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 10:04 am
Tried that too:
Code: [Select]

simon@ubuntu:~$ sudo free && sync && echo 3 > /proc/sys/vm/drop_caches && free
[sudo] password for simon:
             total       used       free     shared    buffers     cached
Mem:       4041044    2021568    2019476      10632     322784     835392
-/+ buffers/cache:     863392    3177652
Swap:      4192252          0    4192252
bash: /proc/sys/vm/drop_caches: Permission denied


Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 10:08 am
Code: [Select]
su
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
su simon


I normally open two sessions  one logon as root and one is sonnyyu.
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 10:57 am
Started over, rebuilding all now.
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 11:11 am
Different error this time:
Code: [Select]

--> Package/libfuse/install enter
install -d -m0755 /home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/tmp-libfuse/usr/lib
cp -fpR /home/simon/OpenWrt-yun/build_dir/linux-ar71xx_generic/fuse-2.9.0/ipkg-install/usr/lib/*.so.* /home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/tmp-libfuse/usr/lib/
--> Package/libfuse/install leave
SHELL= /home/simon/OpenWrt-yun/staging_dir/host/bin/flock /home/simon/OpenWrt-yun/tmp/.root-copy.flock -c 'cp -fpR /home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/tmp-libfuse/. /home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/'
rm -rf /home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/tmp-libfuse
touch /home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/stamp/.libfuse_installed
make[3]: Leaving directory `/home/simon/OpenWrt-yun/package/fuse'
make[2]: Leaving directory `/home/simon/OpenWrt-yun'
make[1]: *** [/home/simon/OpenWrt-yun/staging_dir/target-mips_r2_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/simon/OpenWrt-yun'
make: *** [world] Error 2
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 11:20 am
Re-started it with:
Code: [Select]

MAKE_JOBS=5 nice -n 10 make -j $MAKE_JOBS V=s


Seems to be progressing ok.
Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 11:36 am
Stopped again, now trying:
nice -n 10 nohup make -j 1 V=s &

Title: Re: gcc on linino?
Post by: SPlatten on May 02, 2014, 01:07 pm
Trying this:
http://wiki.openwrt.org/doc/howto/build
Title: Re: gcc on linino?
Post by: sonnyyu on May 02, 2014, 03:09 pm

Trying this:
http://wiki.openwrt.org/doc/howto/build



That will work, make sure build 12.09 branch (Attitude Adjustment). and you could get official support  at
https://forum.openwrt.org/ (https://forum.openwrt.org/).
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 09:59 am
I've been following the guide on:
http://wiki.openwrt.org/doc/devel/crosscompile

I've now been through it several times, not sure what I've missed out, but I keep getting to the same stage.  When I try to create a new project in eclipse, I choose the project type, but then I just get a blank wizard page with no further options.

I've seen another reference showing entry for the target toolchain, but I'm not sure how to get there from the original guide.  Also in the guide build it shows a trunk folder, I don't have that.

My tree looks as follows:
Code: [Select]

simon@ubuntu:~/openwrt$ ls -l
total 108
drwxr-xr-x  3 simon simon  4096 May  3 20:51 bin
-rw-rw-r--  1 simon simon   179 May  3 19:11 BSDmakefile
drwxr-xr-x  5 simon simon  4096 May  3 20:00 build_dir
drwxrwxr-x  2 simon simon  4096 May  3 19:11 config
-rw-rw-r--  1 simon simon   560 May  3 19:11 Config.in
drwxr-xr-x  2 simon simon  4096 May  3 21:15 dl
drwxrwxr-x  2 simon simon  4096 May  3 19:11 docs
drwxrwxr-x 10 simon simon  4096 May  3 19:37 feeds
-rw-rw-r--  1 simon simon   714 May  3 19:17 feeds.conf.default
drwxrwxr-x  3 simon simon  4096 May  3 19:11 include
-rw-rw-r--  1 simon simon 17992 May  3 19:11 LICENSE
-rw-rw-r--  1 simon simon  3102 May  3 19:11 Makefile
drwxrwxr-x 12 simon simon  4096 May  3 19:12 package
-rw-rw-r--  1 simon simon  1259 May  3 19:11 README
-rw-rw-r--  1 simon simon 10151 May  3 19:11 rules.mk
drwxrwxr-x  4 simon simon  4096 May  3 19:11 scripts
drwxrwxr-x  5 simon simon  4096 May  3 19:41 staging_dir
drwxrwxr-x  6 simon simon  4096 May  3 19:11 target
drwxrwxr-x  4 simon simon  4096 May  3 21:30 tmp
drwxrwxr-x 12 simon simon  4096 May  3 19:11 toolchain
drwxrwxr-x 54 simon simon  4096 May  3 19:11 tools


Contents of staging_dir:
Code: [Select]

simon@ubuntu:~/openwrt/staging_dir$ ls -l
total 12
drwxr-xr-x 13 simon simon 4096 May  3 20:51 host
drwxrwxr-x 11 simon simon 4096 May  3 21:30 target-mips_34kc_uClibc-0.9.33.2
drwxr-xr-x 12 simon simon 4096 May  3 21:29 toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2


I feel I'm close its so frustrating, the guide isn't the easiest thing to follow as it jumps around, rather than step by step instructions.

Thank you,
Title: Re: gcc on linino?
Post by: federicofissore on May 04, 2014, 11:54 am
Give a look at @fibasile guide for cross compiling a single package http://fibasile.github.io/compiling-nodejs-for-arduino-yun.html

In order to use that guide, you need either the SDK for your OS or a compiled yun image: for the latter, see the guide at https://github.com/arduino/openwrt-yun
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 01:01 pm
You are very close, it looks like you have your build root complete. Check the bin/ar71xx directory, there should be a md5sums file, a package directory and several files that start with openwrt-ar71xx. Even if this isn't there you most likey have the toolchain at this point.

Here is a way to see if you can compile assuming your OpenWrt-yun directory is in your home directory:
Code: [Select]

cd ~/OpenWrt-yun/
mkdir test
cd test

Create a file "src/HelloOpenWrt.c" with these contents using whatever editor you like:
Code: [Select]
#include <stdio.h>

void main(void)
{
 printf("%s","hello world\n");
}


Add the tools location to your path:
Code: [Select]
PATH=$PATH:~/OpenWrt-yun/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin
Now you can compile and link:
Code: [Select]
mips-openwrt-linux-gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloOpenWrt.d" -MT"src/HelloOpenWrt.d" -o "src/HelloOpenWrt.o" "src/HelloOpenWrt.c"
mips-openwrt-linux-gcc -o "HelloOpenWrt"  ./src/HelloOpenWrt.o

Copy the program to the Yun:
Code: [Select]
scp HelloOpenWrt root@arduino.local:/tmp

ssh into the Yun and run the program:
Code: [Select]
ssh root@arduino.local
/tmp/HelloOpenWrt


Don't worry about the missing trunk directory. I don't understand what it is but in some build roots you have it, in others the contents are just in the base directory. If you are working in the current OpenWrt-yun build root just leave the /trunk/ out of the paths when you see it.
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 02:03 pm
If you can compile like I showed in the last post here is how I got Eclipse working, I really think it is worth the trouble if you write programs, if you just want to compile already working programs it may not be worth the trouble.

Start at step 4 in http://downloads.openwrt.org/docs/eclipse.pdf (http://downloads.openwrt.org/docs/eclipse.pdf), you have already completed the steps before this point.
Install openssh-sftp-server and gdbserver on the Yun
Code: [Select]
root@Arduino:~# opkg install openssh-sftp-server
Installing openssh-sftp-server (6.1p1-1) to root...
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/openssh-sftp-server_6.1p1-1_ar71xx.ipk.
Configuring openssh-sftp-server.
root@Arduino:~# opkg install gdbserver
Installing gdbserver (6.8a-4) to root...
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/gdbserver_6.8a-4_ar71xx.ipk.
Configuring gdbserver.


In step 5 I used Eclipse IDE for C/C++ Juno from here https://www.eclipse.org/downloads/packages/release/juno/sr2 (https://www.eclipse.org/downloads/packages/release/juno/sr2) and unpacked it in my OpenWrt-yun directory and I put my workspace in OpenWrt-yun/eclipse/workspace.

In step 6 I use this
(http://forum.arduino.cc/index.php?action=dlattach;topic=236215.0;attach=80126;image)
to create a new project and I get this
(http://forum.arduino.cc/index.php?action=dlattach;topic=236215.0;attach=80124;image)

is this where you have a problem?

If so make sure you did this in step 5:
We have to install additional eclipse packages: enter Menu ? Help ? Install new Software ..
and select in section "Mobile and Device Development" packages "C/C++ GCC Cross Compiler
Support" and "Remote System Explorer End-User Runtime".
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 07:09 pm
Thank you so much for the help, I will try to get follow it tonight, just did the following:
Code: [Select]

simon@ubuntu:~/openwrt$ find . -name mips-openwrt-linux-gcc
./build_dir/target-mips_34kc_uClibc-0.9.33.2/OpenWrt-Toolchain-ar71xx-for-mips_34kc-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc
./build_dir/target-mips_34kc_uClibc-0.9.33.2/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc
./staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc


I modified the path:
Code: [Select]

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/simon/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/


When I tried to compile:
Code: [Select]

mips-openwrt-linux-gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloOpenWrt.d" -MT"src/HelloOpenWrt.d" -o "src/HelloOpenWrt.o" "src/helloworld.c"
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined


The contents of src after compilation is:
Code: [Select]

ls -l
total 12
-rw-rw-r-- 1 simon simon   37 May  4 18:18 HelloOpenWrt.d
-rw-rw-r-- 1 simon simon 1316 May  4 18:18 HelloOpenWrt.o
-rw-rw-r-- 1 simon simon   77 May  4 18:01 helloworld.c


The toolchain path is different to yours, not sure why?
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 07:33 pm
Any idea what the password is likely to be when using scp to transfer file to yun?

I've tried the password I set to login using putty, but no joy.
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 07:49 pm
The password should be the same as you use to login with putty, the web interface or anything else.

You can also set up to not need the password by using a ssh key like this: http://forum.arduino.cc/index.php?topic=196604.0 (http://forum.arduino.cc/index.php?topic=196604.0)

Since you are trying to scp something to the yun I assume you know that the STAGING_DIR warning doesn't stop the linking.

It looks like you are building from a build root from openwrt not the Yun specific build root which gives the difference in paths. It should work for most things but you will probably want to do the Yun build eventually https://github.com/arduino/openwrt-yun (https://github.com/arduino/openwrt-yun)
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 07:52 pm
I don't unstand why I can't connect via scp...I've opened an ssh session using putty and logged in as root with my set password, but I can't get in with the same password on scp.
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 07:53 pm
Are you on linux or windows, I didn't know there was a putty for linux.
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 08:00 pm
Its complicated...I'm running Windows 7 x64 with VMplayer hosting Ubuntu, I'm using Ubuntu to compile and use for Cross Platform development.

Output from uname:
Code: [Select]

Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


Putty is on the Windows desktop.
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 08:06 pm
Are you using root@arduino.local not just arduino.local? I make myself say DOH!! with that frequently.

Code: [Select]
$ ssh arduino.local
pep@arduino.local's password:
Permission denied, please try again.
pep@arduino.local's password:
Permission denied, please try again.
pep@arduino.local's password:
Permission denied (publickey,password).

$ ssh root@arduino.local


BusyBox v1.19.4 (2014-04-10 11:08:41 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
-----------------------------------------------------


root@Arduino:~#
I have the public key stuff set up so it doesn't ask for the password when I use the correct user (root)

I am aware of people using your setup but I am not extremely familiar with how to set it up. Try using ssh like above from within your virtual linux. There may be some extra things needed to get network connectivity from there.

If nothing else can you save the executable somewhere that you can reach from with in Windows and then transfer using putty?
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 08:13 pm
Ok, now I get:
Code: [Select]

scp HelloOpenWrt root@192.168.1.171:/tmp
root@192.168.1.171's password:
HelloOpenWrt: No such file or directory


The files in src are:
Code: [Select]

-rw-rw-r-- 1 simon simon   37 May  4 18:57 HelloOpenWrt.d
-rw-rw-r-- 1 simon simon 1316 May  4 18:57 HelloOpenWrt.o
-rw-rw-r-- 1 simon simon   77 May  4 18:01 helloworld.c


Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 08:18 pm
Is there anything in test?
Code: [Select]
test$ ls -l
total 12
-rwxr-xr-x 1 pep pep 5014 May  4 05:58 HelloOpenWrt
drwxr-xr-x 2 pep pep 4096 May  4 05:58 src

Did you link after compiling?
Code: [Select]
mips-openwrt-linux-gcc -o "HelloOpenWrt"  ./src/HelloOpenWrt.o

You do need to be in the test dir, if not you need to give the path.
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 08:23 pm
Thank you, I was hadn't performed the link, doh! sorry some of this I'm just copying without thinking about what I'm doing should have realised that I need to link the objects.

Transfer the test app to the Yun, ssh'd into it and it works, now for eclipse...

Thank you so much for your help, very much appreciated, I hope I can return the favour in the future.
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 08:34 pm
No problems, it is beer:30 here, I'm off, I'll check in with the phone but my advice may not be all that coherent in a couple of hours.

For repayment just take a vacation in Nashville, I'll show you the worst best dives in town.

Beer, the cause and solution to all of life's problem - Homer
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 08:54 pm
Thank you, would make a nice change from Norwich, lovely as it is.

Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 09:07 pm
In eclipse, have prefix set to:
mips-openwrt-linux-uclibc-

Path set to:
/home/simon/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin

Just trying a very simple example:
Code: [Select]

#include <stdio.h>

int main(void) {
printf("Hello World\n");
return 0;
}


When I build I get:
Code: [Select]

Description Resource Path Location Type
undefined reference to `main' HelloWorld line 95, external location: /home/simon/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/lib/crt1.o:/home/simon/openwrt/build_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/uClibc-0.9.33.2/libc/sysdeps/linux/mips/crt1.S C/C++ Problem
make: *** [HelloWorld] Error 1 HelloWorld C/C++ Problem


Not sure why, nothing looks wrong in the source to me.

Edit:  nevermind, just google'd and found someone with the same problem, shut down eclipse and re-opened, cleaned and build all, problem gone and binary built :)
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 09:18 pm
That looks like the "problems" output, if so you can see the actual commands and compiler output in the console tab which may give better clues.
Title: Re: gcc on linino?
Post by: noblepepper on May 04, 2014, 09:31 pm
Congrats! Now if you follow the eclipse tutorial you can set up the remote system and debugging. Try a for loop in a simple program and you can step through it and set breakpoints and such...
Title: Re: gcc on linino?
Post by: SPlatten on May 04, 2014, 09:45 pm
Just got the remote debugging working, now for some real work :)

Thanks again,  I've got a simple project planned for the Yun for the slot car hobbist...Anyone familiar with the DS-300 kit for lap-timing will know that it offers a serial RS232 connection only.

I've written a Java application that forwards the serial packets onto remote clients using socket.io, it also logs the data so that races can be played back at a later date.

The plan now is to use the Yun to host this application and use it as a server to push the records to clients using the WiFi interface, clients can be mobiles or PC's.



Title: Re: gcc on linino?
Post by: SPlatten on May 05, 2014, 04:31 pm
Development environment working on Laptop, configured remote debugging and it works well.

On my main development system I have tried today to get this set-up, I've got as far as remote debugging, but for some reason I get:
Code: [Select]

Can't bind address: Address already in use.
Killing inferior


Nevermind, rebooted Yun and restarted eclipse, problem has gone.