OpenSolaris 64-bit: bootstrap.prefix.sh fails to compile python with wrong ELF class: ELFCLASS32. The reason is that emerge mistakenly uses the libgcc_s_so.1 in /usr/sfw/lib and not the one in /usr/sfw/lib/amd64 despite having LDFLAGS as follows: LDFLAGS="-L/usr/sfw/lib/amd64 -R/usr/sfw/lib/amd64 -L/opt/gentoo/usr/lib -R/opt/gentoo/usr/lib -L/opt/gentoo/lib -R/opt/gentoo/lib" The workaround is to move this file into another directory and make a symlink to the correct one in /usr/sfw/lib.
I just realized that the instructions actually don't ask for LDFLAGS to be set until after python is bootstrapped. Now it seems logical to think that that is a bug in itself! But it's the opposite. Having it (or one of the other variables) set is what causes the problem! I just unset it along with all the export variables except for PATH and CHOST and it compiled fine. It's not exactly clear how me this confuses it.
Marking as INVALID since while it's confusing, it does indeed work when the variables are set in the right order.