Go Down

Topic: gcc on linino? (Read 16259 times) previous topic - next topic


Kind Regards,


Trying this:

That will work, make sure build 12.09 branch (Attitude Adjustment). and you could get official support  at


May 04, 2014, 09:59 am Last Edit: May 04, 2014, 10:08 am by SPlatten Reason: 1
I've been following the guide on:

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-
drwxr-xr-x 12 simon simon 4096 May  3 21:29 toolchain-mips_34kc_gcc-4.8-linaro_uClibc-

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,
Kind Regards,


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


May 04, 2014, 01:01 pm Last Edit: May 04, 2014, 02:28 pm by noblepepper Reason: 1
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]
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

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.


May 04, 2014, 02:03 pm Last Edit: May 04, 2014, 02:18 pm by noblepepper Reason: 1
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, 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 and unpacked it in my OpenWrt-yun directory and I put my workspace in OpenWrt-yun/eclipse/workspace.

In step 6 I use this

to create a new project and I get this

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".


May 04, 2014, 07:09 pm Last Edit: May 04, 2014, 07:20 pm by SPlatten Reason: 1
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

I modified the path:
Code: [Select]


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?
Kind Regards,


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.
Kind Regards,


May 04, 2014, 07:49 pm Last Edit: May 04, 2014, 07:52 pm by noblepepper Reason: 1
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

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


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.
Kind Regards,


Are you on linux or windows, I didn't know there was a putty for linux.


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.
Kind Regards,


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

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?


Ok, now I get:
Code: [Select]

scp HelloOpenWrt root@
root@'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

Kind Regards,


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.

Go Up