Changing the CHOST variable/ru

Данный документ объясняет, как изменить переменную CHOST на существующей системе.

Введение
Изменение CHOST это большое дело, которое может серьезно исковеркать вашу систему. Так зачем же для этого вообще нужна статья?

Существуют некоторые ситуации, когда изменение CHOST необходимо. Например, если вы хотите обновиться на glibc 2.4, которая поддерживает nptl, и вы вдруг обнаружили, что ваш CHOST это i386, что делает невозможным использование nptl. В данном случае у вас не так уж и много возможностей, и изменение CHOST это одна из них.

Проблемы могут возникнуть, даже если следовать этим инструкциям, поэтому пожалуйста, удостоверьтесь, что вы прочитали и выполнили все инструкции очень тщательно. В данном примере мы изменим CHOST с i386 на i686. Если вы делаете другое изменение, пожалуйста, измените команды соответствующим образом.

Собираем пакеты
Для начала изменения CHOST, отредактируйте файл и измените значение CHOST на то, которое вам необходимо. Затем пересоберите пакеты в данном порядке:

Verifying things work
Now it is time to make sure that your  and   settings are sane and you do not have any leftovers in.

The output of  and   should look like this (may differ according to your gcc version and chost, gcc 4.1.1 and i686 here):

Next, check to see if there are references to the old CHOST in :

Before deleting the file, let's check for files with the updated CHOST:

This one looks good as there should always be only one file for  in  (05gcc in this example), so let's delete the one with the wrong references:

The same also applies to  - if there's an extra one, see which is the outdated one and delete it. Next, check your

That one looks good, those two files actually should be there. Time to move on to the gcc directory.

and are fine, but  is another leftover that needs removal.

Now run the following commands to update your environment:

Then verify everything is fixed:

If you still find something, you must have missed some file, try to track it down before going on.

Finishing The Change
Now it is necessary to re-emerge  and run. Make sure to use the correct gcc version (your current one, 4.1.1 here, and the old architecture, i386 here). Replace $CHOST with your new CHOST, and  with your gcc version. This example assumes a CHOST of i686.

You may want to rebuild all your packages:

Now, in theory it should not be necessary to do so, but it can not be 100% guaranteed that this is actually the case. If you do not recompile the world target, I have been told at least some packages need recompiling, so you should do:

All packages using perl install to the CHOST directory and hence need remerging. In case you haven't installed , you will need to install  first.

If you encounter other packages that need recompiling, please let the author of this document know.

Common problems
When upgrading from gcc 3.3 to 4.1 at the same time as changing the CHOST (please don't do that anyway), a couple of users reported broken packages that need recompiling, such as groff and courier:

Error messsage

This happens because during the upgrade, the CHOST doesn't exactly match CTARGET and the compiler assumes cross-compiling. As a consequence, LDPATH isn't inserted into, resulting in this error.

Please see our GCC upgrade guide for what needs to be rebuilt after a GCC upgrade.

In some rare cases, this can break old versions of python, too. This may be fixed by adding (change accordingly to your old chost and gcc version) to , running   and then. However, as you can see, you really should avoid running into this problem - don't change CHOST and your gcc version at the same time.

Feedback
That should be all, feedback (both if it worked, failed or other problems were encountered) is welcome, please send an email to or post to this forums thread. Much in this howto comes from vapier, thanks for your help!

Acknowledgements
We would like to thank the following authors and editors for their contributions to this guide:


 * Wernfried Haas
 * Mike Frysinger
 * Chris White