read

안드로이드 froyo 를 우분투 11.10 에서 빌드하다 보면 에러가 나는 것을 볼 수 있다. 각 에러별 해결책을 모아봤다.

Discards qualifiers [-fpermissive]

Error

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

Solution

frameworks/base 에 아래 patch 적용

diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk
index 7b51897..da0b9f1 100644
--- a/libs/utils/Android.mk
+++ b/libs/utils/Android.mk
@@ -54,7 +54,7 @@ LOCAL_SRC_FILES:= $(commonSources)

 LOCAL_MODULE:= libutils

-LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
+LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
 LOCAL_C_INCLUDES += external/zlib

 ifeq ($(HOST_OS),windows)

undefined reference ‘pthread_getspecific’

Error

out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_get':

/home/ksbae/mipsandroid/system/core/libcutils/threads.c:27: undefined reference to `pthread_getspecific'

out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_set':

/home/ksbae/mipsandroid/system/core/libcutils/threads.c:36: undefined reference to `pthread_key_create'

/home/ksbae/mipsandroid/system/core/libcutils/threads.c:44: undefined reference to `pthread_setspecific'

collect2: ld returned 1 exit status

Solution

frameworks/base 에 아래 patch 적용.

diff --git a/tools/aapt/Android.mk b/tools/aapt/Android.mk
index 2737438..961c76c 100644
--- a/tools/aapt/Android.mk
+++ b/tools/aapt/Android.mk
@@ -45,7 +45,7 @@ LOCAL_STATIC_LIBRARIES := 
 	libpng

 ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
+LOCAL_LDLIBS += -lrt -lpthread
 endif

 # Statically link libz for MinGW (Win SDK under Linux),
diff --git a/tools/localize/Android.mk b/tools/localize/Android.mk
index ab79f8d..f284e86 100644
--- a/tools/localize/Android.mk
+++ b/tools/localize/Android.mk
@@ -34,7 +34,7 @@ LOCAL_STATIC_LIBRARIES := 
 	libcutils

 ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
+LOCAL_LDLIBS += -lrt -lpthread
 endif

libgmp.so.3 Cannot open shared object file

Error

/home/ksbae/mipsandroid/prebuilt/linux-x86/toolchain/mips-4.4.3/bin/../libexec/gcc/mips-linux-gnu/4.4.3/cc1: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory

Solution

sudo apt-get install libgmp3c2

Blog Logo

Ki Sung Bae


Published

Image

Gsong's Blog

Developer + Entrepreneur = Entreveloper

Back to Overview