Failed to dlsym make_device: undefined symbol: make_device

Failed to dlsym make_ device: undefined symbol: make_ device

Recently, I encountered some bugs when doing development. I have been troubled for a long time. Although I am a good cook, I think I can accumulate it. When I encounter the same type of problems in the future, I have a way to solve the problems. The problem is as follows: Android recovery system can do some basic test demo below. But this latest demo is developed by C + + and C language. Some functions need to rely on dynamic libraries, such as librecovery_ UI. So, but there is a special library called librecovery_。 At that time, using the find command, we could find the generation location of the library. However, when using grep to find the generation location of the dynamic library, we couldn’t find it. We only found the calling location. For a time, we doubted whether we had made a mistake. Finally, we searched under the general system root directory. Finally, we kept printing a lot of messy code under the out subdirectory, thinking it was a program crash, It’s time for ^ C to end the process. But in the end, no matter how many, just let it collapse. Finally, we found the location of the Library under the out directory. It turned out that it was an automatically generated MK file, in which many concise generation dependent library scripts were used. Finally, we found the location of the so.

Then I met the problem on the topic, that is, how can the so library compiled according to the correct script file not find the defined library when using dlopen call?I wonder if there is a problem with the function, and then I wrote a new function to test the call, and found it still can’t work, Failed to dlsym FN: undefined symbol: test is also displayed. Then I searched the Internet and found that most people said that they needed to add extern “C” to the function. Finally, according to what I said on the Internet, I found that it was still not possible. Finally, I asked my colleagues and got the answer to the question, which is to use the nm command of Linux to find the dynamic library or the static library that contains the functions that can be called. Finally, I found that the dynamic library that I passed to the board did not have the make that I wanted to call_ Then use the find command to find two. So libraries with the same name. Finally, find the function body to be called in another library. Finally, transfer another. So library to the board. Finally, it is successful.

Read More: