linux cross compile

bluesolip의 이미지

안녕하세요.

cygwin으로 cross compile을 통해 cortex-a8에서 동작하는 실행파일을 만들려고 합니다.
toolchain은 arm-none-eabi- 를 사용하고 있습니다.
간단한 hello world 문을 출력(main.c)하는 실행파일을 만들려고 합니다.
arm-none-eabi-gcc로 compile하고 나서 어떻게 해야 실행 파일을 만들 수 있는지요?

컴파일은 다음과 같이 해서 오브젝트 파일을 만들었습니다.
$ arm-none-eabi-gcc -c -mcpu=cortex-a8 -g main.c -o main.o

linux는 초보라 계속 이부분에서 막혀있어 답답합니다.
고수님들의 도움 부탁드립니다.

klenui의 이미지

크로스 컴파일러에 딸린 링커로 링킹하면 되지 않나요?

bluesolip의 이미지

초보라 링킹방법을 모르겠어요..도움 부탁드려요.

익명 사용자의 이미지

arm-none-eabi-gcc -o main main.c 하면 안되나요?

bluesolip의 이미지

예..그렇게 해서 target에서 실행해 보려고 하면 다음과 같은 에러가 나면서 실행이 안되네요.

arm syntax error: unexpected word (expecting ")")

host는 window7이라 cygwin64(setup-x86_64.exe)로 설치했는데 이게 문제가 되려는지요?
이것 저것 해봐도 target에 올리면 위와 같이 에러가 발생하는데 어찌해야 할지 모르겠습니다.
gcc를 arm-linux-androideabi-gcc으로 변경해서도 해봤는데 동일합니다.

익명 사용자의 이미지

그건 컴파일할때 오류 아닌가요?

bluesolip의 이미지

컴파일은 정상적으로 되었구요..그냥 gcc로 컴파일해서 cygwin에서 실행하면 잘 동작합니다.
arm용으로 cross compile하면 정상적으로 실행파일이 만들어 지는데..target에 넣고 실행을 하면 위와같은 에러가 발생하면서 실행이 안됩니다.
그래서 도움 요청드리는 거에요~

klenui의 이미지

한마디로 링킹 결과로 나온 재배치가능 파일(elf나 dwarf)를 target os가 인식못한다는 뜻..같은데요.. 정확한건 봐야 알겠습니다만...
크로스 컴파일 결과로 나온 파일의 정체가 뭔지 objdump 같은 걸로 확인해 보시고.. target os가 리눅스일텐데.. 커널 컴파일 될때 해당 포맷을 지원하도록 설정하였는지 확인해보셔야 할 것 같습니다.
보지 않고 하는 말이라 정확하지는 않습니다만.

bluesolip의 이미지

objdump 결과 file format elf32-little 로 나왔습니다.
혹시 이게 잘못 생성해서 그런건가요??

추가로 arm target시 compile 옵션으로 무엇무엇 주어야 하는지 어떻게 주어야 하는지요?
참고로 hello.c같은 단순한 파일하나 컴파일해서 target에서 실행하는 것입니다.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.