简体   繁体   中英

How to determine which library a symbol is defined in (linux)

I've got a small open source program which compiles as a shared module for apache, but when apache tries to load it, it refuses to load, complaining about: "undefined symbol: ap_log_rerror". Running ldd on the shared libraries generates a list of about a dozen dependencies, so these are the ones where I know the function is NOT defined. How do I go about finding which library provides this function? My question isn't how to list symbols - I know how to do this with nm. My question is where to find the file that contains the symbol I want? Is there any efficient, easy way to identify the right file?

update: I worked around this by recompiling my program. So it loads now, although my core question remains unanswered.

I may know your meant. On Windows, we can use "dumpbin /ALL [executable]" to get all available information(see dumpbin ), which includes the info of where symbols of the executable are defined(see below), but I don't find its equivalent in Linux.

ksh-3.2$ dumpbin /ALL test.exe > all.sym
ksh-3.2$ sed -n "3155,3172p" all.sym
    api-ms-win-crt-heap-l1-1-0.dll
             14000E1D8 Import Address Table
             14000E730 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                           8 _callnewh
                          19 malloc
                          18 free
                          16 _set_new_mode

    api-ms-win-crt-math-l1-1-0.dll
             14000E2B0 Import Address Table
             14000E808 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                           9 __setusermatherr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM