Home > Back-end >  Opencv use arm - himix200 - Linux - g cross-compilation, after moving to the development board, the
Opencv use arm - himix200 - Linux - g cross-compilation, after moving to the development board, the

Time:09-22

Opencv use arm - himix200 - Linux - g + + cross-compilation passed, moved to the haisi Hi3516dv300 development board, and the application to compile the connection is successful, the runtime relocation mistakes,
As follows:
~/MNT/app/SRC #./people
./people: relocation error:/usr/lib/libopencv_core. So. 4.5: symbol _ZNSt15__exception_ptr13exception_ptrC1Ev, version CXXABI_1. 3.11 not defined in the file libstdc++. So. 6 with link time reference

What a great god can solve,

CodePudding user response:

Is expected to be cut

CodePudding user response:

Tailoring opencv?

CodePudding user response:

Learn to use the objdump?

Name Mangling in c + +
Categories: C/C + + 11 2012-05-20 517 people read reviews (0) report collection
Basic compiler stringinitializationfloatcompiler abstract: this paper introduces the c + + Name Mangling the principle and the realization of the corresponding in the GCC, through the program code and nm + + filt waste and other tools to verify these principles, the details about the program links process has certain help,
Name Mangling overview
Is constructed from the large programs by multiple modules, module by a makefile to describe the relationship between, for large program compiled by c + + language, is also conform to the rules,
Application of the build process is commonly: each source file is compiled respectively, form the target file, multiple targets by the linker to form the final executable file, obviously, to some extent, the compiler output is the input link editor, the linker to the output of the compiler do the secondary processing, from the perspective of communication, the two application needs certain agreement to standard symbols of organizing format, this is the fundamental cause of Name Mangling,
C + + language features more rich than C, C + + support function overloading function is the most direct example of need Name Mangling technology, for function overloading, cannot only depend on the Name of the function to distinguish between different functions, because the distinction between overloaded functions in C + + is built on the following rules:
Different function name | | parameter number different | | a parameter types are different
Then distinguish function, should give full consideration to the number of arguments and parameter types both semantic information, such ability for dividing a different function to ensure adequacy,
C + +, of course, there are many other places need Name Mangling, such as the namespace, class, template, etc.,
Generally speaking, the Name Mangling is a specification that are used for communication between the compiler and linker symbol table of the representation agreement, its purpose lies in according to the program language specification, make the symbols have enough semantic information to ensure accurate link process,
Simple experiment
Name Mangling will bring the negative effect of a very common, is the C language program called C + + program, will be more difficult, because the C language of the Name Mangling is very simple, as C + + is so complex that the following code are used to demonstrate the two difference:

/*
1.C
2. * simple_test.3. * a demo to show that the company name mangling technology in C + + and C
4.
5. * the Author: Chaos Lee
6.
7. */
8.
9. # include
10.
11. Int rect_area (int x1, int x2, int y1, int y2)
12.
13. {
14. The return (x2 - x1) * (y2 - y1);
15.}
16.
17. Int elipse_area (int a, int b)
18.
19. {
20. Return 3.14 * a * b;
21.}
22.
23. Int main (int arg c, char * argv [])
24.
25. {
26. Int x1=10, x2=20, 30=y1, y2=40;
27. Int a=3, b=4;
28. Int result1=rect_area (x1, x2, y1, y2);
29. Int result2=elipse_area (a, b);
30. Return 0;
31.}

1. [lichao @ sg01 name_mangling] $GCC -c simple_test. C
2.
3. [lichao @ sg01 name_mangling] $nm simple_test. O
4.
5. 0000000000000027 T elipse_area
6.
7. 0000000000000051 T main
8.
9. 0000000000000000 T rect_area
From the above output, you can see after using GCC compiler corresponding symbol table, almost without any finishing touches on a function, then use the g + + compiler:

1. [lichao @ sg01 name_mangling] $nm simple_test. O
2. 0000000000000028 T _Z11elipse_areaii
3.
4. 0000000000000000 T _Z9rect_areaiiii
5.
6. U __gxx_personality_v0
7. 0000000000000052 T main
Obviously, g + + compiler to symbols of adaptation is more complex, so, if a compiled by C language in the target file to invoke the C + + implementation of function, is sure to go wrong, because the symbol does not match,
Simple to do introduction _Z9rect_areaiiii:
Specified in the l c + + language: the following line and close to the capital letter or identifier begin with two underscores are retained in the c + + language identifier, so _Z9rect_areaiiii is a reserved identifier, g + + compiler to use of symbols from the target file _Z (C99 standard) in the beginning,
L in the next part and network protocol is very similar, says the next will say a the length of the string object (now know why don't use Numbers as the beginning of the identifier, isn't it?) So rect_area this nine characters as a function name identified,
L next each lowercase letters of the type of parameters, I said int type, the number of lowercase letters function of the number of parameters in the list,
L so, integration in the symbols used to distinguish between different overloaded function enough semantic information,
If you are in the C language in C + + function called how to do? Then you can use C + + keyword extern "C", the corresponding code is as follows:

/*
1.C
2. * simple_test.3. * a demo to show that the company name mangling technology in C + + and C
4.
5. * the Author: Chaos Lee
6.
7. */
8.
9. # include
10.
11. # ifdef __cplusplus
12.
13. Extern "C" {
14.
15. # endif
16. Int rect_area (int x1, int x2, int y1, int y2)
17.
18. {
19. The return (x2 - x1) * (y2 - y1);
20.}
21.
22. Int elipse_area (int a, int b)
23.
24. {
25. The return (int) (3.14 * a * b);
26.}
27.
28. # ifdef __cplusplus
29.
30.}
31. # endif
32.
33. Int main (int arg c, char * argv [])
34.
35. {
36 int x1=10, x2=20, 30=y1, y2=40;
37. Int a=3, b=4;
38. Int result1=rect_area (x1, x2, y1, y2);
39. The int result2=elipse_area (a, b);
40. Return 0;
41.}
The following is the result of using GCC compiler:

1. [lichao @ sg01 name_mangling] $GCC -c simple_test. C
2.
3. [lichao @ sg01 name_mangling] $nm simple_test. O
4.
5. 0000000000000027 T elipse_area
6.
7. 0000000000000051 T main
8.
9. 0000000000000000 T rect_area
In the use of a g + + compiler:

1. [lichao @ sg01 name_mangling] $g + + - c simple_test. C
2.
3. [lichao @ sg01 name_mangling] $nm simple_test. O
4.
5. U __gxx_personality_v0
6.
7. 0000000000000028 T elipse_area
8.
9. The main 0000000000000052 T
10.
11. 0000000000000000 T rect_area
Visible, use the extern "C" key words, symbols organized according to the format of the C language,
In fact, the C standard library is used in a lot of extern "C" key word, because the C standard library also can use the C + + compiler, but make sure that the compiled remained rather than C + + C interface (because is the C standard library), so you need to use the extern "C" key word,
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related