How to install gcc



  • How can I install gcc. I tried the following:

    root@Omega-0BED:/# opkg install gcc
    Installing gcc (4.8.3-1) to root...
    Collected errors:

    • verify_pkg_installable: Only have 8884kb available on filesystem /overlay, pkg gcc needs 20983
    • opkg_install_cmd: Cannot install package gcc.

    I noticed that the partition /tmp has 30Mb and / has 8Mb. I was wondering if there was a way of resizing / to have more space.

    Thanks

    Ajay


  • administrators

    Hi Ajay,

    /tmp is a RAM disk, which means after your do a reboot, it will disappear. You might want to check out the tutorial here that shows you how to mount a USB drive to the Omega: https://onion.freshdesk.com/support/solutions/articles/6000080075-how-can-i-use-usb-storage- Moreover, it's not recommended to install gcc on the Omega. If you want to compile programs for the Omega, it's generally recommended to setup a cross-compile environment on your computer/server to compile for it.

    For more information about setting up the cross-compile environment, please take a look at this guide: https://github.com/OnionIoT/OpenWRT-Packages/wiki/Setting-Up-the-Cross-Compile-Environment

    Cheers!



  • Cool thanks I will give cross compiling a try.



  • Boken,

    I read through the link you provided about the cross-compile environment. It looks like you have to download and compile the entire OpenWRT OS just to get the cross-compile environment.

    I'm not interested in tinkering with the OS or creating packages at this point - I just want to compile some small executables. Isn't there a cross-compile toolchain somewhere that would just allow me to compile executables?

    Bryan



  • @Bryan-Hilterbrand I would really like this too. All I need (at present) is to be able to cross compile C/C++ programs on a KUbuntu host so I can copy the executable to the Omega and run it there.

    I too have been struggling with the full OpenWRT OS build as given in the instructions and would really like just a basic set of C/C+ tool chain for cross compilation without the full OS stuff



  • Further to my previous post to this topic:
    I believed I had figured it out.

    I accessed the compilers etc. from
    /home/kit/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.11/

    Using this,I appeared to be able to successfully build a small, very simple test program (testc) which I then copied to my Omega but when I try to run it on my Omega, all I get is:

    root@Omega:~# ls -l
    -rwxrwxrwx    1 root     root          8994 Nov 18 12:26 testc
    root@Omega:~# ./testc
    -ash: ./testc: not found
    root@Omega:~#
    

    So clearly I have done something wrong, but I haven't a clue what:-)
    Anyone have any thoughts?



  • A further follow up in case it is of any assistance;
    I have installed the build chain etc based on instructions in https://github.com/OnionIoT/OpenWRT-Packages/wiki/Setting-Up-the-Cross-Compile-Environment
    from this, I can apparently successfully build (most) packages.
    My next step at an attempt to build my own C/C++ program will be to effectively clone the fast-gpio package (because it seems to only contain C/C++ code) but with the source replaced by my own sources.
    Then, if this works, I will see if I can get the resulting build of my code to run on the Omega.
    However, this does seem an overly involved, run about process just to compile some simple C/C++ for the Omega and I would like something a bit simpler.


  • administrators

    Hi @Bryan-Hilterbrand, we have the toolchain in their binary format for some architectures available for download at https://onion.io/downloads. However, if your compile environment is running on a machine of different architecture, then it wouldn't be possible for us to provide the toolchain because we would need to have the exact same computer running the same operating system in order to compile the toolchain. Which operating system are you using currently?


  • administrators

    @Kit-Bishop The reason why it wasn't working before might be as a result of not setting up install directories properly in makefile (which means you can compile the code into binary, but the system wouldn't know to install it into /bin so that you can execute it in the terminal).

    Also, we have a few ideas to make compiling for the Omega a bit easier, such as setting up a shared compilation server where you can upload files to be compiled and it generates an opkg file for you to download. We welcome any idea on how we can scale this thing so that the server won't blow up if 100 people requested to compile something simultaneously.

    That's also why we are working so hard on the wrapper functions for various scripting languages! This will allow you to write software and get it to run on the Omega without compiling anything :)



  • @Boken-Lin First, thanks for both of your above replies.

    • I will certainly look at the reference you give in your first reply above: we have the toolchain in their binary format for some architectures available for download at https://onion.io/downloads.
    • Regarding your comment: which means you can compile the code into binary, but the system wouldn't know to install it into /bin so that you can execute it in the terminal
      I am puzzled here. Why would I need to put an executable file in /bin just to run it. I would have thought that any correctly compiled executable file would be capable of running from anywhere.
      I have tried putting the executable into all of the following directories just in case I was misunderstanding something: /bin, /sbin, /usr/bin, /usr/sbin and get the same not found message in all cases.
      I have also tried copying the fast-gpio file I built using https://github.com/OnionIoT/OpenWRT-Packages/wiki/Setting-Up-the-Cross-Compile-Environment and that gives the same not found message no matter what I do.
      I can successfully run an executable shell script, so I guess I am doing something wrong somewhere with my build processes.
      I will keep digging and see what I can find:-(


  • @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.


  • administrators

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


  • administrators

    @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


  • administrators



  • @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?



  • The share property for those file doesn't seem to be open to everyone. That is why you received:
    Access Denied.


  • administrators

    @Kit-Bishop Strange... Let me take a look...


  • administrators

    @Eric-P. @Kit-Bishop: I posted the wrong links... I've edited the post with the correct links now. My bad!


Log in to reply