Build native C code directly on your board

Hello Linino people ! Finally we are able to provide a native GCC compiler for your Linino board. It is now possible to write and run your C code directly on your LininoOS. To install it and start programming, first you have to upgrade your board to the latest Linino image. Please carefully take a look how to do it here :

How to upgrade the Linino distribution for Arduino Yun

If you own an Arduino Yun (and your control panel is the jade green colored one) please stick with the master branch of Linino otherwise you might brick your board !

Since the gcc package is quite cumbersome (it's about 15MB in its compressed form), you have to expand you filesystem to install it properly. Currently, the easiest and fastest way is to use our node.js installation script which will take for you of all the necessary steps :

Node.js installation script

Once rebooted and logged in by means of SSH, type :

$ opkg update
$ opkg install gcc -d mnt

and the system will install the GCC compiler package on the expanded filesystem residing on your external flash memory (it will take a while since as I told before the package it's quite cumbersome). Once the installation has finished run :

$ gcc -v

that should return :

root@onetest /root ## gcc -v
Using built-in specs.
Target: mips-openwrt-linux-uclibc
Configured with: /home/build/builddir/lininoIO/linino_distro/build_dir/target-mips_r2_uClibc- target=mips-openwrt-linux host=mips-openwrt-linux build=x86_64-linux-gnu program-prefix= program-suffix= prefix=/usr exec-prefix=/usr bindir=/usr/bin sbindir=/usr/sbin libexecdir=/usr/lib sysconfdir=/etc datadir=/usr/share localstatedir=/var mandir=/usr/man infodir=/usr/info disable-nls build=x86_64-linux-gnu host=mips-openwrt-linux-uclibc target=mips-openwrt-linux-uclibc enable-languages=c,c++ with-bugurl= with-pkgversion='Linino GCC 4.6.3' enable-shared disable-__cxa_atexit enable-target-optspace with-gnu-ld disable-nls disable-libmudflap disable-multilib disable-libgomp disable-libquadmath disable-libssp disable-subdir-texinfo MAKEINFO=missing disable-decimal-float disable-libstdcxx-pch with-host-libstdcxx=-lstdc++ prefix=/usr libexecdir=/usr/lib --with-float=soft
Thread model: posix
gcc version 4.6.3 (Linino GCC 4.6.3)

you're now ready to write and build your own code ! Let's write together the "Hello World" example. First create a file with thetouch command :

$ touch hello.c

then open it with your favourite text editor and insert the C code :

/* hello.c */
int main() {
  printf ("Hello world!\n");
  return 0;

after saving it, build it with the compiler itself :

$ gcc hello.c  -o hello

After the compilation has finished, run it with just :

$ ./hello

the output should be :

Hello world!

if that works, you're ready to go ! Happy Coding from Linino !