Android4.0 compilation error set (1)

Source: Internet
Author: User
Tags valgrind

1. Android library 'xxx. so' not in prelink map error Solution
It may appear when compiling your Android library.
Library 'xxx. so' not in prelink map error,
This is caused by the Pre-compilation settings of Android, the/build/core/prelink-linux-arm.map file describes the pre-compilation Module


You need to modify the android. mk file in the folder
Add
LOCAL_PRELINK_MODULE: = false
Close the pre-compilation and you can pass it.


2. error 1: error: 'ptrdiff _ t' does not name a type
In file encoded ded from external/gtest/src/../include/gtest/gtest-param-test.h: 157: 0,
From external/gtest/src/../include/gtest. h: 69,
From external/gtest/src/gtest_main.cc: 32:
External/gtest/src/../include/gtest/internal/gtest-param-util.h: 122: 11: error: 'ptrdiff _ t' does not name a type
In file encoded ded from external/gtest/src/../include/gtest/gtest-param-test.h: 157: 0,
From external/gtest/src/../include/gtest. h: 69,
From external/gtest/src/../src/gtest. cc: 34,
From external/gtest/src/gtest-all.cc: 36:
External/gtest/src/../include/gtest/internal/gtest-param-util.h: 122: 11: error: 'ptrdiff _ t' does not name a type
In file encoded ded from external/gtest/src/gtest-all.cc: 38: 0:
Solution:
$ Vi external/gtest/src/../include/gtest/internal/gtest-param-util.h
# Include <cstddef>


3. Error 2: undefined reference to 'pthread _ mutexattr_destroy'
Host C ++: libgtest_host <= external/gtest/src/gtest-all.cc
True
Host C ++: libgtest_main_host <= external/gtest/src/gtest_main.cc
Out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport. a (Signals. o): In function 'printstacktrack ':
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Unix/Signals. inc: 219: undefined reference to 'dladd'
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Unix/Signals. inc: 231: undefined reference to 'dladd'
Out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport. a (Threading. o): In function 'llvm: llvm_execute_on_thread (void (*) (void *), void *, unsigned int )':
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Threading. cpp: 96: undefined reference to 'pthread _ create'
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Threading. cpp: 91: undefined reference to 'pthread _ attr_setstacksize'
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Threading. cpp: 100: undefined reference to 'pthread _ join'
Out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport. a (Mutex. o): In function 'muteximpl ':
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex. cpp: 69: undefined reference to 'pthread _ mutexattr_init'
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex. cpp: 75: undefined reference to 'pthread _ mutexattr_settype'
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex. cpp: 80: undefined reference to 'pthread _ mutexattr_setpshared'
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex. cpp: 89: undefined reference to 'pthread _ mutexattr_destroy'
Out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport. a (Mutex. o): In function 'llvm: sys: MutexImpl: tryacquire ()':
/Home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex. cpp: 143: undefined reference to 'pthread _ mutex_trylock'
Collect2: ld returned 1 exit status
Make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
Make: *** Waiting for unfinished jobs ....
Solution:
$ Vi external/llvm/llvm-host-build.mk
LOCAL_LDLIBS: =-lpthread-ldl


The following solution fails and a new error occurs: errors again: can't find threads. h file or dir.
$ Vi external/llvm/lib/Support/Android. mk
LOCAL_C_INCLUDES + = system/core/include/cutils
LOCAL_SHARED_LIBRARIES: = libcutil
$ Vi external/llvm/lib/Support/Mutex. cpp
# Include <threads. h>
$ Vi external/llvm/lib/Support/Threading. cpp
# Include <threads. h>


4. error 3: error: variable 'paramname' set but not used [-Werror = unused-but-set-variable]
Frameworks/compile/slang/slang_rs_export_foreach.cpp: 247: 23: error: variable 'paramname' set but not used [-Werror = unused-but-set-variable]
Cc1plus: all warnings being treated as errors
Solution:
$ Vi frameworks/compile/slang/Android. mk
# Local_cflags_for_slang: =-Wno-sign-promo-Wall-Wno-unused-parameter-Werror
Local_cflags_for_slang: =-Wno-sign-promo-Wall-Wno-unused-parameter


5. JDK1.6 is used for systems above 2.3. Therefore, you must download and set the compiling environment.
Vi ~ /. Bashrc


Export JAVA_HOME =/usr/java/jdk1.6.0 _ 23
Export JRE_HOME = $ JAVA_HOME/jre
Export CLASSPATH =.: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH
Export PATH = $ PATH: $ JAVA_HOME/bin/tools. jar: $ JRE_HOME/bin
Export ANDROID_JAVA_HOME = $ JAVA_HOME


6. Exception in thread "main" java. lang. OutOfMemoryError: Java heap space
Solution:
Insufficient memory


7. external/jsilver/src/com/google/streamhtmlparser/util/JavascriptTokenBuffer. java: 80: cannot find symbol
Symbol: method copyOf (char [], int)
Solution:
Upgrade sdk from 1.5 to 1.6


8. arm-eabi-4.4.3 version 'glibc _ 100' not found
Solution
Prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc-mthumb-interwork-Ibionic/libc/private-o out/target/product/generic/obj/lib/crtbegin_dynamic.o -c bionic/libc/arch-arm/bionic/crtbegin_dynamic.S
Prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc:/lib/tls/i686/cmov/libc. so.6: version 'glibc _ 100' not found (required by prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc)
Make: *** [out/target/product/generic/obj/lib/crtbegin_dynamic.o] Error 1


This is a problem with the arm-eabi-4.4.3 version caused by compilation on 32-bit Ubuntu, so you need to modify the arm-eabi-4.4.0:
$ Mv arm-eabi-4.4.3 to arm-eabi-4.4.3.old
$ Ln-s arm-eabi-4.4.0 arm-eabi-4.4.3


Or:
Upgrade glibc or System


9,
PassFailButtons. java: 191: onCreateDialog (int, android. OS. bundle) in android. app. activity cannot implement onCreateDialog (int, android. OS. bundle) in com. android. cts. verifier. passFailButtons. passFailActivity; attempting to assign weaker access privileges;
Solution:
Probably because openjdk is used, not the sun-java6-jdk,

 


10,
Undefined reference to _ asprintf_chk
Solution:
Compilation errors may occur due to stdio2.h. The correct stdio2.h is. /prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/bits/stdio2.h file, Please reset PATH environment variable, set. /prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr put at the beginning of the PATH.
Cp./prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/lib/libbfd. a./out/host/linux-
X86/obj/STATIC_LIBRARIES/libbfd_intermediates/libbfd.
The glibc version may not be the latest.


11,
SDL init failure, reason is: No available video device.
Solution:
The reason is that he depends on X11 and can run it on the graphical interface.


12,
In file sorted ded from frameworks/base/include/utils/Vector. h: 26,
From frameworks/base/include/utils/SortedVector. h: 24,
From frameworks/base/include/utils/KeyedVector. h: 24,
From frameworks/base/include/media/AudioParameter. h: 21,
From frameworks/base/media/libmedia/AudioParameter. cpp: 22:
Frameworks/base/include/utils/TypeHelpers. h: 33: error: template with C linkage
Solution:
Change transform-cpp-to-o-isystem in the definitionss. mk file to-I. If-isystem exists, it seems like the specified directory.
Will be treated as a standard system library directory
A similar problem occurs later. simply change all-isystem in this file to-I.


13,
External/icu4c/common/rbbi. cpp: 295: error: cannot use typeid with-fno-rtti
External/icu4c/common/rbbi. cpp: 295: error: cannot use typeid with-fno-rtti
Solution:
Remove the-fno-rtti \ line from define transform-cpp-to-o in the definitionss. mk file.


16,
Abi/cpp/include/cxxabi. h: 44: error: invalid use of incomplete type 'struct std: type_info'
<Built-in>: 0: error: forward declaration of 'struct std: type_info'
Abi/cpp/include/cxxabi. h: 51: error: invalid use of incomplete type 'struct std: type_info'
<Built-in>: 0: error: forward declaration of 'struct std: type_info'
Abi/cpp/include/cxxabi. h: 58: error: invalid use of incomplete type 'struct std: type_info'
<Built-in>: 0: error: forward declaration of 'struct std: type_info'
Abi/cpp/include/cxxabi. h: 65: error: invalid use of incomplete type 'struct std: type_info'
<Built-in>: 0: error: forward declaration of 'struct std: type_info'
Abi/cpp/include/cxxabi. h: 72: error: invalid use of incomplete type 'struct std: type_info'
<Built-in>: 0: error: forward declaration of 'struct std: type_info'
Solution:
4.0 has more abi directories than the 2.3 root directory, which contains only a few files. type_info is defined in the typeinfo file under this directory,
Cxxabi. h also contains this file, but I do not know why the error is reported. It is not possible to add class type_info in cxxabi. h,
Later, the typeinfo file and the definition in cxxabi. h were extracted and defined into a common. h file. Both files contain this file, which is temporarily avoided.


14,
Ake: Go to the '/home/lijj/android-4.0.1' directory'
Target thumb C ++: binderAddInts <= system/extras/tests/binder/benchmarks/binderAddInts. cpp
System/extras/tests/binder/benchmarks/binderAddInts. cpp: 96: error: iso c ++ forbids declaration of 'cpu _ set_t 'with no type
System/extras/tests/binder/benchmarks/binderAddInts. cpp: 96: error: expected ',' or '... 'before' & 'token
System/extras/tests/binder/benchmarks/binderAddInts. cpp: In function 'int main (int, char **)':
Solution:
Add at the beginning of the binderAddInts. cpp File
# Ifndef _ GNU_SOURCE
# Define _ GNU_SOURCE
# Endif
And include the header file # include <sched. h>


15,
Prebuilt/linux-x86/toolchain/arm-eabi-4.4.0_hisi/bin/arm-eabi-gcc-mthumb-interwork-Ibionic/libc/private-DCRT_LEGACY_WORKAROUND-Ibionic/libc/private-o out/target/product /generic/obj/lib/crtbegin_so.o-c bionic/libc/arch-arm/bionic/crtbegin_so.S
Prebuilt/linux-x86/toolchain/arm-eabi-4.4.0_hisi/bin/arm-eabi-gcc-mthumb-interwork-Ibionic/libc/private-DCRT_LEGACY_WORKAROUND-Ibionic/libc/private-o out/target/product /generic/obj/lib/crtend_so.o-c bionic/libc/arch-arm/bionic/crtend_so.S
Target SharedLib: libdl (out/target/product/generic/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl. so)
/Home/lijj/android-4.0.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0_hisi/bin /.. /lib/gcc/arm-eabi/4.4.0 /.. /.. /.. /.. /arm-eabi/bin/ld: unrecognized option '-- icf = safe'
/Home/lijj/android-4.0.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0_hisi/bin /.. /lib/gcc/arm-eabi/4.4.0 /.. /.. /.. /.. /arm-eabi/bin/ld: use the -- help option for usage information
Collect2: ld returned 1 exit status
Solution:
Modify the value assigned to TARGET_GLOBAL_LDFLAGS by row P134 in the TARGET_linux-arm.mk, remove -- icf = safe


16,
In file encoded ded from frameworks/base/media/libstagefright/AACWriter. cpp: 21:
Frameworks/base/include/media/stagefright/AACWriter. h: 70: error: iso c ++ forbids declaration of 'disallow _ EVIL_CONSTRUCTORS 'with no type
Make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libstagefright_intermediates/AACWriter. o] Error 1
Solution:
Add the include header file # include <media/stagefright/foundation/ABase. h>


17,
In file encoded ded from frameworks/base/media/libstagefright/SurfaceMediaSource. cpp: 19:
Frameworks/base/include/media/stagefright/SurfaceMediaSource. h: 363: error: iso c ++ forbids declaration of 'disallow _ IMPLICIT_CONSTRUCTORS 'with no type
Frameworks/base/include/media/stagefright/SurfaceMediaSource. h: In member function 'virtual android: status_t android: SurfaceMediaSource: setScalingMode (int )':
Frameworks/base/include/media/stagefright/SurfaceMediaSource. h: 114: error: no return statement in function returning non-void
Make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libstagefright_intermediates/SurfaceMediaSource. o] Error 1
Make: *** waiting for unfinished task ....
Solution:
Change DISALLOW_IMPLICIT_CONSTRUCTORS to SurfaceMediaSource ();
The macro is used to define the constructor. The definition of the macro is not found in the frameworks directory, and only the macro is used in this place.
The external directory has the macro definition.


18,
In file encoded ded from frameworks/base/media/libstagefright/SurfaceMediaSource. cpp: 19:
Frameworks/base/include/media/stagefright/SurfaceMediaSource. h: In member function 'virtual android: status_t android: SurfaceMediaSource: setScalingMode (int )':
Frameworks/base/include/media/stagefright/SurfaceMediaSource. h: 114: error: no return statement in function returning non-void
Make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libstagefright_intermediates/SurfaceMediaSource. o] Error 1
Make: *** waiting for unfinished task ....
Solution:
SetScalingMode function add return OK;


19,
External/ipsec-tools/src/racoon/isakmp. c: In function 'isakmp _ handler ':
External/ipsec-tools/src/racoon/isakmp. c: 214: error: field 'IP' has incomplete type
External/ipsec-tools/src/racoon/isakmp. c: 230: warning: pointer targets in passing argument 6 of 'recvfromto 'differ in signedness
External/ipsec-tools/src/racoon/sockmisc. h: 68: note: expected 'len Len _ t * 'but argument is of type 'unsigned int *'
Solution:
Add isakmp. c in Section 2.3
# Ifdef ANDROID_CHANGES
# Define _ linux
# Endif
There have been a lot of changes in this file 2.3 and 4.0. I don't know if there will be any problems with this change.


20,
Target arm C: libwebrtc_aecm <= external/webrtc/src/modules/audio_processing/aecm/main/source/aecm_core.c
/Tmp/ccyInhhH. s: Er er messages:
/Tmp/ccyInhhH. s: 3864: Error: co-processor offset out of range
/Tmp/ccyInhhH. s: 3865: Error: co-processor offset out of range
Solution:
Compare 2.3 to modify TARGET_linux-arm.mk-related compilation options

 


21,
/Home/lijj/android-4.0.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0_hisi/bin /.. /lib/gcc/arm-eabi/4.4.0 /.. /.. /.. /.. /arm-eabi/bin/ld: unrecognized option '-- icf = none'
/Home/lijj/android-4.0.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0_hisi/bin /.. /lib/gcc/arm-eabi/4.4.0 /.. /.. /.. /.. /arm-eabi/bin/ld: use the -- help option for usage information
Collect2: ld returned 1 exit status
Make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libdynamic_annotations_intermediates/LINKED/libdynamic_annotations.so] Error 1
Make: *** waiting for unfinished task ....
Solution:
Remove the following files -- icf = none
/External/valgrind/dynamic_annotations/Android. mk: 27: LOCAL_LDFLAGS + =-Wl, -- icf = none
./External/valgrind/tsan/Android. mk: 49: preload_ldflags + =-Wl, -- icf = none
./External/valgrind/main/Android. mk: 52: preload_ldflags + =-Wl, -- icf = none


22,
Frameworks/base/native/include/android/native_1_h: 36: error: redefinition of typedef 'anativewindow'
System/core/include/system/window. h: 429: note: previous declaration of 'anativewindow' was here
Make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libEGL_VIVANTE_intermediates/driver/openGL/egl/OS/gc_egl_linux.o] Error 1
Make: *** waiting for unfinished task ....
Solution:
Android_natives.h contains two header files.
# Include <system/window. h> www.2cto.com
# Include <android/native_1_1_h>

Both header files define ANativeWindow and remove the following header file.

 


 


Author: andyhuabing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.