How to install gcc
-
@Boken-Lin said:
Which operating system are you using currently?
I'm using Ubuntu (Kubuntu) 15.10 64-bit (AMD64). My OS is running under VMWare, so there's a fair chance I could match whatever environment you told me to. I will note that compiling OpenWRT using your instructions (Setting Up the Cross Compile Environment) took well over an hour in VMWare!
I'm puzzled like Kit Bishop why OpenWRT won't just run an executable, but I'm used to cross-compiling to uClinux so there must be some differences. I'm going to start playing around with adding a small package to see if I can get something to run on the Omega.
-
@Kit-Bishop Sorry, I misread your post. If you are running the binary from the current directory, then it shouldn't matter where you've installed the binary. Let's try to figure out what's causing the issue. Is the package installed as an opkg package or directly built into a firmware and re-flashed onto the Omega? Did you build the package again musl c library or uClibc? The current Omega firmware is built with uClibc, so there might be a mismatch of c library it uses.
-
@Bryan-Hilterbrand We use Ubuntu 14.04 x64 on our compile environments. I'm going to zip up a compiled toolchain for you to download and test out.
-
Hi, @Bryan-Hilterbrand , Sounds you are running something very similar to me. I am using KUbuntu-10.04 running in a VirtualBox VM on an Intel iCore 5 system.
So far,I have had no luck using https://github.com/OnionIoT/OpenWRT-Packages/wiki/Setting-Up-the-Cross-Compile-Environment
Will shortly see how I go using AR71xx SDK from https://onion.io/downloads.
Will report as and when I get anything done
-
@Boken-Lin Thanks for the additional feedback. I will check out your comments. Also, would be most interested to see the toolchain for Ubuntu 14.04 that you reference in your reply to @Bryan-Hilterbrand
-
@Kit-Bishop, @Bryan-Hilterbrand: Files are uploading now.
SDK: https://onion-cdn.s3.amazonaws.com/community/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar
Toolchain: https://onion-cdn.s3.amazonaws.com/community/openwrt/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tarThe links should become active in a little bit.
EDIT: I posted the wrong links...
SDK: https://s3-us-west-2.amazonaws.com/onion-cdn/community/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
Toolchain: 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
-
@Boken-Lin Cool That was quick
-
@Boken-Lin Am I being impatient and the links you reference are not up yet, or is there a problem with the links?
- For: SDK: https://onion-cdn.s3.amazonaws.com/community/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar I get:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>37A96A62308BF9F6</RequestId><HostId>2mMzuUG6KxeUd+k2PJDgjsV83q5k8QV8UXwosCL+CKvyGRKUbR0iI69xGU5PSQ+Pz8nUyKp1I2M=</HostId></Error> - For: Toolchain: https://onion-cdn.s3.amazonaws.com/community/openwrt/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar I get:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>2D9FE457B4300D92</RequestId><HostId>myrvYfcMVTDgO/AVEEKQZ6YlkkwzbmhP1G8M68YMUmv6zQi5wA18ittx5HL0neMsIVZyMMtIf98=</HostId></Error>
- For: SDK: https://onion-cdn.s3.amazonaws.com/community/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar I get:
-
The share property for those file doesn't seem to be open to everyone. That is why you received:
Access Denied.
-
@Kit-Bishop Strange... Let me take a look...
-
@Eric-P. @Kit-Bishop: I posted the wrong links... I've edited the post with the correct links now. My bad!
-
@Boken-Lin No problem - can access them now
-
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):
-
- PATH=<tc_dir>/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin:$PATH
-
- STAGING_DIR=<tc_dir>/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2
-
- 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.
-
@Boken-Lin Setup a Docker with the tool chain and cross compilers pre-configured. This way people can just docker run it from Ubuntu 14.04.
A VM for virtual box would be more general, similar to what the C.H.I.P. people are doing.
-
@John-Richardson In addition get one of the Arduino style libraries for Linux that the Intel Galileo people did to ease porting of Arduino Sketches.
Eventually the tool chain could plug into the Arduino IDE.
-
@John-Richardson Great ideas! We already have the docker image on our todo list. Just added the virtualbox VM to our todo as well.
Can you explain what you mean by Arduino style library for Linux?
-
@Boken-Lin Sure. Intel Edison and Galileo create a library (it's open sourced) that allows you to take simple Arduino programs and generate a native Linux executable. It easier the porting of existing projects.
The basic Arduino program setup is straightforward, the challenge is getting the right libraries and macro's to compiled out some AVR specific modifiers and intrinsics.
It may be a lot to ask, but it's popular to create Arduino IDE add-ins for different embedded devices. Recent work with Arduino 1.6.5 or later makes it easier to add in CPU specific compilers and tool chains, library headers, etc. They now have an SSH option to upload programs as well.
Maybe it's something the community could work on.
-
@John-Richardson This seems interesting, but could you elaborate on the generated executable?
Does the Arduino IDE generate an executable to run on the dev boards processor and flash an ATmega chip?
Or does it actually cross compile the Arduino sketch into an executable that can run natively on the dev board's processor?
-
@Lazar-Demin In the case of an Arduino/AVR it generates an executable using the gcc cross compiler, linker, ar, etc. It then generates a .hex file from the executable for firmware upload to the board using a tool such as avrdude, dfu, etc.
For a board which has an embedded linux, it generates a cross compiled executable for the board using the proper gcc, linker, ar, etc. It then has an SSH/RCP style method of copying the executable to the target system.
The key is recent changes to the Arduino IDE lets you customize the actions for every step. You can choose the headers and libraries to compile against for the target, you can choose the tools (cross compilers that run on the host and generate for the target), and the upload/copy method.
Intel Edison/Galileo is one example of such as setup targeting a board with embedded Linux from an Arduino IDE. It's made available as an add in as a "board package". Arduino 1.6.5 supports this newer way of supporting multiple embedded boards.
-
@John-Richardson wow, very cool of Atmel to build that in!
We'll be looking into this!