How to install gcc


  • administrators

    @John-Richardson wow, very cool of Atmel to build that in!
    We'll be looking into this!



  • @Lazar-Demin Actually the Arduino project did the add-in work, and Intel did the Galileo/Edison "board package". But the board support package model is available to all and documented at Arduino.cc.



  • @Kit-Bishop thanks for your steps "how to do" to setup compiler was very helpful, I finaly have also a c program working, I had the same "file not found" problem, after following the wiki



  • @Kit-Bishop said:

    mips-openwrt-linux-uclibc-gcc test-prog.c -o test-prog

    Hi,

    I installed the toolchain and made a makefile to compile following code:

    #include <stdio.h>

    int main(int nArgc, char* pArgv[])
    {
    printf("This is my first C app for Onion\n");
    return 0;
    } // main
    <<<

    I get an error like this, I must be missing some initialisation #define !?

    [simonjo@ASTR76L0 build]$ make -f Maketest.onion
    rm -rf ../test.o test.onion
    g++ -c -I /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include -DONION -DOS="LINUX" -DLINUX -DDEBUG ../test.cpp -o ../test.o -I..
    In file included from /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/stdio.h:36,
    from ../test.cpp:8:
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/bits/types.h:132:3: error: #error your machine is neither 32 bit or 64 bit ... it must be magical
    In file included from /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/stdio.h:36,
    from ../test.cpp:8:
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/bits/types.h:137: error: ‘__STD_TYPE’ does not name a type
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/bits/types.h:138: error: expected constructor, destructor, or type conversion before ‘unsigned’
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/bits/types.h:139: error: expected constructor, destructor, or type conversion before ‘unsigned’
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/bits/types.h:140: error: expected constructor, destructor, or type conversion before ‘unsigned’
    <<<



  • Ok I managed to get past the problem in bits/types.h by adding '#define _MIPS_SZPTR 32'

    But then I came to realize I was using the standard x86 compiler from my CentOS 6.5, not the one from the MIPS toolchain.

    So I used the instructions to extend PATH and set STAGING_DIR, then use 'mips-openwrt-linux-uclibc-gcc test.cpp -o test.onion'

    Now I get below error, I presume this is because my CentOS is 32bit and the toolchain contains 64bit executables... Do you have a 32bit version available ???

    [simonjo@ASTR76L0 build]$ mips-openwrt-linux-uclibc-gcc test.cpp -o test.onion
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc: line 82: /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc.bin: cannot execute binary file
    /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc: line 82: /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc.bin: Success
    <<<



  • @Johan-Simons A couple of points:

    1. From your first post, you should not need to have a #define _MIPS_SZPTR 32 in your code once you have sorted out the 32/64 bit issue. Using your source code exactly as posted using my 64 bit KUbuntu.14.04 set up, your code works as expected
    2. I have tried to look for a 32 bit version of the tool chain but can't find one. The link posted for the 64 bit tool chain was supplied by the Omega people. The best I have been able to find is from https://onion.io/downloads where it says:
      • AR71xx Image Builder Pre-compiled OpenWrt build environment suitable for creating custom images without compiling everything from source. For x86_64 environment only!
      • AR71xx SDK Pre-compiled OpenWRT toolchain for cross-compiling single userspace packages for a specific target without compiling the whole system from scratch. For x86_64 environment only!
      • AR71xx Toolchain Uncompiled source for the AR71xx SDK. Useful if you need to compile the toolchain for 32-bit environments.

    So I think your best bet will be to try to build the 32 bit toolchain yourself unless the guys at Omega can be prevailed upon to produce a precomiled 32 bit version



  • Hi Kit,

    Thx for the response

    Trying to compile a 32bit toolchain myself sounds kind of scary, I'm a Windows person, doing Linux is limited to using cross compilers...

    I will check with some more Linux minded colleagues about this option and some help.

    A second option might be easier, just get a 64bit version of Linux installed using netinstall, a good reason to start using an SSD.

    Anyway, if the Onion crew can come up with a solution, that also would be appreciated very much.

    regards



  • A heads up... that last uncompiled toolchain you mentioned was a complete toolchain but also 64bit I guess as it gives me the same results

    [root@ASTR76L0 bin]# ./mips-openwrt-linux-uclibc-gcc
    ./mips-openwrt-linux-uclibc-gcc: line 82: /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc.bin: cannot execute binary file
    ./mips-openwrt-linux-uclibc-gcc: line 82: /usr/onion/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc.bin: Success
    <<<



  • @Johan-Simons So long as you have a 64 bit windows machine, easiest option is to probably install VirtualBox on your windows system (https://www.virtualbox.org/wiki/Downloads - get a 64 bit version).
    Then do one of:

    1. Obtain a copy of the Linux system you want. I, and I believe several others, use 64 bit KUbuntu 14.04 - it is more than sufficient for what is needed - http://www.kubuntu.org/getkubuntu/ and install it on a VirtualBox image
    2. If you don't want the hassle of installing KUbuntu, prebuilt VirtualBox VM images are available from here: http://www.osboxes.org/kubuntu/ - though I don't know how they are configured in terms of memory and disk space setup. Just down load the one you want and open it in VirtualBox


  • Is there a reason that once we've added additional storage via overlay that we couldn't install a full gcc and associated build tools (make, autoconf, etc.) on the omega itself? I have gcc on there, but can't find a way to get make, etc. onto the little computer so I can compile other Linux software I want to port to the thing. Is there some hidden opkg of build tools I just don't know about?



  • @Johan-Simons If you can tell me the version of Linux you are using I can create the SDK for you.



  • @Justin-Sowers The Omega (or most OpenWRT devices for that matter) has very limited computational resources, so people don't generally compile anything directly on them, which is probably why you are unable to find packages that allow you to install build tools. However, things like make and autoconf are just binaries that can you compiled from source. So if you want to compile it for the Omega, it's simply a matter of creating a Makefile in your cross-compile environment and build an opkg package out of them.



  • @Boken-Lin I read the post from @Justin-Sowers as meaning he wanted to be able to do the build actually on the Omega itself having made more space available via the overlay method. Though I'm sure you could give a more definitive response to this, it would seem to me that this would not be possible, not because of (disk) storage space but because of RAM limitations.
    Any comments?



  • @Kit-Bishop RAM is definitely a limitation. However, I think if he sets up a swap partition on the USB drive it might just work.



  • @Boken-Lin Setting up a swap partition should help there. Any suggestions as to how to go about this on the Omega? If not, I will have a look myself to see if I can figure something out.

    That would just leave the need to have access to Omega packages etc. for gcc, make etc. and any other needed utils.



  • @Kit-Bishop Yeah, it should be pretty straight forward. Remember /etc/config/fstab from setting up rootfs? You just need to add a few more lines to enable swap:

    For swap partition

    config 'swap'
            option  device  'sda1'
            option  uuid    'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    

    Swap file

    config 'swap'
            option  device  '/mnt/shared/swap'
    

    Swap device by label (mkswap -L swap /dev/sdb2)

    config 'swap'
            option  label 'swap'
    

    Save the file and reboot.



  • @Boken-Lin Thanks - I'll give it a try.
    Since I already use my USB device for /overlay, presumably I will need to re-partition my USB drive with two partitions:

    1. An ext4 partition for /overlay
    2. A swap partition for swap

    Any suggestions as to what would be a suitable size for the swap partition?

    Also, once all details are ironed out, perhaps the details should be made the subject of a Wiki tutorial (with reference too to the usage of the USB drive for overlay and swap)



  • @Kit-Bishop You can try a swap of 512MB, it should be enough for compilation purposes.

    And yup, I will write up a separate tutorial for that.



  • @Boken-Lin I have had a try at setting up swap on a USB drive partition and believe it is actually working. 🙂 My Omega still works fine after the steps I describe below and as shown below I believe I have the expected swap space. Note in the steps I describe below I wanted to maintain a partition on the USB drive for overlay.

    Steps I have performed and some associated information are:

    1. Partitioned my USB drive with 2 partitions as follows:
      • Partition 1: 100MByte partitioned as linuxswap
      • Partition 2: Rest of drive as ext4 partition for overlay
    2. Performed the steps necessary to use partition 2 for /overlay directory
    3. Resultant /etc/config/fstab is:
      config 'global'
      option anon_swap '0'
      option anon_mount '0'
      option auto_swap '1'
      option auto_mount '1'
      option delay_root '5'
      option check_fs '0'

    config 'swap'
    option device 'sda1'
    option uuid 'b1b4771d-fc9c-4cc9-811d-04f4f8a8925d'
    option enabled '1'

    config 'mount'
    option target '/overlay'
    option uuid 'b2580ec6-6d9f-4514-930a-df481be20b99'
    option enabled '1'
    4. Output from the free command before setting up the swap was:
    total used free shared buffers
    Mem: 61180 27184 33996 92 3484
    -/+ buffers: 23700 37480
    Swap: 0 0 0
    5. Output from the free command after setting up the swap is:
    total used free shared buffers
    Mem: 61180 28092 33088 92 3644
    -/+ buffers: 24448 36732
    Swap: 1028124 0 1028124
    This seems to indicate that swap is operative 🙂



  • @Boken-Lin
    I am using CentOS 6.5
    Getting a specific toolchain would be great
    thx


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.