2011年5月9日 星期一

ubuntu 10.10 build android 出现 error: CSSParser.cpp:4219: undefined reference to `WebCore::CSSParser::lex()'

系统由ubunut9.10升级到10.10后,才出现这样的问题。原因是flex,生成的文件
out/target/product/messi/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/tokenizer.cpp
缺少了很多东西,具体可以以对比一下beagleboard-XM 平台rowboat的这个文件的代码。这个文件在froyo源代码里面是没有的,是在
编译的过程中,由“prebuilt/linux-x86/flex/flex-2.5.4a”根据
external/webkit/WebCore/css/tokenizer.flex
external/webkit/WebCore/css/maketokenizer
两个文件生成。

external/webkit/WebCore/css/maketokenizer
提到:
To regenerate, run flex on tokenizer.flex. After this, copy the
data tables and the YY_DECL method over to this file. Remove the
init code from YY_DECL and change the YY_END_OF_BUFFER to only call
yyterminate().

https://lists.webkit.org/pipermail/webkit-dev/2007-September/002418.html
提到
The function is generated from tokenizer.flex and ends up in
tokenizer.cpp, which CSSParser.cpp #include's. On the Mac build this
file is generated to WebKitBuild/Debug/DerivedSources/WebCore/
tokenizer.cpp. I'm not sure precisely where it would end up with the
Gdk build. If you're seeing a link error with this function missing
it would suggest that the file is not being generated correctly due to
an error in either flex or the WebCore/css/maketokenizer script which
post-processes the flex output.

解决方法:
out/target/product/messi/obj$ vi ./STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/tokenizer.cpp
out/target/product/messi/obj$ rm ./STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/tokenizer.cpp
out/target/product/messi/obj$ rm -rf ./STATIC_LIBRARIES/libwebcore_intermediates

prebuilt/linux-x86/flex$
prebuilt/linux-x86/flex$ mv flex-2.5.4a flex-2.5.4a.orig
external/webkit/WebKitTools/android/flex-2.5.4a$ ./configure
external/webkit/WebKitTools/android/flex-2.5.4a$ make
external/webkit/WebKitTools/android/flex-2.5.4a$ cp flex ../../../../../prebuilt/linux-x86/flex/flex-2.5.4a

////////////////////////////////////////////////////////////////////////////////////////
补充:因为我编译平台是ubuntu10.10 32bit的,所以得把flex拷贝到linux-x86,其它系统的话相应放到“darwin-x86 darwin-x86_64 linux-x86 linux-x86_64”等相应目录的flex里面。
////////////////////////////////////////////////////////////////////////////////////////

最后再查看文件
out/target/product/messi/obj$ vi ./STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/tokenizer.cpp
发现生成的tokenizer.cpp跟rowboat的一模一样,所以正常了,编译链接当然就通过了。

ref:
1. Issue 4485: CSSParser.cpp:4219: undefined reference to `WebCore::CSSParser::lex()'
http://code.google.com/p/android/issues/detail?id=4485
2. Regarding lex( ) function in WebKit
http://blog.gmane.org/gmane.os.opendarwin.webkit.devel/month=20070901
https://lists.webkit.org/pipermail/webkit-dev/2007-September/002418.html

标签:
ubuntu 10.10 10.04 WebCore build error CSSParser.cpp:4219: undefined reference to `WebCore::CSSParser::lex()' tokenizer.cpp maketokenizer flex-2.5.4a

沒有留言:

張貼留言