GCC 8+ on OpenWrt?

I'm wondering if there are any ways I can install GCC 8 on OpenWRT? At this point I'm getting GCC 7, and trying to install some Ruby gems. However, I'm getting

arm-openwrt-linux-muslgnueabi-gcc: error: unrecognized command line option '-ffile-prefix-map...

So ffile-prefix-map option is not supported on GCC 7.

I can cross-compile, but only simple C programs. I'm looking for ways to install GCC 8 on OpenWrt. I understand there is no package, but maybe there is some other package sources or direct links to ipks?

OpenWrt isn't self-hosting, there are no header- or development libraries packaged - the runtime installable gcc won't do more than compiling the most trivial hello_world.c sources without external dependencies.

1 Like

Well, my final goal is to install a Ruby gem. I'm looking to install ffi https://github.com/ffi/ffi

I'm using just gem install ffi inside the OpenWrt, and I hope it will compile things with GCC 8.

With cross-compile I can compile, but can't figure out how to install/create the Ruby gem on host machine. There is no any instructions available, I spend like 20 hours or so on that. So it's easier for me just to compile inside the router.

The runtime installable gcc package is not going to help you with that, regardless of the version. Only the cross-compiler has those features, at build-time.

I never try to select/switch GCC versions. I noticed different openwrt version using different GCC, .config file has the info.
v21.02.0 uses GCC-8.4 and snapshot uses GCC-11.3, maybe it's devices dependent also.

It can be, but it's usually tried (really hard) to use the same toolchain- and kernel versions for all targets, to ease maintenance.

If it's true, do you mind running opkg install gcc on that system and paste the link to GCC v8?

I see there is v7 package https://openwrt.org/packages/pkgdata/gcc - but there is no any v8. If I have a link I can install it just with opkg install https://downloads... - in other words, with URL.

Hi, maybe I was wrong, we have OpenWrt package gcc (version 7.4.0-5) and compiler GCC (version 8.4...) defferent, no GCC v7.

In file openwrt\toolchain\gcc\common.mk, .config file decided which version GCC used:

include $(TOPDIR)/rules.mk

PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))


ifeq ($(PKG_VERSION),8.4.0)

ifeq ($(PKG_VERSION),10.3.0)

ifeq ($(PKG_VERSION),11.3.0)

ifeq ($(PKG_VERSION),12.1.0)




include $(INCLUDE_DIR)/toolchain-build.mk