Wednesday, October 19, 2011

Fix the dependency error for mozc under ubuntu 11.10

When build mozc revision 74 Debian package under ubuntu 11.10, got the dependency error for libibus-dev.

dpkg-checkbuilddeps: Unmet build dependencies: libibus-dev
dpkg-buildpackage: warning: Build dependencies/conflicts unsatisfied; aborting.
dpkg-buildpackage: warning: (Use -d flag to override.)
debuild: fatal error at line 1348:
dpkg-buildpackage -rfakeroot -D -us -uc -b failed

This is because there is no libibus-dev package now in ubuntu 11.10. Instead you need to install libibus-1.0-dev (sudo apt-get install libibus-1.0-dev) and change a little in following file.
Index: debian/control
===================================================================
--- debian/control (revision 74)
+++ debian/control (working copy)
@@ -2,7 +2,7 @@
Section: utils
Priority: extra
Maintainer: Yusuke Sato
-Build-Depends: debhelper (>= 4.0.0), libibus-dev, libcurl4-openssl-dev, pkg-config, libprotobuf-dev, protobuf-compiler, libgtest-dev, libqt4-dev, scim, libscim-dev, gyp, libzinnia-dev
+Build-Depends: debhelper (>= 4.0.0), libibus-1.0-dev, libcurl4-openssl-dev, pkg-config, libprotobuf-dev, protobuf-compiler, libgtest-dev, libqt4-dev, scim, libscim-dev, gyp, libzinnia-dev
Standards-Version: 3.6.2

Package: ibus-mozc

Resolve the Build Errors for Android 2.3.4 under 32-bit ubuntu 11.10

ERROR#1
Firstly need to enable to build android on a 32-bit system. Otherwise, you will see the following error message immediately when you start to build the source tree.
************************************************************
You are attempting to build on a 32-bit system.
Only 64-bit build environments are supported beyond froyo/2.2.
************************************************************
modify following files.
external/clearsilver/java-jni/Android.mk
external/clearsilver/util/Android.mk
external/clearsilver/cgi/Android.mk
external/clearsilver/cs/Android.mk
Find all lines of
LOCAL_CFLAGS += -m64
or
LOCAL_LDFLAGS += -m64
Change then with
LOCAL_CFLAGS += -m32
or
LOCAL_LDFLAGS += -m32

Need also change all lines in build/core/main.mk
ifneq (64,$(findstring 64,$(build_arch)))
to
ifneq (i686,$(findstring i686,$(build_arch)))
too.

ERROR#2
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

With file
frameworks/base/libs/utils/Android.mk
Change the line:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
To:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

ERROR#3
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors

make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

To fix this, refer to this patch.
https://github.com/CyanogenMod/android_build/commit/e9cbfa60c8dd60d04570d8bf7bd0d54a4304baf5
It will patch line 61 in core/combo/HOST_linux-x86.mk as following.
-HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0