Wireshark-dev: Re: [Wireshark-dev] Function getaddrinfo() vanished in one of the later commits.
Date: Sat, 5 Jan 2019 16:29:08 +0100
On 5-1-2019 00:05, Guy Harris wrote:
On Jan 4, 2019, at 2:38 PM, hdv <henri.de.veer@xxxxxxxxx> wrote:

I'm not a guru on CMake, so no idea if the libraries are binary loaded (probably) or built locally. I even don't know in which lib it was before, it just worked and now this surprises me. I followed the installation instructions (more or less) for windows mentioned in the documentation.
For Windows builds, it was *never* in glibc.  GNU libc is the C library for most Linux distributions, but it's rarely the C library on any other operating system, such as *BSD/macOS, Solaris, HP-UX, AIX, or Windows.
Ok, I assume there *could* be a binary (static) lib distributed with Wireshark, so it is not the case apparently. So I don't have to search for the problem there. The makefiles refer to "GLIB2_LIBRARIES" I assumed these to be the standard library.

No idea what is linked in windows exactly, it was working in the old commit and after rebase to one of the latest commits it does not link any more. So I would say it is a regression issue?
If your old CMake files were incorrect but happened to work before the change, but didn't work after the change, it's not a regression issue, but if they were correct, that's a regression issue, and *our* extcap programs are the ones that are getting linked with the Winsock libraries, on Windows, by luck.

Are you building your program in the extcap directory of the Wireshark source tree?  If so, have you added it to the CMakeLists.txt file in that directory?  If so, are you linking it with the wsutil library?  That library is linked with the Winsock2 library on Windows, which is probably how the extcap programs get linked with Winsock2.

We need to do a better job of documenting in the Developer's Guide how to *build* an extcap program - we say how to *write* it, but I don't see anything about *building* it.

I'm building the entire tree, including the extcap and I adjusted 2 makefiles: The extcap/CMakeLists.txt and the CMakeOptions.txt file.

So probably I need to add the correct library to "target_link_libraries" (via the *_LIBS var) but which library name is it?

Should I add something like this in the "set(anagate_LIBS ...." variable (did a quick search how it could be named): ?

if(WIN32)
  wsock32
  ws2_32
endif()

Currently the section I added in  "extcap/CMakeLists.txt" looks like this:

if(BUILD_anagate)
    set(anagate_LIBS
        wsutil
        writecap
        ${GLIB2_LIBRARIES}
        ${CMAKE_DL_LIBS}
    )
    set(anagate_FILES
        anagate-core.c
        anagate-intf.c
        extcap-base.c
            
    )
    set_executable_resources(anagate "anagate")
    add_executable(anagate ${anagate_FILES})
    set_extcap_executable_properties(anagate)
    target_link_libraries(anagate ${anagate_LIBS})
    install(TARGETS anagate RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
    add_dependencies(extcaps anagate)
endif()


Something is ripped out of a library (in the wireshark codebase),
getaddrinfo() is not in a library in the Wireshark code base, it's in a system library, so we didn't remove it from any library, and it was not removed from any system library on any system I know of.
I know, so it is some kind of dependency that is indirectly pulled in in a earlier baseline and now vanished. (Or a lib that was not distributed any more but that is already clarified above that this is not the case).

What happened was that, before the change, your program was getting linked, on Windows, with the Ws2_32 library, but, after the change, it was no longer getting linked with that library.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe