|
From: | Christophe Devine |
Subject: | [Discuss-gnuradio] Compilation walkthrough for Windows x64 |
Date: | Wed, 14 Aug 2013 20:46:26 +0200 |
Disclaimer: this build of GNU Radio is not completely portable.
- Add to your PATH the location of the relevant DLLs. For example, if you unpacked this archive into C:\Users\john\Desktop, add C:\Users\john\Desktop\gnuradio-portable\bin to your PATH
- Create a new environment variable called UHD_IMAGE_PATH and pointing, in this example, to C:\Users\john\Desktop\gnuradio-portable\share\uhd\images
- Create or update the PYTHONPATH environment variable to point to gnuradio-portable's site-packages (here C:\Users\john\Desktop\gnuradio-portable\lib\site-packages)
- Create a directory named .gnuradio in your %HOME%, here C:\Users\john\.gnuradio. In this directory create a file named config.conf. Write into it:
[grc] global_blocks_path = C:\Users\john\Desktop\gnuradio-portable\share\gnuradio\grc\blocks local_blocks_path = [modtool] newmod_path = C:\Users\john\Desktop\gnuradio-portable\share\gnuradio\modtool\gr-newmod [DEFAULT] verbose = False max_messages = 100 [PerfCounters] on = False [audio] audio_module = auto [wxgui] style = auto fft_rate = 15 frame_decim = 1
If you have an USB-based device (USRP1, B100, RTL-SDR), you must install the WinUSB driver with http://sourceforge.net/projects/libwdi/files/zadig/zadig_v2.0.1.160.7z/download and possibly reboot.
Depending on whether you prefer to employ 32-bit or 64-bit binaries, you will need a matching 32-bit or 64-bit Python 2.7 (http://www.python.org/download/releases/2.7.4/).
The required Python packages can be downloaded in large part from Christoph Gohlke's excellent collection of packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/. You will need:
- Scipy-stack - recommended if you have a fresh install of Python 2.7 (otherwise, install Numpy-MLK only)
- wxPython and wxPython-common
- PyOpenGL and PyOpenGL-accelerate
- PyQt4 and PyQwt5
- lxml
If you use 32-bit binaries, install http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-all-in-one-2.24.2.win32-py2.7.msi
If you use 64-bit binaries:
- Install py2cairo, pygobject and pygtk from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygtk
- Extract http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip into C:\Python27\Lib\site-packages\gtk-2.0\runtime
- Copy build\pygtk.pth to C:\Python27\Lib\site-packages
- Copy build\__init__.py to C:\Python27\Lib\site-packages\gtk-2.0\runtime
- Validate your installation by running this script: http://www.pygtk.org/pygtk2tutorial/examples/helloworld.py
Run uhd_usrp_probe.exe in a Command Prompt, it should detect your USRP and load the firmware (two tries may be necessary for USB devices), then try running uhd_fft.py or gnuradio-companion.py. A simple GRC example is to connect an RTLSDR Source or USRP Source to the classic WX GUI Waterfall Sink, then click Build => Generate and Execute.
If you get the message "KeyError: Options", make sure global_blocks_path in your config.conf is setup correctly and if you compiled gnuradio yourself, also check that gr_prefs.cc was patched.
This guide has been validated using Visual Studio 2010 Professional SP1 on Windows 7. Other versions of Visual Studio or MinGW could work as well, but there is no guarantee.
- http://go.microsoft.com/?linkid=9709969 (Express ISO install)
- or http://download.microsoft.com/download/1/D/9/1D9A6C0E-FC89-43EE-9658-B9F0E3A76983/vc_web.exe (Express web install)
- or http://download.microsoft.com/download/4/0/E/40EFE5F6-C7A5-48F7-8402-F3497FABF888/X16-42555VS2010ProTrial1.iso (Professional)
Install:
- http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe
- http://download.microsoft.com/download/2/3/0/230C4F4A-2D3C-4D3B-B991-2A9133904E35/VS10sp1-KB983509.exe
- http://download.microsoft.com/download/7/5/0/75040801-126C-4591-BCE4-4CD1FD1499AA/VC-Compiler-KB2519277.exe
KB2519277 is only required on the Express edition (it restores the x64 compiler).
This guide is based on specific versions of open-source software, for example boost 1.53.0. Choosing older or newer versions is not recommended and can lead to build failures.
This guide described the compilation of 64-bit binaries. The same procedure can be followed as well to build 32-bit binaries, with minor flags adjustments:
- Install the 32-bit Python MSI instead of 64-bit Python
- Install 32-bit Python libraries of 64-bit Python libraries
- Replace /x64 with /x86 when calling setenv
- Compile boost without address-model=64
- Choose "Visual Studio 10" (not Win64) as the generator in cmake
- In the Visual Studio IDE, make sure Win32 is chosen
Install cmake, msysgit & Python 2.7 32-bit or 64-bit (they are required). When installing msysgit, choose "Run Git and included Unix tools from the Windows Command Prompt" and "Checkout as-is, commit as-is".
Recommended but optional: 7-Zip, Notepad++, doxygen and graphviz
Here we compile GNU Radio in release mode with symbols: RelWithDebInfo. Compiling in Debug mode has been tried: it can lead to runtime errors and therefore is not recommended unless you want to debug the Debug mode ;)
http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.zip/download
- Extract boost_1_53_0.zip into C:\src
- Open a Windows SDK 7.1 Command Prompt and run:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64 CD \src\boost_1_53_0 bootstrap SET PATH=C:\Python27;%PATH% b2 -j4 --toolset=msvc-10.0 debug release threading=multi/link=shared debug-symbols=on address-model=64
http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2/download
- Extract libusb-1.0.9.tar.bz2 into C:\src
- Open libusb_vs2010.sln, select libusb-1.0 (dll) as Startup Project
- Switch to x64. In Configuration Properties->General, change Platform Toolset from v100 to Windows7.1SDK
- Switch to Release mode, enable debugging symbols in the linking phase (Configuration Properties=>Linker=>Debugging =>Generate Debug Info=>Yes) and build
Download http://releases.qt-project.org/jom/jom_1_0_13.zip and http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.4.zip
- Extract qt-everywhere-opensource-src-4.8.4.zip into C:\src
- Rename C:\src\qt-everywhere-opensource-src-4.8.4 to C:\src\Qt-4.8.4
- Extract jom_1_0_13.zip into C:\src\Qt-4.8.4
- To enable debugging symbols in Release mode, edit C:\src\Qt-4.8.4\mkspecs\win32-msvc2010\qmake.conf
- add -Zi at the end of line 22 (variable QMAKE_CFLAGS_RELEASE)
- add /DEBUG at the end of line 59 (variable QMAKE_LFLAGS_RELEASE)
- Alter your user environment variables:
- set QTDIR to C:\src\Qt-4.8.4
- set QMAKESPEC to win32-msvc2010
- append to the existing PATH variable ;C:\src\Qt-4.8.4\bin
- Open a Windows SDK 7.1 Command Prompt and run:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64 CD \src\Qt-4.8.4 configure -debug-and-release -opensource -platform win32-msvc2010 -no-qt3support -no-webkit -nomake examples -nomake demos jom -j8
WebKit, Qt3 and examples/demos are disabled since they are not required and take a very long time to compile. Also, adjust the number of parallel jobs (here, 8) according to how many CPU cores you have. Compilation on a quad-core CPU should take about 20 minutes. Individual examples can be compiled in this way:
CD \src\Qt-4.8.4\examples\opengl\cube qmake -tp vc cube.pro "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe" cube.vcxproj
If you use a non-Express edition of Visual Studio 2010, consider installing the Qt4 plugin: http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.1.11-opensource.exe
http://sourceforge.net/projects/qwt/files/qwt/6.0.2/qwt-6.0.2.zip/download
- Extract qwt-6.0.2.zip into C:\src
- Open a Windows SDK 7.1 Command Prompt and run:
CD \src\qwt-6.0.2 "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64 qmake qwt.pro nmake
From http://www.lfd.uci.edu/~gohlke/pythonlibs/ download and install Cheetah-2.4.4.win-amd64-py2.7.exe and docutils-0.10.win-amd64-py2.7.exe (or their 32-bit counterparts)
Download:
- http://files.ettus.com/binaries/uhd_stable/uhd_003.005.002-release/uhd-source_003.005.002-release.tar.gz
- http://files.ettus.com/binaries/uhd_stable/uhd_003.005.002-release/uhd-images_003.005.002-release.tar.gz
- To avoid the error "fatal error RC1015: cannot open include file 'afxres.h'", edit C:\src\uhd-source_003.005.002-release\lib\uhd.rc and replace afxres.h with windows.h (only required on the Express edition, which does not have the MFC library)
- Start cmake-gui. Point "Where is the source code" to C:/src/uhd-source_003.005.002-release (note the forward slashes) and "Where to build the binaries" to C:/src/uhd-source_003.005.002-release/build
- Make sure the Advanced checkbox is ticked. Click on Configure, select Visual Studio 2010 Win64 as generator and set:
- BOOST_ALL_DYN_LINK must be checked
- Boost_INCLUDE_DIR to C:/src/boost_1_53_0
- CMAKE_CONFIGURATION_TYPES to Debug;Release;MinSizeRel;RelWithDebInfo
- CMAKE_INSTALL_PREFIX to gnuradio-portable
- RST2HTML_EXECUTABLE to C:/Python27/Scripts/rst2html.py
- Run Configure. Set:
- LIBUSB_INCLUDE_DIRS to C:/src/libusb-1.0.9/libusb
- if 32-bit: LIBUSB_LIBRARIES to optimized;C:/src/libusb-1.0.9/Win32/Release/dll/libusb-1.0.lib;debug;C:/src/libusb-1.0.9/Win32/Debug/dll/libusb-1.0.lib
- if 64-bit: LIBUSB_LIBRARIES to optimized;C:/src/libusb-1.0.9/x64/Release/dll/libusb-1.0.lib;debug;C:/src/libusb-1.0.9/x64/Debug/dll/libusb-1.0.lib
- Run Configure. E100 and ORC should be the only disabled components. Then click Generate.
- Open C:\src\uhd-source_003.005.002-release\build\UHD.sln, switch to RelWithDebInfo/x64 then build ALL_BUILD & INSTALL
libfftw (double precision) is used by IT++, while libfftwf (single precision) is used by GNU radio. Download http://www.fftw.org/fftw-3.3.3.tar.gz and ftp://ftp.fftw.org/pub/fftw/fftw-3.3-libs-visual-studio-2010.zip
Steps 3 to 5 are only required on the **Express** edition which lacks OpenMP.
- Extract fftw-3.3.3.tar.gz into C:\src
- Extract fftw-3.3-libs-visual-studio-2010 into C:\src\fftw-3.3.3
- Edit C:\src\fftw-3.3.3\fftw-3.3-libs\libfftw-3.3\config.h and #undef HAVE_OPENMP (line 198)
- Edit C:\src\fftw-3.3.3\fftw-3.3-libs\libfftwf-3.3\config.h and #undef HAVE_OPENMP (line 202)
- Open C:\src\fftw-3.3.3\fftw-3.3-libs\fftw-3.3-libs.sln
- in libfftw-3.3\Source Files\threads, remove openmp.c and add threads.c instead
- in libfftwf-3.3\Source Files\threads, remove openmp.c and add threads.c instead
- in each project Properties, in C/C++ to Language, set Open MP Support to No (/openmp-)
- Finally compile libfftw-3.3 and libfftwf-3.3 in Release/x64 mode
Download http://code.entropywave.com/download/orc/orc-0.4.17.tar.gz, extract into C:\src. Copy build\orcc.vcxproj and build\config.h into C:\src\orc-0.4.17. Open it and compile the executable.
Download http://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz/download, extract into C:\src. Open C:\src\cppunit-1.12.1\examples\examples.dsw, create a new platform x64 and compile cppunit (not cppunit_dll) in Release mode.
Download and extract into C:\src :
Please install the Python dependencies (see "Installing the Python dependencies" above).
To build the documentation (this is optional), install:
- Sphinx-1.1.3.win-amd64-py2.7.exe
- reportlab-2.7.win-amd64-py2.7.exe
- Jinja2-2.6.win-amd64-py2.7.exe
- Pygments-1.6.win-amd64-py2.7.exe
- Edit C:\src\gnuradio-3.6.4.1\CMakeLists.txt and add after line 98 add_definitions(/bigobj)
- Edit C:\src\gnuradio-3.6.4.1\gnuradio-core\src\lib\general\gr_prefs.cc, comment lines 71 to 80 (the conf.d dir will not exist, but we don't want to exit the function yet)
- Point cmake to C:/src/gnuradio-3.6.4.1 and C:/src/gnuradio-3.6.4.1/build, run Configure. Set:
- Boost_INCLUDE_DIR to C:/src/boost_1_53_0
- CMAKE_CONFIGURATION_TYPES to Debug;Release;MinSizeRel;RelWithDebInfo
- CMAKE_INSTALL_PREFIX to gnuradio-portable
- CPPUNIT_INCLUDE_DIRS to C:/src/cppunit-1.12.1/include
- CPPUNIT_LIBRARIES to C:/src/cppunit-1.12.1/lib/cppunit.lib
- SWIG_EXECUTABLE to C:/src/swigwin-2.0.9/swig.exe
- SYSCONFDIR to ../etc
- Run Configure. Qt4 should auto-configure thanks to QTDIR. Set:
- FFTW3F_INCLUDE_DIRS to C:/src/fftw-3.3.3/api
- if 32-bit: FFTW3F_LIBRARIES to optimized;C:/src/fftw-3.3.3/fftw-3.3-libs/Release/libfftwf-3.3.lib;debug;C:/src/fftw-3.3.3/fftw-3.3-libs/Debug/libfftwf-3.3.lib
- if 64-bit: FFTW3F_LIBRARIES to optimized;C:/src/fftw-3.3.3/fftw-3.3-libs/x64/Release/libfftwf-3.3.lib;debug;C:/src/fftw-3.3.3/fftw-3.3-libs/x64/Debug/libfftwf-3.3.lib
- ORCC_EXECUTABLE to C:/src/orc-0.4.17/orcc.exe
- QWT_INCLUDE_DIRS to C:/src/qwt-6.0.2/src
- QWT_LIBRARIES to optimized;C:/src/qwt-6.0.2/lib/qwt.lib;debug;C:/src/qwt-6.0.2/lib/qwtd.lib
- SPHINX_EXECUTABLE to C:/Python27/Scripts/sphinx-build.exe
- UHD_INCLUDE_DIRS to C:/src/uhd-source_003.005.002-release/include
- UHD_LIBRARIES to optimized;C:/src/uhd-source_003.005.002-release/build/lib/RelWithDebInfo/uhd.lib;debug;C:/src/uhd-source_003.005.002-release/build/lib/Debug/uhd.lib
- Run Configure then Generate. The only disabled targets should be gr-comedi, gr-qtgui, gr-shd, gr-video-sdl and gr-wavelet
- Open C:\src\gnuradio-3.6.4.1\build\gnuradio.sln, switch to RelWithDebInfo/x64 then build ALL_BUILD & INSTALL
If you get the error is "Unable to find file 'C:\src\gnuradio-3.6.4.1\gnuradio-core\src\lib\swig\gnuradio_core_filer.i'", work around it by copying (not renaming) gnuradio_core_filter.i to gnuradio_core_filer.i:
COPY C:\src\gnuradio-3.6.4.1\gnuradio-core\src\lib\swig\gnuradio_core_filter.i C:\src\gnuradio-3.6.4.1\gnuradio-core\src\lib\swig\gnuradio_core_filer.i
IT++ is not really required. It is mainly an standalone signal processing library which can provide alternatives to several of GNU Radio signal processing primitives.
In C:\src, svn checkout https://svn.code.sf.net/p/itpp/svn/itpp/trunk itpp
- Point cmake to C:/src/itpp and C:/src/itpp/build, run Configure. Set:
- CMAKE_INSTALL_PREFIX to gnuradio-portable
- FFT_INCLUDES to C:/src/fftw-3.3.3/api
- if 32-bit: FFT_LIBRARIES to optimized;C:/src/fftw-3.3.3/fftw-3.3-libs/Release/libfftw-3.3.lib;debug;C:/src/fftw-3.3.3/fftw-3.3-libs/Debug/libfftw-3.3.lib
- if 64-bit: FFT_LIBRARIES to optimized;C:/src/fftw-3.3.3/fftw-3.3-libs/x64/Release/libfftw-3.3.lib;debug;C:/src/fftw-3.3.3/fftw-3.3-libs/x64/Debug/libfftw-3.3.lib
- Run Configure and Generate. Open C:\src\itpp\build\itpp.sln, switch to RelWithDebInfo/x64 then build ALL_BUILD & INSTALL
CD \src git clone git://git.osmocom.org/rtl-sdr.git CD rtl-sdr git checkout a5dd532cbb2d3bdf9b7f2d7c3e111fff981ab11a
Download ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip and extract Pre-built.2 to C:\src
- Point cmake to C:/src/rtl-sdr and C:/src/rtl-sdr/build, run Configure. Set:
- CMAKE_INSTALL_PREFIX to gnuradio-portable
- LIBUSB_INCLUDE_DIR to C:/src/libusb-1.0.9/libusb
- if 32-bit: LIBUSB_LIBRARIES to optimized;C:/src/libusb-1.0.9/Win32/Release/dll/libusb-1.0.lib;debug;C:/src/libusb-1.0.9/Win32/Debug/dll/libusb-1.0.lib
- if 64-bit: LIBUSB_LIBRARIES to optimized;C:/src/libusb-1.0.9/x64/Release/dll/libusb-1.0.lib;debug;C:/src/libusb-1.0.9/x64/Debug/dll/libusb-1.0.lib
- THREADS_PTHREADS_INCLUDE_DIR to C:/src/Pre-built.2/include
- if 32-bit: THREADS_PTHREADS_WIN32_LIBRARY to C:/src/Pre-built.2/lib/x86/pthreadVC2.lib
- if 64-bit: THREADS_PTHREADS_WIN32_LIBRARY to C:/src/Pre-built.2/lib/x64/pthreadVC2.lib
- Run Configure and Generate. Open C:\src\rtl-sdr\build\rtlsdr.sln, switch to RelWithDebInfo/x64 then build ALL_BUILD & INSTALL
CD \src git clone git://git.osmocom.org/gr-osmosdr CD gr-osmosdr git checkout 871f0cc27308e0fe12bc60b02f2af2d927d4e29d
CD \src git clone https://github.com/guruofquality/grextras.git CD grextras git checkout 6f01ab3657ec33b7dea8e818b2f0667039b9334d
CD \src REN uhd-images_003.005.002-release gnuradio-portable XCOPY /S /I /Y uhd-source_003.005.002-release\build\gnuradio-portable gnuradio-portable XCOPY /S /I /Y gnuradio-3.6.4.1\build\gnuradio-portable gnuradio-portable XCOPY /S /I /Y itpp\build\gnuradio-portable gnuradio-portable XCOPY /S /I /Y rtl-sdr\build\gnuradio-portable gnuradio-portable XCOPY /S /I /Y gr-osmosdr\build\gnuradio-portable gnuradio-portable XCOPY /S /I /Y grextras\build\gnuradio-portable gnuradio-portable COPY boost_1_53_0\stage\lib\boost_date_time-vc100-mt-1_53.dll gnuradio-portable\bin COPY boost_1_53_0\stage\lib\boost_filesystem-vc100-mt-1_53.dll gnuradio-portable\bin COPY boost_1_53_0\stage\lib\boost_program_options-vc100-mt-1_53.dll gnuradio-portable\bin COPY boost_1_53_0\stage\lib\boost_regex-vc100-mt-1_53.dll gnuradio-portable\bin COPY boost_1_53_0\stage\lib\boost_system-vc100-mt-1_53.dll gnuradio-portable\bin COPY boost_1_53_0\stage\lib\boost_thread-vc100-mt-1_53.dll gnuradio-portable\bin COPY Qt-4.8.4\bin\QtCore4.dll gnuradio-portable\bin COPY Qt-4.8.4\bin\QtGui4.dll gnuradio-portable\bin COPY Qt-4.8.4\bin\QtSvg4.dll gnuradio-portable\bin COPY Qt-4.8.4\bin\QtOpenGL4.dll gnuradio-portable\bin COPY qwt-6.0.2\lib\qwt.dll gnuradio-portable\bin COPY fftw-3.3.3\api\fftw3.h gnuradio-portable\include MOVE gnuradio-portable\share\doc\gnuradio-3.6.4.1 gnuradio-3.6.4.1-doc
For 32-bit:
COPY fftw-3.3.3\fftw-3.3-libs\Release\libfftwf-3.3.lib gnuradio-portable\lib COPY fftw-3.3.3\fftw-3.3-libs\Release\libfftwf-3.3.dll gnuradio-portable\bin COPY fftw-3.3.3\fftw-3.3-libs\Release\libfftw-3.3.lib gnuradio-portable\lib COPY fftw-3.3.3\fftw-3.3-libs\Release\libfftw-3.3.dll gnuradio-portable\bin COPY libusb-1.0.9\Win32\Release\dll\libusb-1.0.dll gnuradio-portable\bin COPY Pre-built.2\dll\x86\pthreadVC2.dll gnuradio-portable\bin
For 64-bit:
COPY fftw-3.3.3\fftw-3.3-libs\x64\Release\libfftwf-3.3.lib gnuradio-portable\lib COPY fftw-3.3.3\fftw-3.3-libs\x64\Release\libfftwf-3.3.dll gnuradio-portable\bin COPY fftw-3.3.3\fftw-3.3-libs\x64\Release\libfftw-3.3.lib gnuradio-portable\lib COPY fftw-3.3.3\fftw-3.3-libs\x64\Release\libfftw-3.3.dll gnuradio-portable\bin COPY libusb-1.0.9\x64\Release\dll\libusb-1.0.dll gnuradio-portable\bin COPY Pre-built.2\dll\x64\pthreadVC2.dll gnuradio-portable\bin
[Prev in Thread] | Current Thread | [Next in Thread] |