ENV/std: use full paths to gcc versions.

This is consistent with how e.g. `gcc-4.2` is handled.

This means e.g. `ghc` can find `gcc-4.8` at runtime.

Fixes #28934.

Also: use opt in more places to avoid unnecessary formulae being created and exceptions thrown/caught.