Installing GNU Radio with Native Windows Tools

WARNING: This page is a work-in-progress.

Two developers, Andrew Rose and Geof Nieboer, have taken up the challenge to get a windows native install complete. For the moment, this is note of their independent attempts to get it going. Geof's methodology is to use Managed C++ to add a shim to .NET managed code, and then use C# instead of Python. So Managed C++ would replace SWIG and C# Python.

Rationale

  • Even with the Cygwin installation instructions, producing a working build with this method was very painful.
  • Having produced the build, the result was unusably slow.

Starting Point

  • Windows XP SP2 box.
  • Subversion already installed.
  • MSVC6 already installed.

Latest Update

06/04/08 {Geof}

  • All of the core/filter classes have been wrapped using a series of template classes. general and io are all that's left of core to wrap

06/02/08 {Geof}

  • All [96!] of the core/gengen classes have been wrapped using a series of template classes.

05/21/08 {Geof}

  • Successfully created a Managed base class which allows .NET developers to create blocks using any CLS language
  • The blocks can work side by side with C++ blocks, as long as the overall code is in .NET
  • Probably not wise to use these blocks for processing because performance would be better in native C++, but I haven't done benchmarking yet. But for rapid proof of concept it might be satisfactory.
  • Most likely use is to create sinks, which could then leverage WinForms? etc
  • The current version is pretty basic, it just implements sync_block and hasn't been fully wrung out, though the toughest work is complete. A basic derived C# class had no impact on the USRP benchmark max throughout.
  • Next step is to create more wrappers for the many many native blocks out there.

05/06/08 {Geof}: Success!

  • The gr-core, gr-usrp, and usrp have been compiled using MSVC++ 2005
  • Managed C++ shims have been built for 6 classes (just ones needed for the usrp_benchmark_usb test)
  • usrp_benchmark_usb.py has been ported to C#
  • The program runs successfully!
  • TODO:
    • port over windows audio C++ library
    • Create a hybrid native/managed class to expose the data stream to C# consumers, basically need to take the std::vector and push it to a .NET IOStream class and set up event notifications.
    • Create additional shim classes to cover all the rest of the sources/sinks/filters. This should be straightforward now, just timeconsuming.

Progress

LibraryPriorityStatus (C++)Status (C#)
Omnithread Done-GA
GR_Core HPIn Progress
* filterDone-G
* g72x Done-A
* general Done-GA
* gengen Done*-GWrappers done
* ioDone-GA
* missing
* reed-solomon
* runtime Done-GA
* swigNANA
USRP LP: I can't afford oneDone-G
GNU_Radio_USRP LP: requires URSPDone-G
GR_Audio_Alsa LP: appears to be Linux specific
GR_Audio_Jack LP: Ditto
GR_Audio_OSS LP: Ditto
GR_Audio_OSX
GR_Audio_PortAudio HP
GR_Audio_Windows HP
GR_ATSC
GR_Comedi
GR_GSM_FR_VOCODER
GR_Pager
GR_Radio_Mono
GR_Radio_Astronomy
GR_Trellis
GR_WXGUI
GR_Sounder LP: requires USRP
GR_UtilsNA
GNU_Radio_Examples HP: Get the "audio" examples working as proof-of-concept

LP = Low Priority HP = High Priority * = This library appears to use Python script to machine generate code. "Done" in this case means the existing C++ files create after running configure on CygWin? have been built, the machine generated will need to be revisited

Dependencies

  • Boost (http://www.boost.org/). I used boost_1_34_1.zip.
  • FFTW (http://www.fftw.org/install/windows.html). I used the pre-compiled fftw-3.1.2.zip (shared, single-precision version). You'll need to produce your own .lib file as instructed using the following call.
    lib /machine:i386 /def:libfftw3f-3.def
    
  • libusb-win32. Only applies if using USRP. Use version 0.1.10.1 for the moment. The 0.1.12 versions include #windows.h which complicates build process.

Notes

  • Get the latest GNU Radio codebase via subversion.
  • Attempt to build a random file in gnuradio-core\src\lib\runtime\.
  • Discover that MSVC6 can't cope with the following (valid) syntax. (This problem is not an issue in MSVC 2005)
    for (unsigned int i=0; i<n; i++) {}
    for (unsigned int i=0; i<n; i++) {}
    

FYI: known issue. can be worked around by wrapping the first for loop with {}:

{for (unsigned int i=0; i<n; i++) {}}
for (unsigned int i=0; i<n; i++) {}
  • Install Visual C++ 2008 Express Edition (http://www.microsoft.com/express/vc/), which is free (beer).
  • Discover that GCC allows the following (valid C99) syntax, but MSVC doesn't.
    void funcname(int n)
    {
      int foo[n];
    }
    
  • Fix is to replace all instances with the following. If I ever get this install working, I'll submit all such fixes for inclusion in the main codebase.
    void funcname(int n)
    {
      int *foo = (int *)malloc(n * sizeof(int));
      ...
      free(foo);
    }
    

FYI, it's probably easier to use "alloca" if it's supported by MS. it does stack-based dynamic allocation.

void funcname(int n)
{
  int *foo = (int *)alloca(n * sizeof(int));
  ...
}
  • Note to self: Must remember to check existing changes for correct use of 'free'.
  • Define HAVE_CONFIG_H when building any file. Create \w32\config.h as a repository for all the necessary settings to get this working on Windows. Again, I'll submit this if it works.
  • Floating point support seems like an issue. Investigate if there are any 3rd party floating point libraries that I can use, rather than the default MS stuff.
  • (Geof) rint and roundf have no MSVC equivalent, so they had to be declared in the config.h file
  • (Geof) system doesn't like std::min(), but likes min()
  • (Geof) had to port over the assembly code in 'filters' to Intel syntax instead of AT&T and make it inline instead. As a side note, MSVC has SSE1/2 optimization built in, so it will be worth a try to compare MSVC's result to the hand-coded result. Also there appears to be some powerful optimizations in SSE4 that do dot products specifically, so there's an opportunity for some more optimization there.
  • (Geof) attribute is a GCC-specific extension, so it must be removed to work w/ MSVC 8 + C99

Dead Ends

  • (Andrew) I tried to install the GnuWin32 (http://gnuwin32.sourceforge.net/) version of the automake tools, but they don't include autom4te (which is a dependency). I'll see if I can produce a script that can convert the Automake.am files to .vcproj files. (Obviously, in the general case, this is impossible. But with the limited syntax I've encountered so far, it might be possible to produce something useful.) Geof's approach is to create a totally separate directory with the MSVC unique code in it, with .vcproj files that point to the original version. Obviously not cross-compatible, but probably workable.