Wireshark mailing list archives

Re: Building on Windows with CMake: Status and help needed


From: Graham Bloice <graham.bloice () trihedral com>
Date: Sun, 6 Oct 2013 14:01:10 +0100

On 5 October 2013 12:03, Joerg Mayer <jmayer () loplof de> wrote:

Hello,

I've made some progress and am now able to almost build a first 32 bit
executable with VSEE2010. The executable (capinfos) using nmake as build
tool.
The cmake stage (for nmake) is working as much as is needed, i.e. no GUI
package detection right now.
Compilation is working, but linking fails:
  capinfos.c.obj : error LNK2001: unresolved external symbol __imp__optind
  capinfos.c.obj : error LNK2019: unresolved external symbol __imp__getopt
referenced in function _main
I've spent some hours digging into it but everything I've tried has failed.

Other open issues:
- The same warning over and over again:
  cl : Command line warning D9025 : overriding '/MD' with '/MDd'
- Problems with the WS_DLL_PUBLIC mechanism, one out of many examples:
  C:\wireshark\trunk\epan\plugins.c(31) : warning C4273:
'wslua_plugin_list' : inconsistent dll linkage
        c:\wireshark\trunk\epan\plugins.h(65) : see previous definition of
'wslua_plugin_list'

My next steps (not necessarily in that order):
- Try to get the remaining executables as close to linking as possible.
- GTK3 and GTK2 builds (gtk detection).
- Is there a recipe for Qt5 builds on Windows (esecially the qt5 package)?
- Go for 64 bit builds.

If someone feels motivated to help with any of the problems or unfinished
tasks above or anything else: Go ahead - I don't want a monoploly on this
;-)
Coordination via the list or IRC(freenode) #wireshark?

Full logs of a build of svn revision 52377
cmake -G "NMake Makefiles" ..\..\trunk
cmake --build . -- VERBOSE=1

can be found here:
http://www.loplof.de/kram/cmake.log
http://www.loplof.de/kram/build.log



Hi Joerg,

I was also working on this yesterday, but I was using CMake to build a
Visual Studio solution (VS2010 Pro).  I was trying to get randpkt to build
and at least one issue you mention (import of getopt) is where I had issues.

The issues I ran into were:

* Needed to add a definition for MSC_VER_REQUIRED to CMakeList.txt.  I
cheated and just hacked in a fixed one for my version
(MSC_VER_REQUIRED=1600).

* randpkt, and a lot of other things depend on wsutil.  CMake doesn't seem
to add a dependency on wsutil though.

* wsutil on windows also requires 5 files to be added
to WSUTIL_PLATFORM_FILES: inet_aton.c, inet_ntop.c, inet_pton.c,
strptime.c, wsgetopt.c

* wsutil requires at least ws2_32.lib to link

I still can't produce a dll yet as the link fails looking for strncasecmp
required by strptime_internal.  This has me stumped.  I checked what the
normal nmake produced dll imports (using dumpbin /imports libwsutil.dll)
and that function isn't listed.  I think it's something to do with all the
macro wizardy in strptime.c

For what it's worth I think the link libs we supply are mostly far beyond
what is needed, for this dll produced by the normal nmake build the
dependences are (using dumpbin /dependents):

Dump of file ..\..\trunk\wireshark-gtk2\libwsutil.dll

File Type: DLL

  Image has the following dependencies:

    KERNEL32.dll

    WS2_32.dll

    ADVAPI32.dll

    SHELL32.dll

    libglib-2.0-0.dll

    libgmodule-2.0-0.dll

    libgcrypt-11.dll

    MSVCR100.dll

  Summary

        1000 .data

        C000 .rdata

        1000 .reloc

        1000 .rsrc

       11000 .text


I've also attached the build output for the dll from the normal nmake build
and the CMake generated VS2010 build for comparison as there must be a
vital difference somewhere.

Attachment: nmake-build.txt
Description:

Attachment: cmake-vs2010-build.txt
Description:

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: