2009年12月5日 星期六

Recent code building break in Android Open Source Project

If you are using Mac OS X 10.5.8 Leopard like I do and you have synchronized the Android source code from the Android Open Source Project, you probably found that you will get a code building break message as the followings:


target SharedLib: libwebcore
(out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates/LINKED/libwebcore.so)
out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSParser.o:
In function `WebCore::CSSParser::lex(void*)':
external/webkit/WebCore/css/CSSParser.cpp:4219: undefined reference to `WebCore::CSSParser::lex()'

This is because the flex version in the Android source code is been upgraded to 2.5.4a and it causes some errors when trying to find the lex() function in CSSParser. To solve the problem, you can use MacPort 1.8 to install a flex verison then use that flex to replace the version in the Android source code. The commands would be:


cd prebuilt/darwin-x86/flex/
mv flex-2.5.4a flex-2.5.4a-OLD
ln -s /opt/local/bin/flex flex-2.5.4a
touch external/webkit/WebCore/css/tokenizer.flex

For more information, check this issue in the Android bug base.

So far I have successfully build my code on my 15.4" MacBook Pro. If you also meet the issue, you can give it a try.