GNE Tutorials

GNE website

Tutorials Home

Tutorials

  1. Creating exhello
  2. Techniques using PacketFeeder

Figures

  1. GNE Mid-Level API Connection Process

Installation Tutorials

  1. MSVC.NET
  2. MinGW32
  3. Linux/UNIX

Installing GNE for MinGW32

Follow these steps to build GNE with the MinGW compiler (Windows GCC port).

Contents

  1. Install HawkNL
  2. Install Boost
  3. Provide Library Paths
  4. Compile GNE
  5. Use GNE

Step 1: Install HawkNL

The first dependency required for GNE is HawkNL. HawkNL can be found at http://www.hawksoft.com/hawknl/. GNE 0.70 was developed using HawkNL 1.66. I believe any HawkNL 1.6 version will work, but 1.66 is suggested. HawkNL 2.0 has not been released yet, so nothing can be said about GNE compatibilty with HawkNL 2.0.

If you compile HawkNL yourself, it is very highly suggested that you compile with NL_WIN_THREADS defined. This will be the default in HawkNL 2.0, but if you compile with NL_WIN_THREADS the pthreads32 library and DLL will not be required and HawkNL will use native Win32 threads.

I also provide a prebuilt version of HawkNL for MSVC.NET and MingW32 users already compiled with the NL_WIN_THREADS option. You can find it from the same location you downloaded GNE from.

Once you have HawkNL compiled, you will have the HawkNL.lib file, the nl.h header, and the HawkNL.dll file. Keep in mind the location of these files, so you can locate them later. For MingW32, the file is HawkNL.a rather than HawkNL.lib.

Back To Top

Step 2: Install Boost

The second dependency for GNE is the Boost library. Boost can be found at http://www.boost.org/. Most parts of Boost are implemented as templates, which means that NO compiling is needed. None of the parts of Boost that GNE uses require compiling. So you need NOT to compile the Boost library -- I make a special note because the first time I got Boost I tried forever to try to compile it only to discover it doesn't need to be compiled. All that is needed is for you to unpack the Boost library.

GNE was developed using Boost 1.30. There is a bugfix version 1.30.2. I have no reason to believe that GNE will not compile with that Boost version.

Once you have unpacked Boost, you will have a directory strucuture. Keep note of where the Boost_1_30_0 or Boost_1_30_2 library is located, so you can locate it later.

The Boost library download is 10 megs. If you do not already have boost I have provided a minimal version of Boost that includes only the files required for GNE that is around 100k. You can find this file from the same place you downloaded GNE.

If you download this "mini Boost" version, you can unpack it into the include directory of the GNE structure for easiest use, or you can unpack it into a new directory of your choosing. If you unpack it into the GNE\include directory, you should end with a directory structure that looks like this:

  • GNE Root
    • include
      • directory boost
      • directory gnelib
      • gnelib.h

This will add the "boost" directory into the gne\include directory.

Back To Top

Step 3: Provide Library Paths

In the MinGW build, the method to provide the paths to HawkNL's .a and header and Boost's headers is through the LibPaths.mak file. In the GCC compiler the -I option and -L option.

If you have not installed HawkNL or Boost into your compiler's paths where it can find it, you need to specify the paths in the LibPaths.mak file.

Back To Top

Step 4: Compile GNE

To compile GNE for MinGW, perform the following steps:

First run "fixming.bat" to configure GNE for mingw32.

Second decide your options:

  • If you want the debug compile of GNE, append DEBUGMODE=1
  • If you have GCC 2.95 (MinGW 1.0), append OLD_CPP=1

So if you want to compile in release mode: run "make". If you want to compile in debugmode with MinGW1.0, run "make DEBUGMODE=1 OLD_CPP=1".

If you only want to compile the lib, use "make lib"

Back To Top

Step 5: Use GNE

Once you have compiled GNE you have two options for using it.

The first way is to add the -I lines for HawkNL, Boost, and GNE to your project's makefile. This is probably the best way.

Some people prefer to install GNE and other libraries right into their compiler's paths. If you prefer this method, you can run "make install" to copy GNE into your Ming directory (you must have defined the MINGDIR environment variable).

If you don't have MINGDIR set, you can set it like this and install.

C:\gne>set MINGDIR=C:\mingw
C:\gne>make install

If you do it this way, you don't need to add any -I lines to your GCC line. You do still have to add the -l lines. For example:

gcc -o mygneprog.exe -lgnelib -lNL mygneprog.cpp

If you prefer to not copy the files into your compiler's directory, you have to use -I and -L. It looks like a long line, but it's not bad if you are using makefiles so you only have to type it once:

gcc -o mygneprog.exe -I"C:\My Projects\boost_1_30_0" -I"C:\My Projects\HawkNL\include" -I"C:\My Projects\gnelib\include" -L"C:\My Projects\HawkNL\lib" -lgnelib -lNL mygneprog.cpp

I apologize for allowing word wrap there but without it it will make a really huge horizontal scroll bar ;). All of that above should be on a single line.

Back To Top