Talk:InstallingGR: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 21: Line 21:
* <code>cd build</code>
* <code>cd build</code>
* Note: Use <code>-DCMAKE_INSTALL_PREFIX=XXX</code> in the following <code>cmake</code> command to install GNU Radio into the PREFIX <code>XXX</code>; if not specified, then the PREFIX is <code>/usr/local</code>.<br>
* Note: Use <code>-DCMAKE_INSTALL_PREFIX=XXX</code> in the following <code>cmake</code> command to install GNU Radio into the PREFIX <code>XXX</code>; if not specified, then the PREFIX is <code>/usr/local</code>.<br>
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code>  # see other options below
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code>  # see other options in [[#Common_cmake_flags|Common cmake flags]].
* Note: If your computer's CPU has multiple cores, you can use the <code>-j#</code> option for <code>make</code> in the following command to speed compilation, e.g., <code>make -j3</code>; specify one less than the number of CPU cores so the system does not appear to 'freeze'.<br>
* Note: If your computer's CPU has multiple cores, you can use the <code>-j#</code> option for <code>make</code> in the following command to speed compilation, e.g., <code>make -j3</code>; specify one less than the number of CPU cores so the system does not appear to 'freeze'.<br>
* <code>make</code>
* <code>make</code>
Line 31: Line 31:


== Setting PYTHONPATH ==
== Setting PYTHONPATH ==
 
<br>
=== Linux-based systems and MacOSX / macOS ===
* For MacOSX / macOS, most Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, use:
For MacOSX / macOS, most Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, use:
<pre>
<pre>
export PYTHONPATH={prefix}/lib/python3/dist-packages:{prefix}/lib/python3/site-packages:$PYTHONPATH
export PYTHONPATH={prefix}/lib/python3/dist-packages:{prefix}/lib/python3/site-packages:$PYTHONPATH
</pre>
</pre>


For other 64-bit systems, use:
* For other 64-bit systems, use:
<pre>
<pre>
export PYTHONPATH={prefix}/lib64/python3/site-packages:$PYTHONPATH
export PYTHONPATH={prefix}/lib64/python3/site-packages:$PYTHONPATH
Line 44: Line 43:


== Setting LD_LIBRARY_PATH ==
== Setting LD_LIBRARY_PATH ==
 
<br>
=== Linux-based systems ===
* For most 32-bit systems and most Debian / Ubuntu (and derivative) systems, use:
For most 32-bit systems and most Debian / Ubuntu (and derivative) systems, use:
<pre>
<pre>
export LD_LIBRARY_PATH={prefix}/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH={prefix}/lib:$LD_LIBRARY_PATH
</pre>
</pre>


For other 64-bit systems, use:
* For other 64-bit systems
<pre>
<pre>
export LD_LIBRARY_PATH={prefix}/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH={prefix}/lib64:$LD_LIBRARY_PATH
</pre>
</pre>


=== MacOSX / macOS ===
* MacOSX / macOS


On MacOSX / macOS, the library search path is set primarily by the environment variable DYLD_LIBRARY_PATH. Because of the way the OSX dynamic library loader works, this variable works differently than on Linux. Its primary purpose is in finding libraries in a local path, such as when testing software before installing it, or inside an application. <b>We strongly recommend against setting this variable globally.
On MacOSX / macOS, the library search path is set primarily by the environment variable DYLD_LIBRARY_PATH. Because of the way the OSX dynamic library loader works, this variable works differently than on Linux. Its primary purpose is in finding libraries in a local path, such as when testing software before installing it, or inside an application. <b>We strongly recommend against setting this variable globally.</b>


== Common cmake flags ==
== Common cmake flags ==

Revision as of 01:54, 28 January 2020

From Source

Binary installation should be sufficient for most users, and certainly for anyone who is new to GNU Radio. However, if you have special requirements, want the latest version, or the binary packages are not working for you, you may want to install GNU Radio from source.

Notes

To install system wide

It is highly recommended that you start in your home directory.

  • cd ~/
  • git clone --recursive https://github.com/gnuradio/gnuradio.git
  • cd gnuradio
  • git checkout maint-3.8 # change `maint-3.8` if you want to use a different version; see releases
  • mkdir build
  • cd build
  • Note: Use -DCMAKE_INSTALL_PREFIX=XXX in the following cmake command to install GNU Radio into the PREFIX XXX; if not specified, then the PREFIX is /usr/local.
  • cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../ # see other options in Common cmake flags.
  • Note: If your computer's CPU has multiple cores, you can use the -j# option for make in the following command to speed compilation, e.g., make -j3; specify one less than the number of CPU cores so the system does not appear to 'freeze'.
  • make
  • make test
  • sudo make install
  • sudo ldconfig
  • Use your prefix in place of {prefix} in the following commands, put them in your ~/.bashrc or ~/.profile or ~/.bash_aliases file and restart your terminal.

Setting PYTHONPATH


  • For MacOSX / macOS, most Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, use:
export PYTHONPATH={prefix}/lib/python3/dist-packages:{prefix}/lib/python3/site-packages:$PYTHONPATH
  • For other 64-bit systems, use:
export PYTHONPATH={prefix}/lib64/python3/site-packages:$PYTHONPATH

Setting LD_LIBRARY_PATH


  • For most 32-bit systems and most Debian / Ubuntu (and derivative) systems, use:
export LD_LIBRARY_PATH={prefix}/lib:$LD_LIBRARY_PATH
  • For other 64-bit systems
export LD_LIBRARY_PATH={prefix}/lib64:$LD_LIBRARY_PATH
  • MacOSX / macOS

On MacOSX / macOS, the library search path is set primarily by the environment variable DYLD_LIBRARY_PATH. Because of the way the OSX dynamic library loader works, this variable works differently than on Linux. Its primary purpose is in finding libraries in a local path, such as when testing software before installing it, or inside an application. We strongly recommend against setting this variable globally.

Common cmake flags

  • -DENABLE_GR_XXX=ON This enables (or disables for =OFF) the GNU Radio component named XXX. You might not need all of them, and this way, you can compile quicker.
  • -DCMAKE_INSTALL_PREFIX=XXX Install your stuff to XXX.
  • -DCMAKE_BUILD_TYPE=Debug This causes gcc to add debug symbols to all binaries. Useful for debugging (otherwise, it decreases efficiency!)
  • -DPYTHON_EXECUTABLE=/usr/bin/python{2,3} This selects the Python version and executable to be used during build time and will determine which Python libraries will be used for building the Python bindings.

For a list of additional cmake flags, as well as minimum versions of dependencies, see [1]