Changing the CHOST variable

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Changing the CHOST variable and the translation is 21% complete.
Outdated translations are marked like this.

이 문서는 시스템에 있는 CHOST 변수 값을 바꾸는 방법을 설명합니다.

CHOST 값을 바꾸는 일은 시스템 전체를 이상하게 꼬이게 할 수 있는 큰 문제입니다 - 그러니까 왜 그 대혼란을 야기할 문제가 안내서에 있냐고요?

CHOST 값을 어쩔 수 없이 바꿨을때 몇가지 상황이 발생하는데, 예컨대, nptl만 지원하는 glibc 2.4를 업그레이드 하려 하는데 CHOST 값을 nptl 사용이 불가능한 i386으로 설정한 경우를 찾을 때가 있습니다. 이 경우, 상당히 많은 옵션을 보유하지 않아, 이 옵션 중 CHOST 값을 바꿔야 합니다.

이 절차를 따르더라도 문제가 발생할 수 있으니, 매우 조심스럽게 읽고 실행에 옮겼는지 확인 하십시오. 이 경우 CHOST 값이 i386에서 i686 으로 바뀌며, 개인적인 상황에 따라 다른 값을 바꿨을 경우 그에 따라 명령도 바꿉니다.

To start out with the CHOST variable change, edit the /etc/portage/make.conf file and add/change the CHOST value to suit the requirements.

파일 /etc/portage/make.conf
CHOST="mips64-unknown-linux-gnuabin32"

Note that profiles provide a default setting for CHOST; depending on the situation, it may be necessary to override it in /etc/portage/make.conf or remove an override in /etc/portage/make.conf. In any case, the important point is that the effective value changes.

Please note that if planning to use another value of CHOST than the profile default, the CHOST_${ABI} variable may need updating as well. It is possible to query the value of this variable of the currently set profile with the portageq tool:

user $portageq envvar ABI
n32
user $portageq envvar CHOST_n32
mips64-unknown-linux-gnuabin32

If this value is equal to CHOST, it's good. Otherwise, override it as well, e.g.:

파일 /etc/portage/make.conf
CHOST_n32="mips64-unknown-linux-gnuabin32"

꾸러미 빌드

중요
It is generally a good idea to rebuild the packages to the same versions as before the CHOST switch, i.e. avoiding combining upgrades with it. If multiple slots are installed, either uninstall extraneous slots or rebuild all of them. If that is not possible, please upgrade the packages first (with old CHOST). While it may not be impossible to do so, it is hard to predict which potential problems may arise and almost impossible to document them in this guide.
중요
If the CHOST switch takes place together with other changes, e.g. in the course of a profile upgrade, please read the documentation there as well to make sure the different steps do not interfere.

Rebuild the following packages in this order:

root #emerge --ask --oneshot sys-devel/binutils
참고
gcc를 컴파일하기 전에 binutils-config 를 실행해야 할지도 모릅니다.
root #emerge --ask --oneshot sys-devel/gcc

For glibc based systems:

root #emerge --ask --oneshot sys-libs/glibc

For musl based systems:

root #emerge --ask --oneshot sys-libs/musl

동작 확인

이제 gcc-configbinutils-config 설정이 온전한지 확인하고 /etc/env.d/에서 나머지 요소를 날릴 때입니다.

gcc-configbinutils-config 출력은 다음과 같아야 합니다:

참고
gcc 버전과 CHOST 값에 따라 다를 수 있으며, 여기는 GCC 4.1.1과 i686에 해당합니다
root #gcc-config -l
 [1] i686-pc-linux-gnu-4.1.1 *
root #gcc-config -c
i686-pc-linux-gnu-4.1.1
root #binutils-config -l
 [1] i686-pc-linux-gnu-2.16.1 *
# binutils-config -c
i686-pc-linux-gnu-2.16.1

다음, 이전 CHOST 변수 값을 /etc/env.d/에서 참조하는지 확인하십시오:

root #cd /etc/env.d/
root #grep 386 *
05gcc-i386-pc-linux-gnu:PATH="/usr/i386-pc-linux-gnu/gcc-bin/4.1.1"
05gcc-i386-pc-linux-gnu:ROOTPATH="/usr/i386-pc-linux-gnu/gcc-bin/4.1.1"

Here, binutils is fine - there is one file, and it only contains references to the new CHOST. For gcc, there is a file for both the new and the old CHOST value, so delete the old stale one:

root #rm 05gcc-i386-pc-linux-gnu

이 같은 설정은 binutils에도 적용합니다 - 추가 요소가 있을 경우 오래된 요소를 찾아 삭제하십시오. 다음 /etc/env.d/binutils/ 디렉터리를 확인하십시오:

root #cd /etc/env.d/binutils/
root #ls -la
total 8
-rw-r--r-- 1 root root  15 Sep  3 13:48 config-i686-pc-linux-gnu
-rw-r--r-- 1 root root 126 Sep  3 13:48 i686-pc-linux-gnu-2.16.1
root #cat config-i686-pc-linux-gnu
CURRENT=2.16.1
root #cat i686-pc-linux-gnu-2.16.1
TARGET="i686-pc-linux-gnu"
VER="2.16.1"
LIBPATH="/usr/lib/binutils/i686-pc-linux-gnu/2.16.1"
FAKE_TARGETS="i686-pc-linux-gnu"

보기 좋아보이는군요, 실제로 두 파일이 위치해 있습니다. 이제 gcc/ 디렉터리로 이동할 때입니다.

root #rm config-mips64-unknown-linux-gnu

Time to move on to the gcc/ directory.

root #cd /etc/env.d/gcc
# ls -la
total 12
-rw-r--r-- 1 root root  32 Sep  3 16:43 config
-rw-r--r-- 1 root root  32 Aug  3 14:25 config-i386-pc-linux-gnu
-rw-r--r-- 1 root root 292 Sep  3 16:43 i686-pc-linux-gnu-4.1.1
root #cat config
CURRENT=i686-pc-linux-gnu-4.1.1
root #cat config-i386-pc-linux-gnu
CURRENT=i386-pc-linux-gnu-4.1.1
root #cat i686-pc-linux-gnu-4.1.1
PATH="/usr/i686-pc-linux-gnu/gcc-bin/4.1.1"
ROOTPATH="/usr/i686-pc-linux-gnu/gcc-bin/4.1.1"
LDPATH="/usr/lib/gcc/i686-pc-linux-gnu/4.1.1"
GCCBITS="32"
MANPATH="/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man"
INFOPATH="/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info"
STDCXX_INCDIR="g++-v4"

configi686-pc-linux-gnu-4.1.1은 괜찮지만 제거해야 할 config-i386-pc-linux-gnu가 남아있습니다.

참고
다시 말해 오래된 GCC 버전 참조가 들어있는 파일 이름은 i686으로 바꾸더라도 config-i686-pc-linux-gnu 처럼 다를 수 있습니다. 이름 뿐만 아니라 파일의 내용을 확인하는 것도 중요합니다.
root #rm config-i386-pc-linux-gnu

이제 환경을 업데이트하려면 다음 명령을 실행하십시오:

root #env-update && source /etc/profile

모든 문제를 고쳤는지 확인하십시오:

값 바꾸기 끝내기

이제 sys-devel/libtool를 다시 이머지하고 /usr/share/gcc-data/$CHOST/<gcc-version>/에 있는 fix_libtool_files.sh를 실행해야 합니다. 올바른 gcc 버전을 사용중이며(현재 여기서는 4.1.1) 이전 아키텍처(i386)를 매개변수로 넘겼는지 확인하십시오. $CHOST 값을 새 CHOST 값으로 바꾸고 <gcc-version>를 현재 gcc 버전으로 바꾸십시오. 이 예제에서는 CHOST 값을 i686으로 설정했음을 가정합니다.

root #emerge --ask libtool

이제 모든 꾸러미를 다시 빌드할 수 있습니다:

root #emerge -e world

In theory, it should not be necessary to do so, but it cannot be 100% guaranteed that this is actually the case. Alternatively, it is possible to manually rebuild all the known problematic packages:

  • multilib packages using CHOST prefixing or header wrapping,
  • Perl, Python and other tools that store configured compiler path.
root #emerge --ask --oneshot /usr/bin/mips64-unknown-linux-gnu-* /usr/include/mips64-unknown-linux-gnu /usr/lib/llvm/*/bin/mips64-unknown-linux-gnu-* dev-lang/perl dev-lang/python

Note that paths that do not apply to the current system may need removing from the above invocation.

다시 컴파일 해야 할 패키지가 아직도 몇개 있다면 이 문서를 작성한 저자에게 토론 페이지en에서 알려주십시오.

일반적인 문제

Not so many anymore. Usually this just works, as long as no really exotic change is done. Make sure to not combine the CHOST change with other steps though. Some of the notes below are really old...

CHOST 값을 바꾼 후 GCC 3.3에서 4.1로 업그레이드 할 때(어쨌든 이렇게 하지 마십시오), 꽤 많은 사람이 sys-apps/groffmail-mta/courier같은 꾸러미가 깨져 다시 컴파일해야 한다고 보고했습니다:

코드 오류 메시지
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

이 일은 업그레이드 도중에 CHOST 값이 CTARGET과 일치하지 않고, 컴파일러가 크로스컴파일하는걸로 간주하기 때문에 일어나는 일입니다. 결과적으로 LDPATH 값을 ld.so.conf에 넣지 않아 이 오류가 나타납니다.

GCC 업그레이드 후 다시 빌드해야 할 꾸러미의 정보는 GCC 업그레이드 안내서를 참고하십시오.

어떤 드문 경우에는 오래된 버전의 파이선도 깰 수 있습니다. /usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.6(이전 CHOST 값에 따라 바꾸십시오)를 /etc/ld.so.conf 에 추가하고 ldconfig를 실행한 다음 emerge libstdc++-v3를 실행하면 문제를 해결할 수 있습니다. 그러나 보신 바와 같이 이 문제에 직면하는걸 제대로 막아야 합니다. CHOST 값과 GCC 버전을 동시에 바꾸지 마십시오.

피드백

피드백(동작할 경우든, 실패했거나, 다른 문제가 있다면)은 모두 환영하니 이 포럼 스레드en에 글을 남겨주십시오. 여기 안내서의 내용은 vapier가 알려주었습니다. 도움 감사합니다!


This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Wernfried Haas, Mike Frysinger (vapier) , Chris White
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.