HOWTO change CHOST relatively safely
From Gentoo Linux Wiki
Although the official CHOST change guide will work in many cases, apparently there are some cases where your system will bork itself. The following steps are a little more specific and should be safe in even more cases.
1. Change your CHOST. Edit /etc/make.conf and update the CHOST definition
2. Clear your ccache, if relevant
# ccache -C
3. Emerge gcc to get a gcc install for the new CHOST
# emerge gcc
4. Update the selected version gcc
# gcc-config -l # gcc-config (the version with the new chost)
5. Fix libtool files
# fix_libtool_files.sh (on any older versions of gcc)
# fix_libtool_files.sh (same again with --oldarch {your_old_arch})
# fix_libtool_files.sh (on current version of gcc)
# fix_libtool_files.sh (on current version with --oldarch {your_old_arch})
6. Update the local environment
# env-update && source /etc/profile
7. Emerge binutils to get a binutils install for the new CHOST
# emerge binutils
8. Update the selected version of binutils
# binutils-config -l # binutils-config (the version with the new chost)
9. Re-emerge a bunch of important packages. Note, apr and apache can be left off this list if you do not use them. But if you do, it is important that they are re-emerged now.
# emerge --oneshot binutils-config gnuconfig m4 bison libintl gcc-config autoconf autoconf-wrapper automake pkgconfig make flex gdb patch glibc apr apache
10. Update the local environment again
# env-update && source /etc/profile
11. Re-emerge perl and python and all related ebuilds
# emerge -e perl python
12. Re-emerge libtool.
# emerge --oneshot libtool
13. Run perl-cleaner to fix any modules.
# perl-cleaner reallyall
14. Fix up stdc++ libraries and anything that depends on them.
# emerge libstdc++-v3 # revdep-rebuild --library libstdc++.so.5 # revdep-rebuild --library libstdc++.so.6
