Cross Compile 시 --host 와 --target 에 대해서

macros의 이미지

기존엔 build 옵션과 host 옵션이 크로스컴파일 하는 환경을 묻는거라 생각하고 같은 값을 주곤하였는데

If you want to _use_ a cross compiler, that generates code for a 
platform different from the build platform, you should specify the 
"host" platform (i.e., that on which the generated programs will 
eventually be run) with `--host=TYPE'.

이 글을 보니 의미가 다소 헷갈리기 시작합니다.
host 옵션은 결국 아웃풋으로 나온 바이너리를 최종 실행 시킬곳의 플랫폼인가요?
그렇다면 보통은 target 옵션과 같아야 하는건가요?

답변 주신분들 미리 감사 드립니다.

ganadist의 이미지

autoconf 매뉴얼에 다음과 같이 정의 되어 있습니다.

--build=build-type
    the type of system on which the package is being configured and compiled (rarely needed); 
--host=host-type
    the type of system on which the package will run; 
--target=target-type
    the type of system for which any compiler tools in the package will produce code.

쉽게 이야기 해서..

build는 현재 플랫폼, host는 설치될 플랫폼, target은 실행될 플랫폼으로 설정하시면 됩니다.

툴체인 같은 경우에는 build와 host가 같은 값이고,
크로스컴파일은 host와 target이 같은 값이면 됩니다.

----
데스크탑 프로그래머를 꿈꾸는 임베디드 삽질러

ganadist의 이미지

젠투 glibc 의 ebuild에 다음과 같은 주석이 달려있습니다. 참조하시기 바랍니다.

  CBUILD = CHOST = CTARGET    - native build/install
  CBUILD != (CHOST = CTARGET) - cross-compile a native build
  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler

----
데스크탑 프로그래머를 꿈꾸는 임베디드 삽질러

macros의 이미지

네 답변 감사합니다.

그렇다면 실제 build, host, target 이런 옵션 값에는 어느곳을 참조하고 값을 줘야하는지요
딱딱 정해진 타입값들이 있는지요
아니면INSTALL 이나 README 파일등을 참조해서 원하는 타입 값을 넣어줘야 하는지요

ganadist의 이미지

보통 다음과 같은 값이 들어갑니다.

${arch}-${vendor}-${kernel}-${platform}

여기서 vendor와 platform은 종종 생략합니다.

레드햇의 경우는 다음과 같습니다.
i386-redhat-linux

젠투는 다음과 같습니다.
i686-pc-linux-gnu

제 시스템에 깔려있는 powerpc용 qnx 툴체인은 다음과 같습니다.
powerpc-unknown-nto-qnx6.3.0

그리고 또한 제 시스템에 깔려있는 arm7용 툴체인은 이렇게 되어있습니다
arm-linux

아이북에는 다음과 같이 되어있습니다.
powerpc-apple-darwin8
i686-apple-darwin8

cygwin은 이렇게 되어있네요.
i686-pc-cygwin

이정도의 예를 들면 감이 잡히실려나요?

----
데스크탑 프로그래머를 꿈꾸는 임베디드 삽질러

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.