5

I have installed openwrt on beaglebone black. I found out it doesn't have gcc, g++ or any other compiler/toolchain.

How can i install compiler (preferable g++) for C and C++ in openwrt?

abhiarora
  • 9,743
  • 5
  • 32
  • 57

2 Answers2

3

Openwrt doesn't have any compiler by default , because in many cases you have to compile software in cross compile environment. So you can find the toolchain/gcc in "openwrt buildroot" https://wiki.openwrt.org/doc/howto/build

But, If you want to compile any source code on your Beaglebone , you can get it " opkg install gcc".

m-masa
  • 228
  • 1
  • 9
2

It's very difficult to find an AP with enough space to install gcc in it. The size of gcc_xxx.ipk is about 20MB. Check your free space in rootfs/overlay by typing df -h. If you have enough space modify your /etc/opkg.conf file with the following (modify Chaos Calmer for your OpenWrt version):

dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
src/gz chaos_calmer_packages http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/packages 
src/gz chaos_calmer_luci http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/luci              
src/gz chaos_calmer_routing http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/routing    
src/gz chaos_calmer_telephony http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/telephony
src/gz chaos_calmer_management http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/management

If you don't have enough space you'll have to cross-compile your code.

Despite this you could install gcc in the /tmp memory that is usually much larger by typing

opkg update
opkg install gcc -d ram

and you will find gcc in /tmp/usr/bin. Remember that as soon as you reboot the router gcc will disappear and you will have to repeat all the process (if you install it on ram).