Missing: vtable for _ cxxabiv1 ::__ si_class_type_info

Source: Internet
Author: User

In the Android system, when compiling the CPP program, the program Link encountered a similar error:

Missing: vtable for _ cxxabiv1 ::__ si_class_type_info

This error occurs because no-rtti can be compiled during the compilation process.

This problem can be solved.

 

The following content comes from: http://blog.csdn.net/vrix/archive/2009/06/23/4290671.aspx is a good summary.

Among all the android source code, only the top-level directory has a makefile. All other projects call this file for compilation. If you use "showcommands" to output detailed compilation information, you will see a large number of compilation options. In fact, you do not need to do so much. Do the following steps:

  • Copy all header files to the include directory of the toolchain to reduce the number of-I (header file search directory) options. For details, see: Native Android C Development: toolchain environment setup.

    ;
  • More Options View $ android_src/build/CORE/Combo/linux-arm.mk
    This is a compilation option file prepared for Android. Most projects rely on this file for compilation.
After completing the above two steps, the following are some compilation options I have compiled:
  • Compile a common C file. cflags is as follows:
Cflags =-O2-include androidconfig. hcflags + =-msoft-float-FPIC/-ffunction-sections/-funwind-tables/-fstack-Protector/-fno-short-enums
  • Compile a common CPP file. cxxflags is as follows (compared with cflags, only several bold options are added ):
Cflags =-O2-include androidconfig. hcflags + =-msoft-float-FPIC/-ffunction-sections/-funwind-tables/-fstack-Protector/-fno-short-enums/-fno-rtti/-fstrict- aliasing/-fno-exceptions/-fomit-frame-pointer
  • Executable program Link options (in addition to the following options, you also need to add the libraries required by the project, such as-LM and-lstdc ++ ):
Lib_dir =/cygdrive/e/toolchain/ARM-Eabi/libcrt_objs = $ (lib_dir)/crtbegin_dynamic.o $ (lib_dir)/crtend. O ldflags =-S-nostdlib-bdynamic/ldflags + =-wl,-T, armelf. x/-wl,-dynamic-linker,/system/bin/linker-wl, -- GC-sections/-wl,-Z, nocopyreloc/-LC $ (crt_objs)
  • Dynamic library link option (replace libtest. So with your library name during compilation, plus the library required by the project ):
Sdflags =-S-nostdlib/-wl,-soname, libtest. So
/-Wl,-shared,-bsymbolic/-wl,-T, armelf. xsc/-wl, -- GC-sections/-LC-LM

Basically, with these compilation options added, you can write your own makefile to compile the project. I have added these compilation options to successfully compile open-source projects such as SDL, JPEG, and LibPNG, for more compilation options, see $ android_src/build/CORE/Combo/linux-arm.mk
.

 

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.