2

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.

Michael Martinez
  • 2,693
  • 1
  • 16
  • 19
  • 1
    http://apache-http-server.18135.x6.nabble.com/Apache-2-4-4-undefined-symbol-ap-log-rerror-td5004721.html – tink Feb 20 '19 at 20:36
  • Possible duplicate of [How do I list the symbols in a .so file](https://stackoverflow.com/q/34732/608639), [How do I find where a symbol is defined among static libraries](https://stackoverflow.com/q/19916119/608639), [Easy check for unresolved symbols in shared libraries?](https://stackoverflow.com/q/1617286/608639), [Find where is a shared library symbol defined on a live system / list all symbols exported on a system](https://unix.stackexchange.com/q/103744/56041), etc. – jww Feb 20 '19 at 20:53
  • Nope, that's a different issue. In that issue, the OP wants to know which symbols are not defined. I want to know *where to find* the files where said symbols *are* defined. – Michael Martinez Feb 21 '19 at 18:30
  • 1
    @tink That helps. I ended up recompiling anyway, which fixed my issue. But it's useful to know where that function is defined. Thanks. – Michael Martinez Feb 21 '19 at 18:32
  • You may want to use [nm(1)](http://man7.org/linux/man-pages/man1/nm.1.html) on the files mentioned in output of `ldd` – Basile Starynkevitch Feb 21 '19 at 18:35
  • @BasileStarynkevitch Actually that's the opposite of what is needed. We already know those files don't have that symbol, otherwise it wouldn't complain about undefined symbol. – Michael Martinez Feb 21 '19 at 22:20

1 Answers1

0

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