How to install gcc
-
@Boken-Lin
I am using CentOS 6.5
Getting a specific toolchain would be great
thx
-
@Boken-Lin
Hi there, is there any progress on the issue of a toolchain for 32bit CentOS 6.5 ???
thx
-
Hi @Johan-Simons, please download the SDK Here: https://s3-us-west-2.amazonaws.com/onion-downloads/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686.tar.bz2.
The Toolchain is here: https://s3-us-west-2.amazonaws.com/onion-downloads/openwrt/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686.tar.bz2Cheers!
-
@Boken-Lin said:
Hi @Johan-Simons, please download the SDK Here: https://s3-us-west-2.amazonaws.com/onion-downloads/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686.tar.bz2.
The Toolchain is here: https://s3-us-west-2.amazonaws.com/onion-downloads/openwrt/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686.tar.bz2Cheers!
It is working, thx for the solution
-
@Johan-Simons Awesome!
-
@Kit-Bishop @Boken-Lin Could you write-up a quick guide to setting-up a swap partition? I think the bones are in this thread, but not the full guide. I have compiled make, m4, and autoconf from source on the Omega, and have successfully installed them, as well as a few other pieces of software. However, building and running bigger tools like SWIG, likely needs swap. I intend to use SWIG to generate a Ruby extension for the C++ new-gpio lib. BtW, other than running a little slow, the Omega is a fine build machine.
-
@Justin-Sowers I will write a quick guide for this and post it here in a .pdf file - keep watching.
@Boken-Lin When I have done the guide, would it be a suitable candidate for a Wiki Tutorial?
-
@Justin-Sowers @Boken-Lin I have created a new post (https://community.onion.io/topic/533/using-linux-swap-space-on-the-omega) that contains the guide.
Hope it is useful.
-
@Kit-Bishop then how can you compile a C program ? can you explain it to me please ?
-
@Ahmed-Mkadem I compile C/C++ using cross compilation on a Linux system (I use Kubuntu).
Some details can be found at https://community.onion.io/topic/9/how-to-install-gcc/22You may also be interested in the set of C++ libraries and programs I have produced for perfroming GPIO, I2C and Arduino access on the Omega. The full set of these can be found at https://github.com/KitBishop/Omega-GPIO-I2C-Arduino The various documentation .pdf files therein give more details.
You might in particular look at the template program that is included in the above referenced package - see https://github.com/KitBishop/Omega-GPIO-I2C-Arduino/tree/master/iotemplate and its documentation at https://github.com/KitBishop/Omega-GPIO-I2C-Arduino/blob/master/iotemplate/iotemplate.pdf
Hope that helps
-
@Kit-Bishop Thank you !! this is helpful
-
@Kit-Bishop hi dear
im new with Linux and want to use the cross compiler
can you please explain ho to do these steps !
setting the environment variables , install the tool chain ?
also the omega didn't have sftp server so how can i transfer the executable file ?
-
@Boken-Lin said in How to install gcc:
@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
andautoconf
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 aMakefile
in your cross-compile environment and build anopkg
package out of them.hi dear
is there ant tutorial explain that process in actual details ?
-
@anglo-marc you can start from here.
-
hello i install gcc. I downloaded library i2c from https://github.com/OnionIoT/i2c-exp-driver
-
onion-i2c.c
-
onion-i2c.h
-
onion-debug.c
-
onion-debug.h
wrote a program, copy files to usr/c/ and run gcc
gcc -I usr/c/ -o program usr/c/HTU21D.c
but while compiling gets an error:
/tmp/ccnKdEjA.o: In function `getTemperature()': HTU21D.c:(.text+0x88): undefined reference to `i2c_writeBytes' HTU21D.c:(.text+0x94): undefined reference to `i2c_writeBytes' collect2: error: ld returned 1 exit status
my program:
#include "HTU21D.h" int main () { printf("Hello world!\n "); //printf("%5.2fC\n", getTemperature()); return 0; } double getTemperature() { unsigned char buf [32]; int status; i2c_writeBytes(0, 0x80, 0xF3, 0, 0); //status = i2c_read(0, HTU21D_I2C_ADDR, HTU21D_TEMP, buf, 3); unsigned int temp = (buf [0] << 8 | buf [1]) & 0xFFFC; double tSensorTemp = temp / 65536.0; return -46.85 + (175.72 * tSensorTemp); }
file .h
#ifndef _HTU21D_H_ #define _HTU21D_H_ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <unistd.h> #include <onion-i2c.h> #define HTU21D_I2C_ADDR 0x80 #define HTU21D_TEMP 0xF3 #define HTU21D_HUMID 0xF5 double getTemperature(); #endif
-
-
- Your
file.h
should be namedHTU21D.h
. - Delete the space after the -I argument.
- Move every unnecessary
#include
from the.h
to thec
/cpp
file. In this case, all.
- Your
-
None of those suggestions are likely to help. Unless there are missing macro definitions, an "undefined reference" error is an issue with linking rather than compilation.
You need to be passing whatever implements this function to the linker, either as a library or as an additional object file, or by providing it to the compiler as an additional source file to be built.
-
@Chris-Stratton Thanks Very Much, it works: D
gcc -Iusr/c/ -o simpleprg usr/c/HTU21D.c usr/c/onion-i2c.c usr/c/onion-debug.c
-
@Boken-Lin said in How to install gcc:
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!
hi dear
i see this article .. its not clear for me as beginner in Linux
most of steps i don't know where !
can help please ?
-
@anglo-marc check my signature for a Docker ready environment, or check this project to setup it in your host pc.