Trying to compile on an OpenWRT instance can be challenging. With a Raspberry Pi, you may have some luck. You'll need to install all the "standard" GNU build dependencies and the header sets for the needed libraries on the device itself.
The initial failure you're seeing appears to be that /usr/bin/gcc isn't able to compile on your instance, at least as it is configured now.
You could create a package Makefile and cross-compile it on a "build" machine.
I have also run into problems with pip and Python venv use under OpenWRT, even with pure-Python packages in that it seems to not "respect" the venv.
I've never tried to install a complete, functional build chain on an OpenWRT device, due to flash-size constraints and knowing how terribly slow it is to compile anything on an older Raspberry Pi (which is likely faster than most home routers).