Cross compile, again...
There should be a tutorial on how to cross compile a hello world for the Omega.
The current cross compile tutorial is more for someone who would like to generate a custom firmware image.
I tried Step 6b: Compile Individual Packages, making the tools and toolchain takes forever. I can compile individual package but the binary or package file is nowhere to be found after the compilation.
A better way would be to know how to use the OpenWRT SDK : http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
There is some tutorials online, but for older OpenWRT versions ( https://giovanni.wordpress.com/2011/01/23/how-to-cross-compile-a-c-program-for-openwrt/ )
The tutorial works, but only for White Russian 0.9. I tried the steps for the Chaos Calmer SDK and I failed to be able to compile a simple Hello World.
It would be very useful to know how to use the SDK, a lot of useful programs could be ported to the Omega.
Oops, I just saw Kit-Bishop post on another thread :
After battling with this for quite some time, I finally have success with what I've been wanting to do
Ended up being quite straightforward - I think I got bogged down in all the intricacies of building OpenWRT packages when all I wanted to do was build some basic C/C++ programs that would run on the Omega.
For the record, in case it is of help to others, this is what I ended up doing based largely on the info in:http://techfindings.one/archives/1487
For the record my host system for the compilation is a pretty standard KUbuntu-14.04 system running in a VM under VirtualBox
- Download the tool chain from https://s3-us-west-2.amazonaws.com/onion-cdn/community/openwrt/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
- Unpack it to some suitable directory (referred to below as <tc_dir>)
- Set up environment variables as follows (I put this in my ~/.profile file so it was always there):
- export STAGING_DIR
- Create your c program - e.g. test-prog.c
- Compile the program using (e.g.): mips-openwrt-linux-uclibc-gcc test-prog.c -o test-prog
- Transfer the output file (test-prog) to your Omega using you favourite tools.
- On the Omega in the directory you placed the file, run it by: ./test-prog - and there you are
I'm sure there will be other issues (e.g. using a makefile with multiple sources; access to libraries; building dynamic link libraries which I will want too), but these are all pretty standard development issues now that I have the code cross-compilation working.
It looks like that's what I want to. I'll probably have more success that way than trying to use the SDK.
Hi @Fred-Blais, we agree, it's much easier to do the cross-compilation if we provide the SDK. But the problem with the SDK is that it's hard to predict what platform one is trying to compile the firmware on. We'll probably add some content to the tutorial to show how to setup the environment with the SDK. Also, we will be launching a cross-compilation service for you to upload packages to be compiled. Hopefully all of these will make it much easier for everyone who wants to create their own packages.