I don't have a Solaris system handy to see why this breaks, but that sed construct is part of gcc itself, not NetBSD's localizations or build structure. Solaris sed is known to be particularly retarded, though; prepending /usr/xpg4/bin (or whatever it is) to your PATH may help.