Android.mk Ignore link errors

Source: Internet
Author: User

Local_allow_undefined_symbols: = True
A word can be done, but in the run may be an error, because the library file can not find the dependent files will be the errors.


Knowledge interpretation of dependent libraries under Linux
Linux compiles the dynamic link library so to avoid the run-time discovery of the function undefined symbol error (undefined symbol) LD parameters
LDD View Elf file dependent so dynamic link library can export Ld_library_path=/path set the path of so file,
Nm-u *.so or nm |grep u view those symbols in the dynamic link library.
The symbol of "U" is undefinedundefined, which is defined in other so dynamic link libraries. However, if you compile the so file, the default configuration will not prompt the error if the symbol is not in any external so file. Instead, the compilation passes. The symbol that I forgot to define is also in this undefined symbol, but the runtime is not successful.
The document says that this compile so dynamic link library cannot find the symbol (not in any external so file, its own program is not defined) also allowed to compile through for a reason, see the LD Man explanation--allow-shlib-undefined explanation (as if the English version is complete, The Chinese man LD is not complete and can view the webpage https://sourceware.org/binutils/docs-2.24/ld/Options.html#Options directly. is to let you link the use of a version of So, the runtime loaded with another version of So, you may load the so inside there is this symbol, so first let you find the symbol is also compiled through. If it is compiled EXE, this link when the definition of the symbol can not be found directly to you error. So dynamic link library will not error. In fact, this feature should be less useful, preferably in so link is encountered this is not found the symbol is also a good error.
So I think it's best to add--unresolved-symbols=ignore-in-shared-libs or--no-undefined to check when compiling a dynamic link library. If it is your own negligence in the. C source file inside the forgotten definition of a function, compile time can prompt error.
Here are 3 parameters that can use--undefined symbols and--no-allow-shlib-undefined parameters do not have the same scope,--undefined symbols for the regular object file,-- No-allow-shlib-undefined is intended for symbols that are inside an undefined shared object outside the definition. --unresolved-symbols and--undefined symbols have similar effects, but more specifically.
Our goal is mainly to compile a so dynamic link library, the object inside the undefined symbol of the report out, with--no-undefined and--unresolved-symbols= Ignore-in-shared-libs should be able to.
LD parameters, if directly with the GCC compiler, you can use-WL,--no-undefined this pass
Gcc-shared-wl,-soname,libb.so.1,--no-undefined-o libb.so.1.2 objectfile
Gcc-shared-wl,-soname,libb.so.1,--unresolved-symbols=ignore-in-shared-libs-o libb.so.1.2 objectfile

Android.mk Ignore link errors

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.