ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Google Android Build 해 보기 #2
    기술 관련/Android 2009. 2. 28. 23:16
    지난 글은 환경 설정 및 make를 실행하기 까지의 내용이었고, 이번에는 Build 할 때 발생한 사항에 대한 내용을 적어본다.

    다른 사람들은 잘 된다고 하는데 내 경우는 make를 실행하고 나서 다음과 같은 에러를 출력했다.
    host C++: aapt <= frameworks/base/tools/aapt/XMLNode.cpp
    frameworks/base/tools/aapt/XMLNode.cpp: In function `status_t parseStyledString(Bundle*, const char*, android::ResXMLTree*, const android::String16&, android::String16*, android::Vector<StringPool::entry_style_span>*, bool)':
    frameworks/base/tools/aapt/XMLNode.cpp:128: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:138: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:145: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:180: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:189: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:206: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:234: error: syntax error before `,' token
    frameworks/base/tools/aapt/XMLNode.cpp:242: error: syntax error before `,' token
    make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/XMLNode.o] Error 1

    XMLNode.cpp의 128라인의 코드를 살펴보니 다음과 같았는데 별 이상한 점은 없었다.
    {
        SourcePos(String8(fileName), inXml->getLineNumber()).error(
            "Found unsupported XLIFF tag <%s>\n",
            element8.string());
        return UNKNOWN_ERROR;
    }

    다른 에러가 발생하는 line을 보니 SoucePos와 String8이 공통으로 들어간 모양으로 위의 128 라인의 구조와 다들 비슷한 형태였다. 혹시나 하는 마음에 Google에서 search를 했는데 나와 똑같은 에러가 나온다는 newsgroup thread를 보게 되었다. 글을 읽다보니 SourcePos의 첫 번째 인자인 String8(fileName)을 compiler가 인식하지 못하고 에러를 낸다는 것이었다.

    결국은 컴파일러 문제라는 건데 지금 내가 사용하는 gcc version은 4.3인데 이는 3.x 버젼에서도 이런 증상은 동일하게 나타났다. 왜 안되는지에 대한 원인은 찾지 못했지만 위의 코드를 다음과 같이 수정하면 에러가 나지 않는 것은 확인했다.

    {
        String8 fileNameString = String8(fileName);
        SourcePos(fileNameString, inXml->getLineNumber()).error(
            "Found unsupported XLIFF tag <%s>\n",
            element8.string());
        return UNKNOWN_ERROR;
    }

    위의 파일에서 코드를 전부 고치고 나면 이후로는 컴파일이 잘 진행되고 최종 console에 다음과 같이 출력되는 것을 볼 수 있다.

    Install: out/target/product/generic/system/xbin/sqlite3
    Notice file: external/dropbear/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/xbin/ssh.txt
    Install: out/target/product/generic/system/xbin/ssh
    Install: out/target/product/generic/system/xbin/strace
    Notice file: system/extras/su/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/xbin/su.txt
    Install: out/target/product/generic/system/xbin/su
    Install: out/target/product/generic/system/xbin/timeinfo
    Copy: out/target/product/generic/system/etc/apns-conf.xml
    Copying: out/target/product/generic/obj/NOTICE_FILES/src/kernel.txt
    Finding NOTICE files: out/target/product/generic/obj/NOTICE_FILES/hash-timestamp
    Combining NOTICE files: out/target/product/generic/obj/NOTICE.html
    gzip -c out/target/product/generic/obj/NOTICE.html > out/target/product/generic/obj/NOTICE.html.gz
    zip -qj out/target/product/generic/system/etc/security/otacerts.zip build/target/product/security/testkey.x509.pem
    Generated: (out/target/product/generic/android-info.txt)
    Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_unopt_intermediates/system.img
    Install system fs image: out/target/product/generic/system.img
    Target ram disk: out/target/product/generic/ramdisk.img
    Target userdata fs image: out/target/product/generic/userdata.img
    mc500@jshong-vb:~/disk3/android/mydroid$

    댓글

Designed by Tistory.