Gnuradio Study notes (1) compiling with Visual Studio Gnuradio

Source: Internet
Author: User
Tags visual studio 2010

Objective: Sample program for compiling gnuradio using Visual Studio Dial_tone. 1. Installing Visual Studio 2010

Slightly

2. Install the Boost Library

Download the latest source package from the Boost website, unzip, follow the Gnuradio source code directory under the Readme.building-boost file description, the boost library to compile and install. Open a Visual Studio 2010 command-line window and run:

Bootstrap.bat

Set boost_prefix=<path_to_install_boost_dir>

B2--prefix=%boost_prefix%--with-thread--with-date_time--with-program_options--with-filesystem--with-system-- With-test--with-regex--layout=versioned Threading=multi Install

"Note 1": the command given in the Readme.building-boost document does not have--with-test and--with-regex two parameters, but the two libraries are used during compilation, so I added these two libraries.

"Note 2": In the command given in the Readme.building-boost document, the Variant=release parameter indicates the release version of the Boost library is generated. The debug version of the Boost library is also required in order to develop your own program debugging in the future, so I removed this parameter and generated the debug and release version of the Boost library.

Note 3: If you have more than one version of Visual Studio installed, you will need to increase toolset=msvc-10.0 to specify a compiler that uses Visual Studio 2010. After I installed Visual Studio 2013, even though I compiled the Boost library from the Visual Studio 2010 command line, we used a 2013 compiler (msvc-12.0).

3. Install Python

Download Python 2.7.x from the Python website and install it with the default options. After installation, also need to install Cheetah package, I was installed through the PIP Cheetah 2.4.4, can also be downloaded to Cheetah official website offline installation.

4, Installation Mingw-binutils

When using CMake to configure Gnuradio source code, you need to specify the/T ASM assembler, install Mingw-binutils. In fact, compiling gnuradio under the Windows platform, without the assembly files to process, may be lazy when writing cmake scripts.

5, Prepare FFTW

Download the precompiled Windows DLL file to the FFTW website and unzip it to follow Readme-windows the steps in the file, generate libfftw3f-3.lib this library file.

6, Prepare CMake

Download the latest CMake tool from CMake website, I use 3.3.0

Ii. using CMake to build a Visual Studio project

Prepare an empty directory to generate the output directory for the Visual Studio project as a cmake. First, the following cmake variables are defined in Cmake-gui:

Boost_root

The Boost Library installation directory path, which is mentioned above %boost_prefix%

Boost_all_dyn_link

Set to False

boost_inlcude_dir

boost Library header file path, i.e. %boost_prefix%/include/ boost-1_57

boost_library_dirs

boost library file path, that is %boost_prefix%/lib

cmake_asm-att_compiler

at&t ASM assembler path, %mingw_prefix%/bin/as.exe

fftw3f_include_dirs

fftw library header file directory

fftw3f_libraries

libfftw3f-3.lib file path

Cmake_install_prefix

directory path for installing Gnuradio

Then click on the Configuration button to configure, CMake will list all the relevant configuration variables. Tick "grouped" to group the listed configuration items, and under the "ENABLE" group, remove the modules unrelated to the Dial_tone, such as:

Then click "Configuration" again to configure, there should be no error message appears. Finally click on "Generate" to generate Visual Studio solutions and projects.

Third, modify the Gnuradio source code

Gnuradio source code directly generated by Visual Studio Engineering compilation will report errors, which are addressed for several major errors, respectively.

1. Error D8016: "/o2" and "/RTC1" command line options are incompatible

This error occurs because the CMake script adds the "/o2" optimization parameter to the compiler parameter in Debug mode, the solution is to modify the Gnuradio source root directory CMakeLists.txt file, find the following content, two lines of the set command commented out:

# #

2. Error C1083: Cannot open include file: "Pthread.h": No such files or directory

This error is now in the process of compiling the Volk module, the workaround is to modify the Volk/lib/cmakelists.txt, navigate to the following position, adding the contents marked red:

######################################################################## # Set local include directories first ###### ################################################################## include_directories (     ${CMAKE_BINARY_DIR} /include     ${cmake_source_dir}/include     ${cmake_source_dir}/kernels    ${cmake_current_binary_dir}     $ {Cmake_current_source_dir}     "<path_to_pthreads_dir>/include"

3. Error LNK1104: Unable to open file "Libboost_xxxxx-vc100-mt-gd-1_57.lib"

This error is now in the process of compiling Volk and Gnuradio-runtime, the workaround is to modify the following several CMakeLists.txt to add the contents marked Red :

(1) Volk/apps/cmakelists.txt

Include_directories (     ${cmake_current_source_dir}     ${cmake_current_binary_dir}     ${cmake_source_dir}/ Include     ${cmake_binary_dir}/include     ${cmake_source_dir}/lib     ${cmake_binary_dir}/lib     

(2) Gnuradio-runtime/lib/cmakelists.txt

Include_directories (${gnuradio_runtime_include_dirs}                             ${cmake_current_source_dir}                             ${CMAKE_CURRENT_ binary_dir}/. /include/                             ${volk_include_dirs}                             link_directories (${boost_library_dirs})

(3) Gr-audio/examples/c++/cmakelists.txt

Include_directories (     ${gr_audio_include_dirs}     ${gr_analog_include_dirs}     ${gnuradio_runtime_include _dirs}     

4, fatal error LNK1104: Can't open File "Boost_unit_test_framework-vc100-mt-gd-1_57.lib"

This error occurs during the Test_all project build process, and the workaround is to modify Volk/apps/cmakelists.txt , find the following code location, delete the red strikethrough tag.

if (boost_found)     set_source_files_properties (          ${cmake_current_source_dir}/testqa.cc Properties          Compile_definitions "Boost_test_dyn_link; Boost_test_main "     )     

Iv. Compiling and installing

Open the Visual Studio 2010 command prompt, switch to the Gnuradio configuration cache directory, and run:

MSBuild Install.vcxproj/p:configuration=release. The generated content will be installed in the directory indicated by Cmake_install_prefix

V. Operation of Dial_tone

Under cmake_install_prefix/share/gnuradio/examples/audio directory, copy Dial_tone.exe to Cmake_install_prefix /bin directory, copy the Libfftw3f-3.dll to the cmake_install_prefix/bin directory, double-click the Dial_tone.exe to run, you can hear the sound.

Gnuradio Study notes (1) compiling with Visual Studio Gnuradio

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.