Ethereal-dev: Re: [Ethereal-dev] Trying to build Ethereal on Win32 with theMSVC++Toolkit 2003

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Olivier Biot" <ethereal@xxxxxxxxxx>
Date: Wed, 21 Apr 2004 02:54:51 +0200
----- Original Message ----- 
From: Olivier Biot


| From: Olivier Biot
|
|
| | Hi list,
| |
| | I'm trying to compile Ethereal on WinXP with the recently released
| | MSVC++ command-line toolkit.
| |
| | First of all you need to download and install this toolkit from
this
| | link:
| | http://msdn.microsoft.com/visualc/vctoolkit2003/
| |
| | Then you need NMAKE. Fortunately NMAKE 1.5 can be downloaded from
| | Microsoft if you search for "KB132084". Unpack the archive by
| running
| | it, and drop the 3 extracted files in the MSVC++ Toolkit "bin"
| | directory.
| |
| | Now it's time to edit config.nmake.
| |
| | Now read README.win32 and try to run the 1st make (nmake -f
| | Makefile.nmake setup). You'll note that you don't have "Win32.mak"
| as
| | it is not shipped with the Toolkit.
| |
| | Fortunately you can get around this issue by browsing to
| | http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
| | where you select the "Core SDK" and only tick the "Build
| Environment"
| | (31MB) option. After a while, this SDK will be installed.
| |
| | >From the start menu, choose "Programs"
| | -> "Microsoft Platform SDK February 2003"
| | -> "Open build environment window"
| | -> (choose your OS Win2K/WinXP/Win2003)
| | A command prompt will open. Now run the vcvars32.bat from the
MSVC++
| | Toolkit so your build environment will work:
| |
| | And now you're stuck since NMAKE 1.5 doesn't like the '::' for
| suffix
| | rules in Makefiles. So I got rid of the "::" in the ".c.obj::"
| target
| | of all Makefile.nmake files. From the cygwin prompt, type:
| | $ find . -name Makefile.nmake -exec grep -l "^[.].*::" {} ';'
| |
| | Now nmake -f Makefile.nmake setup works!
| |
| | Now you want to run "nmake -f Makefile.nmake" but it won't work as
| | your PATH contains space characters. The simplest way of figuring
| your
| | path is by cd'ing to a directory with spaces in it and then type
| | "command" and then "exit".
| |
| | Once you've done this, you're ready to compile... for a while as
| | PCAP.H wants to include <sys/time.h> which means WIN32 has not
been
| | defined. So edit config.nmake and add "/DWIN32" to the compiler
| flags.
| |
| | Now again try running "nmake -f Makefile.nmake". Again you will be
| | able to compile for a while, after what it will fail again:
| |
| | <start>
| | C:\cygwin\home\Eigenaar\ethereal\Win32\ethereal\wiretap>nmake -f
| | Makefile.nmake
| |
| | Microsoft (R) Program Maintenance Utility   Version 1.50
| | Copyright (c) Microsoft Corp 1988-94. All rights reserved.
| |
| |         link  /INCREMENTAL:NO
| | /NOLOGO -entry:_DllMainCRTStartup@12 -dll kernel32.lib  ws2_32.lib
| | mswsock.lib advapi32.lib  /DEBUG  /DEF:wtap.def
/OUT:wiretap-0.1.dll
| | /IMPLIB:wiretap-0.1.lib  airopeek9.obj  ascend-grammar.obj
| | ascend-scanner.obj  ascend.obj  atm.obj  buffer.obj  cosine.obj
| | csids.obj  dbs-etherwatch.obj  erf.obj  etherpeek.obj
| file_access.obj
| | file_wrappers.obj  hcidump.obj  i4btrace.obj  iptrace.obj
| | lanalyzer.obj  libpcap.obj  netmon.obj  nettl.obj
| | network_instruments.obj  netxray.obj  ngsniffer.obj  radcom.obj
| | pppdump.obj  snoop.obj  toshiba.obj  eyesdn.obj  visual.obj
vms.obj
| | wtap.obj  5views.obj
| |
|
C:\cygwin\home\Eigenaar\ethereal\Win32\ethereal-win32-libs\glib\lib\gl
| | ib-2.0.lib
| |
|
C:\cygwin\home\Eigenaar\ethereal\Win32\ethereal-win32-libs\glib\lib\gm
| | odule-2.0.lib
| |
|
C:\cygwin\home\Eigenaar\ethereal\Win32\ethereal-win32-libs\glib\lib\go
| | bject-2.0.lib
| |
|
C:\cygwin\home\Eigenaar\ethereal\Win32\ethereal-win32-libs\zlib121-dll
| | \lib\zdll.lib
| |
| | LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
| | NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return
| code
| | '0x450'
| | Stop.
| | <end>
| |
| | Here I am definitely stuck :(
| |
| | Has this to do with the fact that the MSVCRT.DLL and the likes are
| not
| | included in the MSVC++ Toolkit? As I am not familiar at all with
the
| | MSVC compiler suite, I'd like to know what I have to do in order
to
| | continue compilation. Maybe some Makefile.nmake have to be
| redefined?
| |
| | I have attached all changes I made to the normal cvs snapshot.
|
| Looks like reading win32.mak yields parts of the solution:
| #
|
======================================================================
| ===
| # Build Rules Quick Start
| #
| # To build one of the following types of executables, use the
| specified
| # compiler and linker command-line options.
| #
|
  -------------------------------------------------------------------
| --------
| #   To build:         |  Compiler Options      | Linker options
(pick
| one
| #                     |                        | line. con =
console,
| #                     |                        | gui = GUI, ole =
GUI
| OLE)
|
  -------------------------------------------------------------------
| --------
| #  Single threaded    | cdebug cflags cvars    | ldebug guilflags
| guilibs
| #  app with static    |                        | ldebug conlflags
| conlibs
| #  CRT                |                        | ldebug guilflags
| olelibs
|
  -------------------------------------------------------------------
| --------
| #  Multithreaded app  | cdebug cflags cvarsmt  | ldebug guilflags
| guilibsmt
| #  with static CRT    |                        | ldebug conlflags
| conlibsmt
| #                     |                        | ldebug guilflags
| olelibsmt
|
  -------------------------------------------------------------------
| --------
| #  Single or multi-   | cdebug cflags cvarsdll | ldebug guilflags
| guilibsdll
| #  threaded app with  |                        | ldebug conlflags
| conlibsdll
| #  DLL version of CRT |                        | ldebug guilflags
| olelibsdll
| #  (MSVCRT.DLL)       |                        |
|
  -------------------------------------------------------------------
| --------
| #  DLL with static    | cdebug cflags cvarsmt  | ldebug dlllflags
| guilibsmt
| #  CRT*               |                        | ldebug dlllflags
| conlibsmt
| #                     |                        | ldebug dlllflags
| olelibsmt
|
  -------------------------------------------------------------------
| --------
| #  DLL with DLL       | cdebug cflags cvarsdll | ldebug dlllflags
| guilibsdll
| #  version of CRT     |                        | ldebug dlllflags
| conlibsdll
| #  (MSVCRT.DLL)       |                        | ldebug dlllflags
| olelibsdll
|
  -------------------------------------------------------------------
| --------
| #
| #  * Always make DLLs multithreaded because a DLL has no way to know
| whether
| #    the calling application has multiple threads, and has no way to
| prevent
| #    multithreaded apps from loading it.
| #
|
| For wiretap this means:
| * replace cvarsdll with cvarsmt
| * replace conlibsdll with conlibsmt
|
| But now I get another problem: the "lib" command is not found in the
| MSVC++ Toolkit. Is it possible to replace "lib" with some $(link)
| command as used in wiretap/Makefile.nmake?

OK, I found out that I have to replace "lib" with "link /lib" as the
former is a wrapper for the latter :)

Then I can compile up to the point where register.c must be generated.
This of course fails as the command-line exceeds the limits from
cmd.exe. fortunately I have a cygwin build on the same machine, so I
was able to copy register.c to epan/ and then I commented out the
generation of regsiter.c in the Makefile.

Now everythings *compiles* and the helper libraries are linked!

The build process however fails at the very end when the applications
must be lnked:
Linking tethereal.exe
        link @C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\nma02516.
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code
'0x450'
Stop.

Could some MSVC programmer provide me some help here? I think I have
to change something in the linker options but I don't know which or
how.

Regards,

Olivier