I've copied your ebuild to pentoo overlay (required by mitmproxy) and builds fine on my standard setup. However, there is a new bug report (probably headless or chrooted env) https://github.com/pentoo/pentoo-overlay/issues/144 Could you please have a look? Thank you
quick update: the original reporter confirmed it is not an ebuild bug