您的位置:首页 > 移动开发 > Android开发

Android compiler source code and common errors and Solutions

2016-06-09 20:46 691 查看
http://www.programering.com/a/MzNxAjNwATU.html

Recently to the arm development board Android transplant system, greatly small problems are too many, is the tears. I first contact embedded
development, the root of the problem is not much, but each solve a problem, then recorded.
The word does not say more, the official listing problems:

1 host Executable: a3dconvert (out/host/linux-x86/obj/EXECUTABLES/a3dconvert_intermediates/a3dconvert)
2 /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libstdc++.so when searching for -lstdc++
3 /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libstdc++.a when searching for -lstdc++
4 /usr/bin/ld: cannot find -lstdc++
5 /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libgcc_s.so when searching for -lgcc_s
6 /usr/bin/ld: cannot find -lgcc_s
7 /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libgcc.a when searching for -lgcc
8 /usr/bin/ld: cannot find -lgcc
9 collect2: ld returned 1 exit status
10 make: *** [out/host/linux-x86/obj/EXECUTABLES/a3dconvert_intermediates/a3dconvert] Error


Solution: 
The lack of g++-multilib library, can be installed:
apt-get install g++-multilib
$ sudo apt-get install g++-multilib g++-4.5-multilib

1 g++: Error: – fpermissive: not that file or directory
2 make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

Solution: 
sudo apt-get install g++-4.4-multilib

1 rameworks/base/libs/utils/RefBase.cpp: In a member function‘void android::RefBase::weakref_type::trackMe(bool, bool)’In the:
2 frameworks/base/libs/utils/RefBase.cpp:483:67: Error: ‘ const android:: RefBase:: weakref_impl’ as‘void android::RefBase::weakref_impl::trackMe(bool, bool)’‘ this’ argument discarded type qualifier [-fpermissive]
3 make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

Reason: 
The Ubuntu 11.10 version of
GCC 4.6 is too high, the
Android compiler requires GCC 4.4
Solution: 
The replacement of
GCC, g++ version 4.6 is 4.4
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
sudo rm -rf /usr/bin/gcc /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

1 /usr/bin/ld: cannot find -lz
2 host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
3 /usr/bin/ld: cannot find -lz
4 collect2: ld returned 1 exit status
5 make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1

Solution: 
sudo apt-get install zlib1g-dev
sudo apt-get install lib64z1-dev

1 /bin/bash: bison: command not found
2 Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
3 bison -d  -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
4 /bin/bash: bison: command not found
5 make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127

Solution: 
sudo apt-get install bison

1 /bin/bash: flex: command not found
2 out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp: In function ‘int yyparse()’:
3 out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1827: warning: deprecated conversion from string constant to ‘char*’
4 out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1970: warning: deprecated conversion from string constant to ‘char*’
5 Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
6 /bin/bash: flex: command not found
7 make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

Solution: 
sudo apt-get install flex

1 /usr/bin/ld: cannot find -lncurses
2 host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)
3 /usr/bin/ld: cannot find -lncurses
4 collect2: ld returned 1 exit status
5 make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

Solution: 
sudo apt-get install libncurses5-dev

1 fatal error: GL/glx.h: No such file or directory
2 development/tools/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp:22: fatal error: GL/glx.h: No such file or directory
3 compilation terminated.
4 make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon_intermediates/GLDispatch.o] Error

Solution: 
sudo apt-get install libgl1-mesa-dev

1 sh: gperf: not found
2 target Generated: libwebcore <= external/webkit/Source/JavaScriptCore/create_regex_tables
3 Generating CSSPropertyNames.h <= CSSPropertyNames.in
4 sh: gperf: not found
5 calling gperf failed: 32512 at ./makeprop.pl line 140.
6 make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error 25
7 make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h'


Solution: 
sudo apt-get install gperf

1 host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
2 frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
3 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]
4 make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

Solution: 
gedit frameworks/base/libs/utils/Android.mk
The
statement:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
Amended as:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive

1 out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_get':
2 /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:27: undefined reference to `pthread_getspecific'
3 out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_set':
4 /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:36: undefined reference to `pthread_key_create'
5 /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:44: undefined reference to `pthread_setspecific'
6 collect2: ld returned 1 exit status
7 make: *** [out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize] Error 1

Solution: 
Modify the./framework/base/tools/localize/Android.mk file
ifeq ($(HOST_OS),linux)
#LOCAL_LDLIBS + = -lrt put the line commented out, to the following line. 
LOCAL_LDLIBS += -lrt -lpthread
endif
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: