Debug the code compilation errors of C ++ using binder for communication between two processes, and record them for reference:
1. BpBInder client functions are not defined, as shown in figure
Target SharedLib: libgui (out/target/product/generic/obj/SHARED_LIBRARIES/libgui_intermediates/LINKED/libgui. so)
Out/target/product/generic/obj/SHARED_LIBRARIES/libgui_intermediates/IPlayerServer. o :(. data. rel. ro. _ blank [vtable for android: BnInterface <android: IPlayerServer>] + 0x20): undefined reference to 'android: IPlayerServer: handleToPlayerid (int, int )'
Class IPlayerServer: public IInterface
{
Public:
DECLARE_META_INTERFACE (PlayerServer );
Virtual Vector <Player> getPlayerList () = 0;
Virtual int handleToPlayerid (int type, int handle );
};
This is because the virtual function definition has no default implementation problem.
Change it to this.
Virtual int handleToPlayerid (int type, int handle) = 0;
2. No Flattenable interface is defined on BpBinder.
Target thumb C ++: libgui <= frameworks/base/libs/gui/Player. cpp
Frameworks/base/libs/gui/Player. cpp: 63: error: no 'size _ t android: Player: getFlattenedSize () const 'Member function declared in class' android: player'
Frameworks/base/libs/gui/Player. cpp: 72: error: no 'size _ t android: Player: getFdCount () const 'Member function declared in class 'android: player'
Added:
// Flattenable interface
Virtual size_t getFlattenedSize () const;
Virtual size_t getFdCount () const;
Virtual status_t flatten (void * buffer, size_t size,
Int fds [], size_t count) const;
Virtual status_t unflatten (void const * buffer, size_t size,
Int fds [], size_t count );
And implement it.
3. Problems Caused by class RefBase not inherited
Frameworks/base/include/utils/RefBase. h: 331: error: 'class android: PlayerDevice 'has no member named' decStrong'
Frameworks/base/include/utils/RefBase. h: In member function 'android: sp <T> & android: sp <T>: operator = (T *) [with T = android: PlayerDevice] ':
Frameworks/base/services/multiplayerservice/MultiplayerService. cpp: 55: instantiated from here
Frameworks/base/include/utils/RefBase. h: 346: error: 'class android: PlayerDevice 'has no member named'
Frameworks/base/include/utils/RefBase. h: 347: error: 'class android: PlayerDevice 'has no member named' decStrong'
Just add the RefBase class.
Class PlayerDevice:
Public Singleton <PlayerDevice>,
Public RefBase
{
4. assembly code problems (assemble. h is used in linear_src.c)
/Tmp/ccVb1LeR. s: Assembler messages:
/Tmp/ccVb1LeR. s: 476: Error: selected processor does not support 'smull r6, r1, r3, r1'
The answer is:
ALWAYS_BUILD_AS_ARM
Placed in the first line of mmp, you can avoid compilation errors caused by the thumb instruction set when compiling Embedded arm Assembly codes in various SDK versions.
Symptoms:
Gcce Compiler
Error: selected processor does not support 'smull r0, r3, r6, r3 ′
The
Inline aggreger not permitted when generating Thumb code
_ Asm {
...
}
Since assembly. h is defined as inline and an error is reported after the code macro is replaced, you can find the following methods in the gcc make compilation options:
Add
LOCAL_CFLAGS + =-mno-thumb-interwork-mno-thumb-marm
5. android_native_window_t Structure Change of android2.3
Typedef struct ANativeWindow android_native_window_t;
So struct android_native_window_t --> android_native_window_t can be changed.
While 2.2 does not define the ANativeWindow Structure
6. Add the following statement
Ifdef FIXED_ARCH_TYPE
$ (Call add-prebuilt-files, STATIC_LIBRARIES, $ (GC_GLESv2SC_DIR)/preprocessor/$ (FIXED_ARCH_TYPE)/libglslPreprocessor.)
$ (Call add-prebuilt-files, STATIC_LIBRARIES, $ (GC_GLESv2SC_DIR)/compiler/$ (FIXED_ARCH_TYPE)/libglslCompiler.)
$ (Call add-prebuilt-files, STATIC_LIBRARIES, $ (GC_GLESv2SC_DIR)/entry/$ (FIXED_ARCH_TYPE)/libGLESv2SC.)
Endif
The LOCAL_MODULE_TAGS definition cannot be found in the compilation report. solution:
Add-prebuilt-files is defined under build/core/definitions. mk and added to the include-prebuilt definition.
Define include-prebuilt
Include $ (CLEAR_VARS)
...
LOCAL_MODULE_TAGS: = eng (add this sentence)
Include $ (BUILD_PREBUILT)
Endef
Andyhuabing Column