[Snort-users] Compiling snort on Win32

Chris Reid Chris.Reid at ...2817...
Sat Jun 1 01:44:02 EDT 2002


Michael,

My finger must have slipped (twice).  I should have said that the project
would be for 1.8.7.  But it should work just as well for any previous 1.8.x
codebases from the last month or two.

The warnings being suppressed are described in the snort.h file (updated
soon to a CVS repository near you).  But, here is the official explanation:

 * Microsoft Visual Studio 6.0 has inconsistent declarations for the
following
 * standard functions.  This causes compile-time warnings about "formal
parameter
 * 1 different from declaration".  The pragma suppresses this warning.
 *
 *    double atof(const char *);                <-- stdlib.h
 *    double atof( char *);                     <-- math.h
 *
 *    int remove(const char *);                 <-- stdio.h
 *    int remove( char *);                      <-- io.h
 *
 *    int rename(const char *, const char *);   <-- stdio.h
 *    int rename( char *,  char *);             <-- io.h
 *
 *    int _unlink(const char *);                <-- stdio.h
 *    int _unlink( char *);                     <-- io.h
 *
 *    int system(const char *);                 <-- stdlib.h
 *    int system( char *);                      <-- process.h
 *
 *    int _wsystem(const wchar_t *);            <-- stdlib.h
 *    int _wsystem( wchar_t *);                 <-- process.h
 *
 * The strange part is that if you look at math.h / io.h / process.h, the
 * functions are declared properly.  It's as if the "const" has been defined
 * to be an empty string (although I couldn't find this).  Only when you
look
 * at the preprocessor output do you see that the "const" has been removed.
 * Anyhow, the 4028 pragma gets rid of nearly 500 compile-time warnings.

So, these warnings can be deemed non-critical at this point.

The resulting executable code will be the same with the new project.
Although, a few more predefined configurations have been added to the Visual
Studio project, if you feel so inclined to provide them to the public for
download.  ;)

Chris Reid


----- Original Message -----
From: "Michael Steele" <michaels at ...155...>
To: "'Chris Reid'" <chris.reid at ...3029...>;
<snort-users at lists.sourceforge.net>
Sent: Friday, May 31, 2002 3:50 PM
Subject: RE: [Snort-users] Compiling snort on Win32


> Chris,
>
> I'm assuming that the warnings mean nothing and fixing it for a clean
> executable is going to produce the same snort.exe?
>
> Will the code below work with 1.8.7?
>
> The log file inclusion has been a must for a multitude of updates.
>
> Michael Steele | System Engineer / Support Technician
> mailto:michaels at ...155...
> Silicon Defense: IDS solutions - http://www.silicondefense.com
> Snort: Open Source Network IDS - http://www.snort.org
>
> -----Original Message-----
> From: snort-users-admin at lists.sourceforge.net
> [mailto:snort-users-admin at lists.sourceforge.net] On Behalf Of Chris Reid
> Sent: May 31, 2002 2:18 PM
> To: Ian Macdonald; snort-users at lists.sourceforge.net
> Subject: Re: [Snort-users] Compiling snort on Win32
>
> Ian,
>
> I talked with Chris Green about this yesterday.  I had already planned
> on
> providing him with a new Visual Studio project for Snort 1.8.6 tonight
> (Friday).
>
> Currently, there should be hundreds of warnings, but only one link
> error.
> The link error should indicate that one of the "log" source files is
> missing.  As part of my Visual Studio project update tonight, I was also
> going to give Chris some diff's to snort.h (already found in the 1.9
> source)
> which reduce the warnings down to about 24.
>
> If you just can't wait  ;)  here is how you can compile a clean 1.8.6
> executable:
>
> *  Open snort.h
>
> *  Locate the include of <math.h>, and change it to:
>
>     #ifdef WIN32
>         #pragma warning( disable : 4028 )
>     #endif /* WIN32 */
>     #include <math.h>
>     #ifdef WIN32
>         #pragma warning( default : 4028 )
>     #endif /* WIN32 */
>
> *  Further down in snort.h, locate:
>
>     /* This is basically everything needed to make snort work under
> WIN32. -- Mike Davis */
>     #ifdef WIN32
>         #include <winsock.h>
>         #include <windows.h>
>         #include <io.h>
>         #include <sys/timeb.h>
>         #include <process.h>
>         #include <direct.h>
>         #include <getopt.h>
>         typedef unsigned char  u_int8_t;
>         typedef unsigned short u_int16_t;
>         typedef unsigned int   u_int32_t;
>         typedef int            pid_t;
>
>     and change it to:
>
>     /* This is basically everything needed to make snort work under
> WIN32. -- Mike Davis */
>     #ifdef WIN32
>         #include <winsock.h>
>         #include <windows.h>
>         #pragma warning( disable : 4028 )
>         #include <io.h>
>         #include <process.h>
>         #pragma warning( default : 4028 )
>         #include <sys/timeb.h>
>         #include <direct.h>
>         #include <getopt.h>
>         typedef unsigned char  u_int8_t;
>         typedef unsigned short u_int16_t;
>         typedef unsigned int   u_int32_t;
>         typedef int            pid_t;
>
> *  Compile.  This should still generate the link error.  Look at the
> error
> to figure out which "log" source file is missing.  Add this file to your
> Visual Studio project, and compile again.
>
> Chris Reid
>
>
> ----- Original Message -----
> From: "Ian Macdonald" <secsnort at ...5528...>
> To: <snort-users at lists.sourceforge.net>
> Sent: Friday, May 31, 2002 3:56 PM
> Subject: [Snort-users] Compiling snort on Win32
>
>
> >
> > I have a couple changes I would like to make to the snort.exe binary,
> so I
> > thought I would download the 1.8.6 and see if I can compile it myself.
> >
> > Can anyone point me to a document describing how to compile on
> windows? I
> > found the snort.dsp and snort.dsw files in win32/win32-prj an started
> up
> > Visual Studio 6, but I get alot of errors when I try to do a build
> >
> > What are the prerequisites I need before being able to compile snort
> on
> w32?
> >
> > Thanks
> >
> >
> > Ian
> >
> >






More information about the Snort-users mailing list