Installing GNU Radio with MinGW and MSYS

These instructions are for using MinGW and MSYS to install and build GNU Radio software, including USRP TX/RX support, under Windows XP.

These instructions include information from the old wiki pages at UsrpMinGW and MinGW.

NOTE: Do not use any spaces in your Windows folder names when creating new ones.

NOTE: Building under MinGW/MSYS can coexist peacefully with Cygwin installed. Set up separate home directories for the two systems until you are thoroughly familiar with both systems.

MinGW / MSYS

The easiest way to install MinGW and MSYS is to use the automated installers and then update selected components as needed.

To install MinGW, download and run MinGW-5.1.4.exe from the "Automated MinGW Installer" section of the MinGW download area. Select the "Candidate", "g++", and "MinGW make" options in the installation wizard. By default, MinGW will be installed in C:\MinGW; you may need administrator privileges to do this.

Install MSYS by downloading and running MSYS-1.0.10.exe from the "MSYS Base System/Current Release: MSYS-1.0.10" section of the MinGW download area. Use the default settings to install MSYS in C:\msys\1.0 (you may need administrator privileges to do this). Type "y" to continue with post install, "y" when asked if MinGW is installed, and "C:/MinGW" when prompted for the MinGW install directory. If you skip the post-install or install MSYS first, you will need to manually add the line

C:/MinGW /mingw

to the MSYS file /etc/fstab (c:\msys\1.0\etc\fstab).

You can use MSYS version 1.0.11 if you prefer, but there is no installer yet (as of May 2008) for that version.

You can avoid some problems by intalling an updated version of bash. Download bash-3.1-MSYS-1.0.11-1.tar.bz2 from the "MSYS Base System/Technology Preview: MSYS-1.0.11" section of the MinGW download area to C:/msys/1.0. From a Windows command prompt window, execute the commands

C:/msys/1.0/bin/bzip2 -d bash-3.1-MSYS-1.0.11-1.tar.bz2
C:/msys/1.0/bin/tar -xf bash-3.1-MSYS-1.0.11-1.tar

Be sure that the MSYS shell is not in use; otherwise you will get a message like

/usr/bin/tar: bin/sh.exe: Cannot open: File exists

You will also need to download and install the MSYS developer's toolkit "msysDTK-1.0.1.exe from the "MSYS Supplementary Tools/Current Release: msysDTK-1.0.1" section of the MinGW download area using the default values.

The versions of autoconf, automake, and libtool loaded by the MSYS installer are too old. To get newer versions, download the following files from the "User Contributed: mingwPORT/Current Releases" section of the MinGW download area:

  • wget-1.9.1-mingwPORT.tar.bz2
  • autoconf-2.59-mingwPORT.tar.bz2
  • automake-1.9.5-mingwPORT.tar.bz2

to /usr/src (create /usr/src with mkdir if you need to). Then run the following commands (in an MSYS shell window):

mkdir /usr/local
mkdir /usr/local/bin
cd /usr/src
tar -jxf wget-1.9.1-mingwPORT.tar.bz2
cd wget-1.9.1/mingwPORT
cp wget.exe /usr/local/bin
cd /usr/src
tar -jxf autoconf-2.59.mingwPORT.tar.bz2
cd autoconf-2.59/mingwPORT
./mingwPORT.sh
cd /usr/src
tar -jxf automake-1.9.5.mingwPORT.tar.bz2
cd automake-1.9.5/mingwPORT
./mingwPORT.sh

You need to edit /mingw/bin/aclocal to change all occurrences of C:/ to /C/. You can do this with the editor of your choice (provided that it does not add formatting to the file or change the end-of-line separators), or you can use sed:

cd /mingw/bin
mv aclocal aclocal.orig
sed s.C:/./C/.g aclocal.orig > aclocal

You may not need them, but it is convenient to have the utilities from mingw-utils-0.3.tar.gz (from the "MinGW Utilities/Current Release: mingw-utils-0.3" section at [http://sourceforge.net/project/showfiles.php?group_id=2435 MinGW download area at SourceForge?]. Download these to C:/MinGW and unpack with tar -zxf.

Python

Note: The latest version of Python that is known to work with GNU Radio is Python 2.4.4. Versions 2.5.1 and 2.5.2 have been tried without success (builds work fine but GNU Radio modules cannot be loaded) and version 2.4.5 is not available in a binary version for Windows."

Download python-2.4.4.msi from Python 2.4.4.
Download numpy-1.0.4.win32-py2.4.exe from Numerical Python.
Double-click python-2.4.4.msi to install, using default prompts.
Double-click numpy-1.0.4.win32-py2.4.exe to install, using default prompts.

GNU Radio Dependencies

Unless otherwise noted, the following packages are required for building GNU Radio:

libtool 2.2

Install libtool 2.2 using the instructions in hints, tips, known problems, and solutions for Windows.

WxPython for Win32

WxPython is not required to build GNU Radio, but many applications use it.

Not certain if Unicode can be used with GNU Radio. These instructions use ANSI.

Download wxPython2.8-win32-ansi-2.8.7.1-py24.exe from http://wxpython.org/download.php.
Double-click on wxPython2.8-win32-ansi-2.8.7.1-py24.exe to install, using default prompts. You may need administrator privileges for this step.

pkg-config

Download the following files from http://www.gtk.org/download-windows.html to C:/msys/1.0/local:

  • GLib 2.16.3 Binaries (glib-2.16.3.zip)
  • pkg-config 0.23 Tool binaries (pkg-config-0.23-2.zip)

and unpack them (into /local) using Windows "Extract All..." or your favorite unzip utility. If you prefer, you can install these in C:/MinGW.

SWIG

Download swigwin-1.3.35.zip from SWIG downloads. Extract swigwin-1.3.35.zip to create the folder swigwin-1.3.35. You can put this folder in C:\, /mingw or /usr/src. The instructions below assume it is in C:\.

Boost

Download boost_1_33_1_headers.zip from Boost downloads, under "boost-subparts". Extract boost_1_33_1_headers.zip to C:\msys\1.0\local\include. To build from the svn trunk you will need boost 1.35 or later; see hints, tips, known problems, and solutions for Windows.

CppUnit

Download cppunit-1.12.0.tar.gz from CppUnit downloads to a convenient directory (e.g., C:\msys\1.0\src). From an MSYS shell:

tar zxf cppunit-1.12.0.tar.gz
cd cppunit-1.12.0
./configure
make
make check
make install

Note: Attempts to use CppUnit 1.12.1 have failed in the make check step.

FFTW

NOTE: Installing only the prebuilt DLLs from http://www.fftw.org/install/windows.html is not sufficient for building GNU Radio unless you know how to create the necessary pkgconfig file. Instructions on how to do this are welcome.

Follow the instructions in installing FFTW.

Small Device C Compiler (SDCC)

Not required to build GNU Radio but needed to use the USRP.

Download sdcc-2.8.0-setup.exe from SDCC downloads. Double-click on sdcc-2.8.0-setup.exe to install; the default prompts work fine, but only the base tools and the include files are needed. SDCC gets installed to C:\Program Files\SDCC. You will be given the option of adding this location to your Windows PATH; you can either do this (once only!) or add /c/Progra~1/SDCC/bin to your MSYS PATH (see PATH environment variable below).

Simple DirectMedia Layer (SDL)

This provides video capabilites; it is optional.

Download SDL-devel-1.2.13-mingw32.tar.gz from http://www.libsdl.org/download-1.2.php. Unpack and install with:

tar -zxf SDL-devel-1.2.13-mingw32.tar.gz
cd SDL-1.2.13
make cross CROSS_PATH=/usr/local

You can also download the source and do configure; make; make install if you prefer.

USB Library for Windows (libusb-win32)

Not required to build GNU Radio but needed to use the USRP.

Download libusb-win32-device-bin-0.1.12.1.tar.gz from libusb-win32 downloads to a convenient directory. Install with:

tar zxf libusb-win32-device-bin-0.1.12.1.tar.gz
cd libusb-win32-device-bin-0.1.12.1
cp include/* /usr/local/include
cp lib/gcc/* /usr/local/lib
cp bin/* /usr/local/bin

NOTE: As described at http://www.comsec.com/wiki?UsrpMinGW, make sure your WinXP installation has Service Pack 2, or at least hotfix kb838989. Refer to http://support.microsoft.com/kb/838989 for more information.

PortAudio

This package is required to build gr-audio-portaudio, which currently works better than gr-audio-windows. See hints, tips, known problems, and solutions for Windows for more information.

To install PortAudio see installing PortAudio.

If you are using bash version 2.04, both make and make install will encounter errors. The last few lines for the make command look something like:

for dir in ; do make -C $dir all; done
/bin/sh.exe: -c: line 1: syntax error near unexpected token `;'
/bin/sh.exe: -c: line 1: `for dir in ; do make -C $dir all; done'
make: *** [all-recursive] Error 2

And, the last few output lines of the make install command look like:

for dir in ; do make -C $dir install; done
/bin/sh.exe: -c: line 1: syntax error near unexpected token `;'
/bin/sh.exe: -c: line 1: `for dir in ; do make -C $dir install; done'
make[1]: *** [install-recursive] Error 2
make[1]: Leaving directory `/c/portaudio'
make: *** [install] Error 2

Don't worry about these errors; they do not affect the successful build and installation of portaudio. For more information, see hints, tips, known problems, and solutions for Windows.

PATH environment variable

You need to be sure that the GNU Radio build process can find Python and SWIG. One way to do this is to include them directly in your PATH variable. You can edit the file /etc/profile (i.e., C:\msys\1.0\etc\profile) to include a line like:

export PATH=".:/usr/local/bin:/mingw/bin:/bin:/c/Python24:/c/Python24/DLLs:/c/Python24/libs:/c/swigwin-1.3.35:$PATH"

or you can adjust your PATH in ~/.bash_profile. You should also add a line to /etc/profile or ~/.bash_profile to define the path to USRP firmware files, like the following example:

export USRP_PATH=/usr/local/share/usrp

These changes will take effect the next time you start a new MSYS shell.

Another way to make Python and SWIG available is to add scripts in the default PATH to point to the necessary programs. For example, the following script can be placed in /usr/local/bin/swig or /mingw/bin/swig:

#! /bin/sh
exec /c/swigwin-1.3.35/swig.exe "$@"

The script for python (in /usr/local/bin/python or /mingw/bin/python) is a little more complicated:

#! /bin/sh
if test $# -ne 0; then
  exec /c/Python24/python.exe "$@"
else
  exec /c/Python24/python.exe -i
fi

GNU Radio Software

Download gnuradio-3.1.3.tar.gz from Release3.1Branch and unpack it:

tar -zxf gnuradio-3.1.3.tar.gz
cd gnuradio-3.1.3

Set the necessary environment variables and run the configuration script:

export CPPFLAGS=-I/usr/local/include
export LDFLAGS="-L/usr/local/lib -lws2_32"
./configure --prefix=C:/msys/1.0/local

After ./configure completes, you should see the following messages in the MinGW window:

*********************************************************************
The following GNU Radio components have been successfully configured:

config
omnithread
gnuradio-core
usrp
gr-usrp
gr-audio-portaudio
gr-audio-windows
gr-atsc
gr-gpio
gr-gsm-fr-vocoder
gr-pager
gr-radar-mono
gr-radio-astronomy
gr-trellis
gr-video-sdl
gr-wxgui
gr-sounder
gr-utils
gnuradio-examples

You my now run the make command to build these components.

*********************************************************************
The following components were skipped either because you asked not
to build them or they didn't pass configuration checks:

gr-audio-alsa
gr-audio-jack
gr-audio-oss
gr-audio-osx
gr-comedi

These components will not be built.

Next, in the MinGW window, build the GNU Radio software by typing the following command:

make

Verify everything built properly by typing the following command:

make check

If you are using bash 2.04, you will need to work around the "for i in ;" problem: In gnuradio-3.1.3/usrp/doc/Makefile, comment out the following lines (approx. lines 755-759) as shown:

#	@for i in $(DOCBOOK_HTML_FILES); do \
#		echo "$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/html"; \
#		$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/html; \
#	done
#	cp -r html $(DESTDIR)$(docdir)

In gnuradio-3.1.3/gr-trellis/doc/Makefile, comment out the following lines (approx. lines 588-591) as shown:

#	@for i in $(HTML_FILES); do \
#		echo "$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/html"; \
#		$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/html; \
#	done

Install the GNU Radio software by typing the following command:

make install

USRP Driver Installation

If you have a USRP, you will need to install the driver for it. Refer to installing the USRP driver for Windows. However, note that 2 of the 3 files you need are in different locations than shown on that page. Use the following commands, instead of the ones shown on that page, to put the files in the same place:

cd /c/gnuradio-3.1.3/usrp
cp /c/libusb-win32-device-bin-0.1.12.1/bin/libusb0.sys .
cp /c/libusb-win32-device-bin-0.1.12.1/bin/libusb0.dll .

Then, follow the remaining instructions on the USRP driver install page for Windows.

Your USRP should be ready to go!

Attachments