# Importing blocks to GRC

**URL:** <https://www.ruby-forum.com/t/importing-blocks-to-grc/230061>\
**Category:** GNU Radio\
**Created:** [May 28, 2014, 10:02pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061 "2014-05-28T22:02:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 28, 2014, 10:02pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/1 "2014-05-28T22:02:54Z")

</div>

Hi,

I am working on a ubuntu machine and am following the HOWTO example as  
the  
following link shows. My program works fine until loading the  
howto\_square2\_ff module into the GRC library. The tutorial says that  
“If  
you do a make install from the build directory, you can use the block in  
GRC. If GRC is already running, you can hit the “Reload Blocks” button  
in  
the GRC toolbar; it’s a blue circular arrow on the right-hand side. You  
should now see a “HOWTO” category in the block tree.” After I executed  
the  
commands specified by the tutorial, I did not see any HOWTO blocks when  
I  
boot the GRC using $gnuradio-companion. Attached is a tarball of my  
code.  
Would be great to get comments. Thanks.

[http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules](http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules)

Pengyu

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 28, 2014, 10:27pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/2 "2014-05-28T22:27:31Z")

</div>

On Wed, May 28, 2014 at 1:01 PM, Pengyu Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> After I executed the commands specified by the tutorial, I did not see any  
> HOWTO blocks when I boot the GRC using $gnuradio-companion

If all the tests pass then this usually means there is a problem with  
your  
xml files. You should remove and everything in it as those …  
aren’t allowed. Also sudo ldconfig

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 28, 2014, 10:44pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/3 "2014-05-28T22:44:31Z")

</div>

I executed $gr\_modtool makexml square2\_ff before. So the content in  
/gr-howto/grc/howto\_square2\_ff.xml  
should be correct. As you pointed that stuff should be removed,  
I  
also did $gr\_modtool makexml square\_ff. Now the content in  
/gr-howto/grc/howto\_square\_ff.xml  
is shown below. Although I did $make install and $sudo ldconfig, I still  
cannot see the block on GRC…

 Square ff howto\_square\_ff HOWTO import howto howto.square\_ff() in float out float

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 28, 2014, 10:57pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/4 "2014-05-28T22:57:59Z")

</div>

On Wed, May 28, 2014 at 1:43 PM, Pengyu Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I still cannot see the block on GRC

I’m assuming you’re using ubuntu then.

Check your python path  
echo $PYTHONPATH

and ensure that you see the howto folder located there in the  
dist-packages

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 29, 2014, 3:38am UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/5 "2014-05-29T03:38:00Z")

</div>

On 05/28/2014 09:11 PM, Pengyu Z. wrote:

> ```
> <mailto:removed_email_address@domain.invalid>> wrote:
> dist-packages
> 
> ```
> 
> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)  
> No, it’s an environment variable. A Linux shell thing.

PYTHONPATH should be set to include the place where the installer  
installed the Python modules.

Setting users environment variables is unrelated to building software.

I usually set mine in my .bashrc:

PYTHONPATH=.:$HOME/bin:/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages  
PYTHONPATH=$PYTHONPATH:/usr/local/lib64/python2.7/site-packages:/usr/local/lib64/python2.7/dist-packages  
export PYTHONPATH

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 29, 2014, 3:12am UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/6 "2014-05-29T03:12:49Z")

</div>

When I do “echo $PYTHONPATH”, nothing shows up. How is $PYTHONPATH set?  
I  
thought it should be configured automatically by cmake and make.  
Correct?

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 29, 2014, 4:12am UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/7 "2014-05-29T04:12:34Z")

</div>

On Wed, May 28, 2014 at 6:36 PM, Marcus D. Leech [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Setting users environment variables is unrelated to building software.

That’s right. I more wanted to make sure that the thing installed  
correctly.

Pengyu,

I downloaded your zip and rebuilt it on my machine with no errors. I can  
use your square2 ff block just fine in GRC which leads me to believe  
there  
is something off with your setup. Not sure of the right question to ask  
at  
the moment though…

For fun, can you pastebin the output of  
cmake ..  
make  
make install

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 29, 2014, 6:30pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/8 "2014-05-29T18:30:14Z")

</div>

On Thu, May 29, 2014 at 5:13 AM, Pengyu Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I also think some configurations on my machine are not correct

Let’s simplify the problem even more. It should be the case that when  
you  
place a xml file in /usr/local/share/gnuradio/blocks/ it will show up in  
GNU Radio Companion regardless of if you actually made the block. Do a  
sudo  
cp on howto\_square2\_ff.xml. Then open up GNU Radio and see if you can  
find  
the HOWTO category and the square block.

If that doesn’t work, GNU Radio is likely searching somewhere else for  
new  
blocks similar to this problem  
[http://gnuradio.4.n7.nabble.com/Cannot-see-my-custom-blocks-in-GRC-td45780.htmlsince](http://gnuradio.4.n7.nabble.com/Cannot-see-my-custom-blocks-in-GRC-td45780.htmlsince)  
your versions match. I recommend updating.

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 29, 2014, 2:15pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/9 "2014-05-29T14:15:21Z")

</div>

Yeah. I also think some configurations on my machine are not correct.  
Here  
are the output of several commands.

$ cmake …  
– The CXX compiler identification is GNU 4.8.2  
– The C compiler identification is GNU 4.8.2  
– Check for working CXX compiler: /usr/bin/c++  
– Check for working CXX compiler: /usr/bin/c++ – works  
– Detecting CXX compiler ABI info  
– Detecting CXX compiler ABI info - done  
– Check for working C compiler: /usr/bin/cc  
– Check for working C compiler: /usr/bin/cc – works  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Build type not specified: defaulting to release.  
– Boost version: 1.54.0  
– Found the following Boost libraries:  
– filesystem  
– system  
– Found PkgConfig: /usr/bin/pkg-config (found version “0.26”)  
– checking for module ‘gnuradio-runtime’  
– found gnuradio-runtime, version 3.7.2.1  
– Found GNURADIO\_RUNTIME:  
/usr/lib/x86\_64-linux-gnu/libgnuradio-runtime.so  
– checking for module ‘cppunit’  
– found cppunit, version 1.13.1  
– Found CPPUNIT: /usr/lib/x86\_64-linux-gnu/libcppunit.so;dl  
– Found SWIG: /usr/bin/swig2.0 (found version “2.0.11”)  
– Found PythonLibs: /usr/lib/x86\_64-linux-gnu/libpython2.7.so (found  
suitable version “2.7.6”, minimum required is “2”)  
CMake Warning (dev) at cmake/Modules/GrSwig.cmake:25 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

```

Argument not separated from preceding token by whitespace.  
Call Stack (most recent call first):  
swig/CMakeLists.txt:28 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:25 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

```

Argument not separated from preceding token by whitespace.  
Call Stack (most recent call first):  
swig/CMakeLists.txt:28 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:25 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

```

Argument not separated from preceding token by whitespace.  
Call Stack (most recent call first):  
swig/CMakeLists.txt:28 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

– Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.6”,  
minimum required is “2”)  
CMake Warning (dev) at swig/CMakeLists.txt:29 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at swig/CMakeLists.txt:29 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at swig/CMakeLists.txt:29 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

– Found Doxygen: /usr/bin/doxygen (found version “1.8.6”)  
CMake Warning (dev) at cmake/Modules/GrSwig.cmake:182 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

```

Argument not separated from preceding token by whitespace.  
Call Stack (most recent call first):  
swig/CMakeLists.txt:47 (GR\_SWIG\_INSTALL)  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:182 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

```

Argument not separated from preceding token by whitespace.  
Call Stack (most recent call first):  
swig/CMakeLists.txt:47 (GR\_SWIG\_INSTALL)  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:182 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

```

Argument not separated from preceding token by whitespace.  
Call Stack (most recent call first):  
swig/CMakeLists.txt:47 (GR\_SWIG\_INSTALL)  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at python/CMakeLists.txt:23 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at python/CMakeLists.txt:23 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at python/CMakeLists.txt:23 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/CMakeLists.txt:20 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/CMakeLists.txt:20 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/CMakeLists.txt:20 (include):  
Syntax Warning in cmake code at

```
/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

```

Argument not separated from preceding token by whitespace.  
This warning is for project developers. Use -Wno-dev to suppress it.

– Configuring done  
– Generating done  
– Build files have been written to: /home/vijaykp/gr-howto/build

$ make  
Scanning dependencies of target gnuradio-howto  
[5%] Building CXX object  
lib/CMakeFiles/gnuradio-howto.dir/square\_ff\_impl.cc.o  
[10%] Building CXX object  
lib/CMakeFiles/gnuradio-howto.dir/square2\_ff\_impl.cc.o  
Linking CXX shared library libgnuradio-howto.so  
[10%] Built target gnuradio-howto  
Scanning dependencies of target test-howto  
[15%] Building CXX object lib/CMakeFiles/test-howto.dir/test\_howto.cc.o  
[21%] Building CXX object lib/CMakeFiles/test-howto.dir/qa\_howto.cc.o  
Linking CXX executable test-howto  
[21%] Built target test-howto  
Scanning dependencies of target \_howto\_swig\_doc\_tag  
[26%] Building CXX object  
swig/CMakeFiles/\_howto\_swig\_doc\_tag.dir/\_howto\_swig\_doc\_tag.cpp.o  
Linking CXX executable \_howto\_swig\_doc\_tag  
[26%] Built target \_howto\_swig\_doc\_tag  
Scanning dependencies of target \_howto\_swig\_swig\_tag  
[31%] Building CXX object  
swig/CMakeFiles/\_howto\_swig\_swig\_tag.dir/\_howto\_swig\_swig\_tag.cpp.o  
Linking CXX executable \_howto\_swig\_swig\_tag  
[31%] Built target \_howto\_swig\_swig\_tag  
[36%] Generating doxygen xml for howto\_swig\_doc docs  
Warning: Tag `SYMBOL_CACHE_SIZE' at line 289 of file /home/vijaykp/gr-howto/build/swig/howto_swig_doc_swig_docs/Doxyfile has become obsolete. To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u" Warning: Tag `SHOW\_DIRECTORIES’ at line 477 of file  
/home/vijaykp/gr-howto/build/swig/howto\_swig\_doc\_swig\_docs/Doxyfile has  
become obsolete.  
To avoid this warning please remove this line from your configuration  
file  
or upgrade it using “doxygen -u”  
Warning: Tag `HTML_ALIGN_MEMBERS' at line 803 of file /home/vijaykp/gr-howto/build/swig/howto_swig_doc_swig_docs/Doxyfile has become obsolete. To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u" Warning: Tag `USE\_INLINE\_TREES’ at line 956 of file  
/home/vijaykp/gr-howto/build/swig/howto\_swig\_doc\_swig\_docs/Doxyfile has  
become obsolete.  
To avoid this warning please remove this line from your configuration  
file  
or upgrade it using “doxygen -u”  
Warning: doxygen no longer ships with the FreeSans font.  
You may want to clear or change DOT\_FONTNAME.  
Otherwise you run the risk that the wrong font is being used for dot  
generated graphs.  
[42%] Generating howto\_swig\_doc.i  
[47%] Generating howto\_swig.tag  
[52%] Swig source  
Scanning dependencies of target \_howto\_swig  
[57%] Building CXX object  
swig/CMakeFiles/\_howto\_swig.dir/howto\_swigPYTHON\_wrap.cxx.o  
Linking CXX shared module \_howto\_swig.so  
[57%] Built target \_howto\_swig  
Scanning dependencies of target pygen\_swig\_34533  
[63%] Generating howto\_swig.pyc  
[68%] Generating howto\_swig.pyo  
[89%] Built target pygen\_swig\_34533  
Scanning dependencies of target pygen\_python\_62df5  
[94%] Generating **init**.pyc  
[100%] Generating **init**.pyo  
[100%] Built target pygen\_python\_62df5  
Scanning dependencies of target pygen\_apps\_9a6dd  
[100%] Built target pygen\_apps\_9a6dd

$ make test  
Running tests…  
Test project /home/vijaykp/gr-howto/build  
Start 1: test\_howto  
1/2 Test #1: test\_howto … Passed 0.00 sec  
Start 2: qa\_square\_ff  
2/2 Test #2: qa\_square\_ff … Passed 0.36 sec

100% tests passed, 0 tests failed out of 2

Total Test time (real) = 0.37 sec

$ sudo make install  
[10%] Built target gnuradio-howto  
[21%] Built target test-howto  
[26%] Built target \_howto\_swig\_doc\_tag  
[31%] Built target \_howto\_swig\_swig\_tag  
[57%] Built target \_howto\_swig  
[89%] Built target pygen\_swig\_34533  
[100%] Built target pygen\_python\_62df5  
[100%] Built target pygen\_apps\_9a6dd  
Install the project…  
– Install configuration: “Release”  
– Up-to-date: /usr/local/lib/cmake/howto/howtoConfig.cmake  
– Up-to-date: /usr/local/include/howto/api.h  
– Up-to-date: /usr/local/include/howto/square\_ff.h  
– Up-to-date: /usr/local/include/howto/square2\_ff.h  
– Installing: /usr/local/lib/libgnuradio-howto.so  
– Installing:  
/usr/local/lib/python2.7/dist-packages/howto/\_howto\_swig.so  
– Removed runtime path from  
“/usr/local/lib/python2.7/dist-packages/howto/\_howto\_swig.so”  
– Installing:  
/usr/local/lib/python2.7/dist-packages/howto/howto\_swig.py  
– Installing:  
/usr/local/lib/python2.7/dist-packages/howto/howto\_swig.pyc  
– Installing:  
/usr/local/lib/python2.7/dist-packages/howto/howto\_swig.pyo  
– Up-to-date: /usr/local/include/howto/howto/swig/howto\_swig.i  
– Installing: /usr/local/include/howto/howto/swig/howto\_swig\_doc.i  
– Up-to-date: /usr/local/lib/python2.7/dist-packages/howto/ **init**.py  
– Installing: /usr/local/lib/python2.7/dist-packages/howto/ **init**.pyc  
– Installing: /usr/local/lib/python2.7/dist-packages/howto/ **init**.pyo  
– Up-to-date: /usr/local/share/gnuradio/grc/blocks/howto\_square\_ff.xml  
– Up-to-date: /usr/local/share/gnuradio/grc/blocks/howto\_square2\_ff.xml

$ sudo ldconfig  
$

On Wed, May 28, 2014 at 10:11 PM, Alfredo M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [May 29, 2014, 8:23pm UTC](https://www.ruby-forum.com/t/importing-blocks-to-grc/230061/10 "2014-05-29T20:23:18Z")

</div>

I think the default GNU Radio search path is  
/usr/share/gnuradio/grc/blocks  
because all existing blocks are stored within this directory. I added  
the  
new path into GRC\_BLOCKS\_PATH variable.

export  
GRC\_BLOCKS\_PATH=/usr/local/share/gnuradio/grc/blocks:$GRC\_BLOCKS\_PATH

Now I can see the howto block in GRC. For a quick test, I connected a  
constant source 0.5 to the howto module. The output of howto module is  
0.25, which is the square of input. Therefore, the gr-howto block  
functions  
as expected. However, when I run the GRC, I saw one error message and am  
not sure what it indicates.

libGL error: failed to load driver: swrast

On Thu, May 29, 2014 at 12:28 PM, Alfredo M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
